Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into eshaben/moonbeam-vs-eth
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaben committed Apr 30, 2024
2 parents aa237e0 + 3fdef02 commit 70e066e
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 15 deletions.
4 changes: 3 additions & 1 deletion builders/build/runtime-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The following table contains a list of the runtime upgrades and the block at whi
Not all runtime upgrades are released on each network, as sometimes after releasing the initial runtime upgrade, the need for a subsequent upgrade arises. If a runtime upgrade version has been skipped or hasn't been released yet (only applicable to the latest runtime upgrade), you'll see a `-` in that row.

| Runtime | Moonbeam | Moonriver | Moonbase Alpha |
| :--------------------------------------------------------------------------------------: | :------------------------------------------------------------------: | :-------------------------------------------------------------------: | :------------------------------------------------------------------: |
|:----------------------------------------------------------------------------------------:|:--------------------------------------------------------------------:|:---------------------------------------------------------------------:|:--------------------------------------------------------------------:|
| 40 | - | - | [0](https://moonbase.subscan.io/block/0){target=\_blank} |
| 44 | - | - | [142863](https://moonbase.subscan.io/block/142863){target=\_blank} |
| 47 | - | - | [209144](https://moonbase.subscan.io/block/209144){target=\_blank} |
Expand Down Expand Up @@ -76,3 +76,5 @@ Not all runtime upgrades are released on each network, as sometimes after releas
| [2602](https://forum.moonbeam.network/t/runtime-rt2600-schedule/1372/13){target=\_blank} | [4977160](https://moonbeam.subscan.io/block/4977160){target=\_blank} | [5638536](https://moonriver.subscan.io/block/5638536){target=\_blank} | [5576588](https://moonbase.subscan.io/block/5576588){target=\_blank} |
| [2700](https://forum.moonbeam.network/t/runtime-rt2700-schedule/1441/3){target=\_blank} | [5504531](https://moonbeam.subscan.io/block/5504531){target=\_blank} | [6041969](https://moonriver.subscan.io/block/6041969){target=\_blank} | [5860584](https://moonbase.subscan.io/block/5860584){target=\_blank} |
| [2801](https://forum.moonbeam.network/t/runtime-rt2801-schedule/1616/4){target=\_blank} | [5899847](https://moonbeam.subscan.io/block/5899847){target=\_blank} | [6411588](https://moonriver.subscan.io/block/6411588){target=\_blank} | [6209638](https://moonbase.subscan.io/block/6209638){target=\_blank} |
| [2901](https://forum.moonbeam.network/t/runtime-rt2901-schedule/1695){target=\_blank} | - | - | [6710531](https://moonbase.subscan.io/block/6710531){target=\_blank} |
| 2902 | - | - | [6732678](https://moonbase.subscan.io/block/6732678){target=\_blank} |
59 changes: 56 additions & 3 deletions builders/interoperability/xcm/remote-execution/remote-evm-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,69 @@ Another significant difference is in terms of the gas price. The fee for remote

The last difference is in terms of the gas limit. Ethereum uses a gas-metered system to moderate the amount of execution that can be done in a block. On the contrary, Moonbeam uses a [weight-based system](https://docs.substrate.io/build/tx-weights-fees/){target=\_blank} in which each call is characterized by the time it takes to execute in a block. Each unit of weight corresponds to one picosecond of execution time.

The configuration of the XCM queue suggests that XCM messages should be executable within `20,000,000,000` weight units (that is, `0.02` seconds of block execution time). Suppose the XCM message can't be executed due to the lack of execution time in a given block, and the weight requirement is over `20,000,000,000`. In that case, the XCM message will be marked as `overweight` and will only be executable through democracy.
As of runtime 2900, the configuration of the XCM queue suggests that XCM messages should be executable within the following weight units:

The `20,000,000,000` weight limit per XCM message constrains the gas limit available for remote EVM calls through XCM. For all Moonbeam-based networks, there is a ratio of [`25,000` units of gas per unit of weight](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/runtime/moonbase/src/lib.rs#L402){target=\_blank} ([`WEIGHT_REF_TIME_PER_SECOND`](https://paritytech.github.io/substrate/master/frame_support/weights/constants/constant.WEIGHT_REF_TIME_PER_SECOND.html){target=\_blank} / [`GAS_PER_SECOND`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/runtime/moonbase/src/lib.rs#398){target=\_blank}). Considering that you need some of the XCM message weight to execute the XCM instructions themselves. Therefore, a remote EVM call might have around `18,000,000,000` weight left, which is `720,000` gas units. Consequently, the maximum gas limit you can provide for a remote EVM call is around `720,000` gas units. Note that this might change in the future.
=== "Moonbeam"

```text
125,000,000,000 (0.125 seconds of block execution time)
```

=== "Moonriver"

```text
125,000,000,000 (0.125 seconds of block execution time)
```

=== "Moonbase Alpha"

```text
500,000,000,000 (0.5 seconds of block execution time)
```

!!! note
Prior to runtime 2900, the weight limit of XCM messages across all networks was `20,000,000,000` weight units (this is, `0.02` seconds of block execution time).

Suppose the XCM message can't be executed due to the lack of execution time in a given block, and the weight requirement exceeds the above limits. In that case, the XCM message will be marked as `overweight` and only be executable through democracy.

The maximum weight limit per XCM message constrains the gas limit available for remote EVM calls through XCM. For all Moonbeam-based networks, there is a ratio of [`25,000` units of gas per unit of weight](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/runtime/moonbase/src/lib.rs#L402){target=\_blank} ([`WEIGHT_REF_TIME_PER_SECOND`](https://paritytech.github.io/substrate/master/frame_support/weights/constants/constant.WEIGHT_REF_TIME_PER_SECOND.html){target=\_blank} / [`GAS_PER_SECOND`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/runtime/moonbase/src/lib.rs#398){target=\_blank}). Considering that you need some XCM message weight to execute the XCM instructions, a remote EVM call might consume 2,000,000,000 units. The following equation can be used to determine the maximum gas units for a remote EVM call:

```text
Maximum Gas Units = (Maximum Weight Units - Remote EVM Weight Units) / 25,000
```

Therefore, the maximum gas limit you can provide for a remote EVM call can be calculated:

=== "Moonbeam"

```text
Maximum Gas Units = (125,000,000,000 - 2,000,000,000) / 25,000
Maximum Gas Units = 4,920,000
```

=== "Moonriver"

```text
Maximum Gas Units = (125,000,000,000 - 2,000,000,000) / 25,000
Maximum Gas Units = 4,920,000
```

=== "Moonbase Alpha"

```text
Maximum Gas Units = (500,000,000,000 - 2,000,000,000) / 25,000
Maximum Gas Units = 19,920,000
```

!!! note
These values are subject to change in the future.

In summary, these are the main differences between regular and remote EVM calls:

- Remote EVM calls use a global nonce (owned by the [Ethereum XCM Pallet](https://github.com/moonbeam-foundation/moonbeam/tree/master/pallets/ethereum-xcm){target=\_blank}) instead of a nonce per account
- The `v-r-s` values of the signature for remote EVM calls are `0x1`. The sender can't be retrieved from the signature through standard methods (for example, through [ECRECOVER](/builders/pallets-precompiles/precompiles/eth-mainnet/#verify-signatures-with-ecrecover){target=\_blank}). Nevertheless, the `from` is included in both the transaction receipt and when getting the transaction by hash (using the Ethereum JSON-RPC)
- The gas price for all remote EVM calls is zero. The EVM execution is charged at an XCM execution level and not at an EVM level
- The current maximum gas limit you can set for a remote EVM call is `720,000` gas units
- The current maximum gas limit you can set for a remote EVM call is different, as outlined above

## Ethereum XCM Pallet Interface {: #ethereum-xcm-pallet-interface}

Expand Down
1 change: 1 addition & 0 deletions builders/interoperability/xcm/xc20/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ The current list of available external XC-20 assets per network is as follows:
| Phala | xcPHA | [0xFFFfFfFf63d24eCc8eB8a7b5D0803e900F7b6cED](https://moonscan.io/token/0xFFFfFfFf63d24eCc8eB8a7b5D0803e900F7b6cED){target=\_blank} |
| Polkadex | xcPDEX | [0xfFffFFFF43e0d9b84010b1b67bA501bc81e33C7A](https://moonscan.io/token/0xfFffFFFF43e0d9b84010b1b67bA501bc81e33C7A){target=\_blank} |
| Polkadot Asset Hub | xcPINK | [0xfFfFFfFf30478fAFBE935e466da114E14fB3563d](https://moonscan.io/token/0xfFfFFfFf30478fAFBE935e466da114E14fB3563d){target=\_blank} |
| Polkadot Asset Hub | xcSTINK | [0xFffFffFf54c556bD1d0F64ec6c78f1B477525E56](https://moonscan.io/token/0xFffFffFf54c556bD1d0F64ec6c78f1B477525E56){target=\_blank} |
| Polkadot Asset Hub | xcUSDC | [0xFFfffffF7D2B0B761Af01Ca8e25242976ac0aD7D](https://moonscan.io/token/0xFFfffffF7D2B0B761Af01Ca8e25242976ac0aD7D){target=\_blank} |
| Polkadot Asset Hub | xcUSDT | [0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d](https://moonscan.io/token/0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d){target=\_blank} |
| Subsocial | xcSUB | [0xfFfFffFf43B4560Bc0C451a3386E082bff50aC90](https://moonscan.io/token/0xfFfFffFf43B4560Bc0C451a3386E082bff50aC90){target=\_blank} |
Expand Down
1 change: 1 addition & 0 deletions builders/json-rpc/eth-rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The basic JSON-RPC methods from the Ethereum API supported by Moonbeam are:
- **[eth_getStorageAt](https://eth.wiki/json-rpc/API#eth_getstorageat){target=\_blank}** — returns the content of the storage at a given address
- **[eth_getBlockByHash](https://eth.wiki/json-rpc/API#eth_getblockbyhash){target=\_blank}** — returns information about the block of the given hash, including `baseFeePerGas` on post-London blocks
- **[eth_getBlockByNumber](https://eth.wiki/json-rpc/API#eth_getblockbynumber){target=\_blank}** — returns information about the block specified by block number, including `baseFeePerGas` on post-London blocks
- **[eth_getBlockReceipts](https://docs.alchemy.com/reference/eth-getblockreceipts){target=\_blank}** — returns all transaction receipts for a given block
- **[eth_getTransactionCount](https://eth.wiki/json-rpc/API#eth_gettransactioncount){target=\_blank}** — returns the number of transactions sent from the given address (nonce)
- **[eth_getBlockTransactionCountByHash](https://eth.wiki/json-rpc/API#eth_getblocktransactioncountbyhash){target=\_blank}** — returns the number of transactions in a block with a given block hash
- **[eth_getBlockTransactionCountByNumber](https://eth.wiki/json-rpc/API#eth_getblocktransactioncountbynumber){target=\_blank}** — returns the number of transactions in a block with a given block number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The interface includes the following functions:
- **voteSplit**(*uint32* pollIndex, *uint256* aye, *uint256* nay) - votes a split vote, with a given amount locked for "Aye" and a given amount locked for "Nay", on a poll (referendum)
- **voteSplitAbstain**(*uint32* pollIndex, *uint256* aye, *uint256* nay) - votes a split abstained vote, with a given amount locked for "Aye", a given amount locked for "Nay", and a given amount locked for an abstain vote (support), on a poll (referendum)
- **removeVote**(*uint32* pollIndex) - [removes a vote](/builders/pallets-precompiles/pallets/conviction-voting/#extrinsics){target=\_blank} in a poll (referendum)
- **removeVoteForTrack**(*uint32* pollIndex, *uint16* trackId) - [removes a vote](/builders/pallets-precompiles/pallets/conviction-voting/#extrinsics){target=\_blank} from a specific track in a poll (referendum)
- **removeOtherVote**(*address* target, *uint16* trackId, *uint32* pollIndex) - [removes a vote](/builders/pallets-precompiles/pallets/conviction-voting/#extrinsics){target=\_blank} in a poll (referendum) for another voter
- **delegate**(*uint16* trackId, *address* representative, *Conviction* conviction, *uint256* amount) - delegates another account as a representative to place a Conviction-weighted vote on the behalf of the sending account for a specific Track
- **undelegate**(*uint16* trackId) - removes the caller's vote delegations for a specific Track
Expand Down
14 changes: 8 additions & 6 deletions learn/platform/networks/moonbase.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Moonbase Alpha has the following configuration:
Some important variables/configurations to note include:

=== "General"
| Variable | Value |
|:---------------------:|:-----------------------------------------------------------------------:|
| Minimum gas price | {{ networks.moonbase.min_gas_price }} Gwei |
| Target block time | {{ networks.moonbase.block_time }} seconds |
| Block gas limit | {{ networks.moonbase.gas_block }} (expected to increase by at least 4x) |
| Transaction gas limit | {{ networks.moonbase.gas_tx }} (expected to increase by at least 4x) |
| Variable | Value |
|:---------------------:|:------------------------------------------:|
| Minimum gas price | {{ networks.moonbase.min_gas_price }} Gwei |
| Target block time | {{ networks.moonbase.block_time }} seconds |
| Block gas limit | {{ networks.moonbase.gas_block }} |
| Transaction gas limit | {{ networks.moonbase.gas_tx }} |

=== "Staking"
| Variable | Value |
Expand All @@ -43,6 +43,8 @@ Some important variables/configurations to note include:
| Unbond duration | {{ networks.moonbase.delegator_timings.del_bond_less.rounds }} rounds ({{ networks.moonbase.delegator_timings.del_bond_less.hours }} hours) |

--8<-- 'text/_common/async-backing-moonbase.md'

Additionally, as of runtime 2900, the block and transaction gas limits increased by 4x on Moonbase Alpha.

--8<-- 'text/builders/get-started/networks/moonbase/connect.md'

Expand Down
10 changes: 5 additions & 5 deletions variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ networks:
parachain_release_tag: v0.37.2 # must be in this exact format for links to work
parachain_sha256sum: 71242b8cdf2b97fba4aadb7d6050e0b46eaacafae6bcde9b5f5534aff620d144
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.37.2-2902-latest
gas_block: 15,000,000
gas_block_numbers_only: 15000000
gas_tx: 12,995,000
gas_block: 60,000,000
gas_block_numbers_only: 60000000
gas_tx: 52,000,000
mbip_5:
block_storage_limit: 40
block_storage_limit: 160
gas_storage_ratio: 366
example_storage: 500
example_addtl_gas: 183000
Expand Down Expand Up @@ -123,7 +123,7 @@ networks:
xcbetadev:
transact_numbers_only: 50000000000000000
erc20_xcm:
transfer_gas_limit: 200,000
transfer_gas_limit: 800,000
conviction:
lock_period:
conviction_1: 1
Expand Down

0 comments on commit 70e066e

Please sign in to comment.