Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump client to v0.34.1 and spec version to 2601 #811

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions builders/interoperability/xcm/fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ Substrate has introduced a weight system that determines how heavy or, in other

For all Moonbeam-based networks, the generic XCM instructions are benchmarked, while the fungible XCM instructions still use a fixed amount of weight per instruction. Consequently, the total weight cost of the benchmarked XCM instructions considers the number of database reads/writes in addition to the weight required for a given instruction. The breakdown of weight cost for the database operations is as follows:

| Database | Read | Write |
|:---------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------:|:------------------------------------------:|
| Database | Read | Write |
|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------:|:------------------------------------------:|
| [RocksDB (default)](https://github.com/paritytech/polkadot-sdk/blob/{{polkadot_sdk}}/substrate/frame/support/src/weights/rocksdb_weights.rs#L27-L28){target=_blank} | {{ xcm.db_weights.rocksdb_read.display }} | {{ xcm.db_weights.rocksdb_write.display }} |

Now that you know the weight costs for database reads and writes for Moonbase Alpha, you can calculate the weight cost for both fungible and generic XCM instruction using the base weight for instruction and the extra database read/writes if applicable.

For example, the `WithdrawAsset` instruction is part of the fungible XCM instructions set. Therefore, it is not benchmarked, and the total weight cost of the [`WithdrawAsset` instruction](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/fungible.rs#L38){target=_blank} is `{{ xcm.fungible_weights.display }}`, except for when transferring local XC-20s. The total weight cost for the `WithdrawAsset` instruction for local XC-20s is based on a conversion of Ethereum gas to Substrate weight.

The [`BuyExecution` instruction](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/generic.rs#L128){target=_blank} has a base weight of `{{ xcm.generic_weights.buy_exec.base_weight.display }}`, and performs four database reads (`assetManager` pallet to get the `unitsPerSecond`). Therefore, the total weight cost of the `BuyExecution` instruction is calculated as follows:
The [`BuyExecution` instruction](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/generic.rs#L128-L129){target=_blank} has a base weight of `{{ xcm.generic_weights.buy_exec.base_weight.display }}`, and performs four database reads (`assetManager` pallet to get the `unitsPerSecond`). Therefore, the total weight cost of the `BuyExecution` instruction is calculated as follows:

```text
{{ xcm.generic_weights.buy_exec.base_weight.numbers_only }} + 4 * {{ xcm.db_weights.rocksdb_read.numbers_only }} = {{ xcm.generic_weights.buy_exec.total_weight.numbers_only }}
Expand All @@ -234,7 +234,7 @@ For each XCM instruction, the weight units are converted to balance units as par

| Moonbeam | Moonriver | Moonbase Alpha |
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| [{{ networks.moonbeam.xcm.instructions.wei_per_weight.display }}](https://github.com/moonbeam-foundation/moonbeam/blob/{{networks.moonbeam.spec_version}}/runtime/moonbeam/src/lib.rs#L132){target=_blank} | [{{ networks.moonriver.xcm.instructions.wei_per_weight.display }}](https://github.com/moonbeam-foundation/moonbeam/blob/{{networks.moonriver.spec_version}}/runtime/moonriver/src/lib.rs#L134){target=_blank} | [{{ networks.moonbase.xcm.instructions.wei_per_weight.display }}](https://github.com/moonbeam-foundation/moonbeam/blob/{{networks.moonbase.spec_version}}/runtime/moonbase/src/lib.rs#L140){target=_blank} |
| [{{ networks.moonbeam.xcm.instructions.wei_per_weight.display }}](https://github.com/moonbeam-foundation/moonbeam/blob/{{networks.moonbeam.spec_version}}/runtime/moonbeam/src/lib.rs#L138){target=_blank} | [{{ networks.moonriver.xcm.instructions.wei_per_weight.display }}](https://github.com/moonbeam-foundation/moonbeam/blob/{{networks.moonriver.spec_version}}/runtime/moonriver/src/lib.rs#L140){target=_blank} | [{{ networks.moonbase.xcm.instructions.wei_per_weight.display }}](https://github.com/moonbeam-foundation/moonbeam/blob/{{networks.moonbase.spec_version}}/runtime/moonbase/src/lib.rs#L143){target=_blank} |

This means that on Moonbeam, for example, the formula to calculate the cost of one XCM instruction in the reserve asset is as follows:

Expand Down Expand Up @@ -292,13 +292,13 @@ ExecutionTime = Weight / Picosecond

To determine the total weight for Alice's transfer of DOT to Moonbeam, you'll need the weight for each of the four XCM instructions required for the transfer:

| Instruction | Weight |
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------:|
| [`ReserveAssetDeposited`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/moonbeam_xcm_benchmarks_fungible.rs#L70){target=_blank} | {{ xcm.fungible_weights.display }} |
| [`ClearOrigin`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/moonbeam_xcm_benchmarks_generic.rs#L547){target=_blank} | {{ xcm.generic_weights.clear_origin.display }} |
| [`BuyExecution`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/moonbeam_xcm_benchmarks_generic.rs#L484){target=_blank} | {{ xcm.generic_weights.buy_exec.total_weight.display }} |
| [`DepositAsset`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/moonbeam_xcm_benchmarks_fungible.rs#L59){target=_blank} | {{ xcm.fungible_weights.display }} |
| **TOTAL** | {{ networks.moonbeam.xcm.transfer_dot.total_weight.display }} |
| Instruction | Weight |
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------:|
| [`ReserveAssetDeposited`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/fungible.rs#L71){target=_blank} | {{ xcm.fungible_weights.display }} |
| [`ClearOrigin`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/generic.rs#L191){target=_blank} | {{ xcm.generic_weights.clear_origin.display }} |
| [`BuyExecution`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/generic.rs#L128-129){target=_blank} | {{ xcm.generic_weights.buy_exec.total_weight.display }} |
| [`DepositAsset`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbeam.spec_version }}/pallets/moonbeam-xcm-benchmarks/src/weights/fungible.rs#L60){target=_blank} | {{ xcm.fungible_weights.display }} |
| **TOTAL** | {{ networks.moonbeam.xcm.transfer_dot.total_weight.display }} |

!!! note
For the `BuyExecution` instruction, the [units of weight for the four database reads](#moonbeam-xcm-fee-calc) is accounted for in the above table.
Expand Down
2 changes: 1 addition & 1 deletion builders/interoperability/xcm/remote-evm-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The last difference is in terms of gas limit. Ethereum uses a gas-metered system

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 would only be executable through democracy.

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#L393){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#L389){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.
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#L394){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#L390){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.

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

Expand Down
4 changes: 2 additions & 2 deletions builders/interoperability/xcm/xc20/xtokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Since you'll be interacting with the `transfer` function of the X-Tokens Pallet,
!!! note
For an `AccountId32`, `AccountIndex64`, or `AccountKey20`, you have the option of specify a `network` parameter. If you don't specify one, it will default to `None`.

4. Set the `destWeightLimit` to `Unlimited`. In JavaScript, you'll need to set `Unlimited` to `null` (as outlined in the [TypeScript interface for `XcmV3WeightLimit`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/typescript-api/src/moonbase/interfaces/augment-api-tx.ts#L5734){target=_blank}):
4. Set the `destWeightLimit` to `Unlimited`. In JavaScript, you'll need to set `Unlimited` to `null` (as outlined in the [TypeScript interface for `XcmV3WeightLimit`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/typescript-api/src/moonbase/interfaces/augment-api-tx.ts#L3045){target=_blank}):

```js
const destWeightLimit = { Unlimited: null };
Expand Down Expand Up @@ -276,7 +276,7 @@ Since you'll be interacting with the `transferMultiasset` function of the X-Toke
!!! note
For an `AccountId32`, `AccountIndex64`, or `AccountKey20`, you have the option of specify a `network` parameter. If you don't specify one, it will default to `None`.

3. Set the destination weight limit to `Unlimited`. In JavaScript, you'll need to set `Unlimited` to `null` (as outlined in the [TypeScript interface for `XcmV3WeightLimit`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/typescript-api/src/moonbase/interfaces/augment-api-tx.ts#L5734){target=_blank}):
3. Set the destination weight limit to `Unlimited`. In JavaScript, you'll need to set `Unlimited` to `null` (as outlined in the [TypeScript interface for `XcmV3WeightLimit`](https://github.com/moonbeam-foundation/moonbeam/blob/{{ networks.moonbase.spec_version }}/typescript-api/src/moonbase/interfaces/augment-api-tx.ts#L3045){target=_blank}):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nitpick but in some places we say Set the destWeightLimit to Unlimitedand in other place we spell it out as Set the destination weight limit to Unlimited. It might be good to pick one way and use consistently

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll double-check this in the XCM overhaul and apply any changes there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is already taken care of in the XCM overhaul!


```js
const destWeightLimit = { Unlimited: null };
Expand Down
28 changes: 14 additions & 14 deletions variables.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
networks:
development:
build_tag: v0.34.0
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.0-2601-latest
build_tag: v0.34.1
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.1-2602-latest
rpc_url: http://127.0.0.1:9944
wss_url: ws://127.0.0.1:9944
chain_id: 1281
Expand All @@ -15,10 +15,10 @@ networks:
hex_chain_id: '0x507'
chain_spec: alphanet
block_explorer: https://moonbase.moonscan.io/
spec_version: runtime-2500
parachain_release_tag: v0.34.0 # must be in this exact format for links to work
parachain_sha256sum: 0ded3fe4095b5848c3de7483889c17a507220435ad2e21bb9e460a3f1e3eff1c
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.0-2601-latest
spec_version: runtime-2601
parachain_release_tag: v0.34.1 # must be in this exact format for links to work
parachain_sha256sum: 490d170e2af41f27d809c37d595d04d224e3abf6bda27de5dfcd10768b59428e
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.1-2602-latest
gas_block: 15,000,000
gas_block_numbers_only: 15000000
gas_tx: 12,995,000
Expand Down Expand Up @@ -392,12 +392,12 @@ networks:
chain_id: 1285
hex_chain_id: '0x505'
node_directory: /var/lib/moonriver-data
parachain_release_tag: v0.34.0
parachain_sha256sum: 0ded3fe4095b5848c3de7483889c17a507220435ad2e21bb9e460a3f1e3eff1c
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.0-2601-latest
parachain_release_tag: v0.34.1
parachain_sha256sum: 490d170e2af41f27d809c37d595d04d224e3abf6bda27de5dfcd10768b59428e
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.1-2602-latest
chain_spec: moonriver
block_explorer: https://moonriver.moonscan.io/
spec_version: runtime-2403
spec_version: runtime-2601
binary_name: moonbeam
min_gas_price: 1.25
block_time: 12
Expand Down Expand Up @@ -735,12 +735,12 @@ networks:
chain_id: 1284
hex_chain_id: '0x504'
node_directory: /var/lib/moonbeam-data
parachain_release_tag: v0.34.0
parachain_sha256sum: 0ded3fe4095b5848c3de7483889c17a507220435ad2e21bb9e460a3f1e3eff1c
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.0-2601-latest
parachain_release_tag: v0.34.1
parachain_sha256sum: 490d170e2af41f27d809c37d595d04d224e3abf6bda27de5dfcd10768b59428e
tracing_tag: moonbeamfoundation/moonbeam-tracing:v0.34.1-2602-latest
chain_spec: moonbeam
block_explorer: https://moonscan.io
spec_version: runtime-2403
spec_version: runtime-2601
binary_name: moonbeam
min_gas_price: 125
block_time: 12
Expand Down
Loading