From 82c51d643b9d9ad2bdae2110f46b1419d4b0d7b9 Mon Sep 17 00:00:00 2001 From: Erin Shaben Date: Wed, 15 Nov 2023 21:19:44 -0500 Subject: [PATCH] update kusama fees to v1.0.0 and rollback polkadot links to v0.9.43 --- builders/interoperability/xcm/fees.md | 42 +++++++++++++-------------- variables.yml | 38 ++++++++++++------------ 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/builders/interoperability/xcm/fees.md b/builders/interoperability/xcm/fees.md index ff6099417..29992aac2 100644 --- a/builders/interoperability/xcm/fees.md +++ b/builders/interoperability/xcm/fees.md @@ -53,18 +53,18 @@ There are two databases available in Polkadot and Kusama, RocksDB (which is the ### Polkadot {: #polkadot } -As previously mentioned, Polkadot currently uses a [fixed amount of weight](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/polkadot/src/xcm_config.rs#L111){target=_blank} for all XCM instructions, which is `{{ networks.polkadot.xcm_instructions.weight.display }}` weight units per instruction. +As previously mentioned, Polkadot currently uses a [fixed amount of weight](https://github.com/paritytech/polkadot/blob/{{networks.polkadot.spec_version}}/runtime/polkadot/src/xcm_config.rs#L111){target=_blank} for all XCM instructions, which is `{{ networks.polkadot.xcm_instructions.weight.display }}` weight units per instruction. Although Polkadot doesn't currently use database weight units to calculate costs, the weight units for database operations, which have been benchmarked, are shared here for reference. | Database | Read | Write | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------:|:----------------------------------------------:| -| [RocksDB (default)](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/polkadot/constants/src/weights/rocksdb_weights.rs){target=_blank} | {{ networks.polkadot.rocks_db.read_weight }} | {{ networks.polkadot.rocks_db.write_weight }} | -| [ParityDB](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/polkadot/constants/src/weights/paritydb_weights.rs){target=_blank} | {{ networks.polkadot.parity_db.read_weight }} | {{ networks.polkadot.parity_db.write_weight }} | +| [RocksDB (default)](https://github.com/paritytech/polkadot/blob/{{networks.polkadot.spec_version}}/runtime/polkadot/constants/src/weights/rocksdb_weights.rs){target=_blank} | {{ networks.polkadot.rocks_db.read_weight }} | {{ networks.polkadot.rocks_db.write_weight }} | +| [ParityDB](https://github.com/paritytech/polkadot/blob/{{networks.polkadot.spec_version}}/runtime/polkadot/constants/src/weights/paritydb_weights.rs){target=_blank} | {{ networks.polkadot.parity_db.read_weight }} | {{ networks.polkadot.parity_db.write_weight }} | With the instruction weight cost established, you can calculate the cost of each instruction in DOT. -In Polkadot, the [`ExtrinsicBaseWeight`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/polkadot/constants/src/weights/extrinsic_weights.rs#L56){target=_blank} is set to `{{ networks.polkadot.extrinsic_base_weight.display }}` which is [mapped to 1/10th](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/polkadot/constants/src/lib.rs#L89){targer=blank} of a cent. Where 1 cent is `10^10 / 100`. +In Polkadot, the [`ExtrinsicBaseWeight`](https://github.com/paritytech/polkadot/blob/{{networks.polkadot.spec_version}}/runtime/polkadot/constants/src/weights/extrinsic_weights.rs#L56){target=_blank} is set to `{{ networks.polkadot.extrinsic_base_weight.display }}` which is [mapped to 1/10th](https://github.com/paritytech/polkadot/blob/{{networks.polkadot.spec_version}}/runtime/polkadot/constants/src/lib.rs#L89){targer=blank} of a cent. Where 1 cent is `10^10 / 100`. Therefore, to calculate the cost of executing an XCM instruction, you can use the following formula: @@ -114,26 +114,26 @@ As an example, you can calculate the total cost of DOT for sending an XCM messag The total weight costs on Kusama take into consideration database reads and writes in addition to the weight required for a given instruction. Database read and write operations have not been benchmarked, while instruction weights have been. The breakdown of weight costs for the database operations is as follows: -| Database | Read | Write | -|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------:|:---------------------------------------------------:| -| [RocksDB (default)](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/constants/src/weights/rocksdb_weights.rs){target=_blank} | {{ networks.kusama.rocks_db.read_weight.display }} | {{ networks.kusama.rocks_db.write_weight.display }} | -| [ParityDB](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/constants/src/weights/paritydb_weights.rs){target=_blank} | {{ networks.kusama.parity_db.read_weight }} | {{ networks.kusama.parity_db.write_weight }} | +| Database | Read | Write | +|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------:|:---------------------------------------------------:| +| [RocksDB (default)](https://github.com/polkadot-fellows/runtimes/blob/{{ networks.kusama.spec_version }}/relay/kusama/constants/src/weights/rocksdb_weights.rs){target=_blank} | {{ networks.kusama.rocks_db.read_weight.display }} | {{ networks.kusama.rocks_db.write_weight.display }} | +| [ParityDB](https://github.com/polkadot-fellows/runtimes/blob/{{ networks.kusama.spec_version }}/relay/kusama/constants/src/weights/paritydb_weights.rs){target=_blank} | {{ networks.kusama.parity_db.read_weight }} | {{ networks.kusama.parity_db.write_weight }} | Now that you are aware of the weight costs for database reads and writes on Kusama, you can calculate the weight cost for a given instruction using the base weight for an instruction. -For example, the [`WithdrawAsset` instruction](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L49-L53){target=_blank} has a base weight of `{{ networks.kusama.xcm_instructions.withdraw.base_weight.display }}`, and performs one database read, and one database write. Therefore, the total weight cost of the `WithdrawAsset` instruction is calculated as: +For example, the [`WithdrawAsset` instruction](https://github.com/polkadot-fellows/runtimes/blob/{{ networks.kusama.spec_version }}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L54-L62){target=_blank} has a base weight of `{{ networks.kusama.xcm_instructions.withdraw.base_weight.display }}`, and performs one database read and one database write. Therefore, the total weight cost of the `WithdrawAsset` instruction is calculated as: ```text {{ networks.kusama.xcm_instructions.withdraw.base_weight.numbers_only }} + {{ networks.kusama.rocks_db.read_weight.numbers_only }} + {{ networks.kusama.rocks_db.write_weight.numbers_only }} = {{ networks.kusama.xcm_instructions.withdraw.total_weight.numbers_only }} ``` -The [`BuyExecution` instruction](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L76){target=_blank} has a base weight of `{{ networks.kusama.xcm_instructions.buy_exec.base_weight }}` and doesn't include any database reads or writes. Therefore, the total weight cost of the `BuyExecution` instruction is `{{ networks.kusama.xcm_instructions.buy_exec.total_weight }}`. +The [`BuyExecution` instruction](https://github.com/polkadot-fellows/runtimes/blob/{{networks.kusama.spec_version}}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L76-L82){target=_blank} has a base weight of `{{ networks.kusama.xcm_instructions.buy_exec.base_weight }}` and doesn't include any database reads or writes. Therefore, the total weight cost of the `BuyExecution` instruction is `{{ networks.kusama.xcm_instructions.buy_exec.total_weight }}`. -On Kusama, the benchmarked base weights are broken up into two categories: fungible and generic. Fungible weights are for XCM instructions that involve moving assets, and generic weights are for everything else. You can view the current weights for [fungible assets](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L49){target=_blank} and [generic assets](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L50){target=_blank} directly in the Kusama Runtime code. +On Kusama, the benchmarked base weights are broken up into two categories: fungible and generic. Fungible weights are for XCM instructions that involve moving assets, and generic weights are for everything else. You can view the current weights for [fungible assets](https://github.com/polkadot-fellows/runtimes/blob/{{ networks.kusama.spec_version }}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L49){target=_blank} and [generic assets](https://github.com/polkadot-fellows/runtimes/blob/{{networks.kusama.spec_version}}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L50){target=_blank} directly in the Kusama Runtime code. With the instruction weight cost established, you can calculate the cost of the instruction in KSM. -In Kusama, the [`ExtrinsicBaseWeight`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/constants/src/weights/extrinsic_weights.rs#L56){target=_blank} is set to `{{ networks.kusama.extrinsic_base_weight.display }}` which is [mapped to 1/10th](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/constants/src/lib.rs#L87){target=_blank} of a cent. Where 1 cent is `10^12 / 30,000`. +In Kusama, the [`ExtrinsicBaseWeight`](https://github.com/polkadot-fellows/runtimes/blob/{{networks.polkadot.spec_version}}/relay/kusama/constants/src/weights/extrinsic_weights.rs#L56){target=_blank} is set to `{{ networks.kusama.extrinsic_base_weight.display }}` which is [mapped to 1/10th](https://github.com/polkadot-fellows/runtimes/blob/{{networks.kusama.spec_version}}/relay/kusama/constants/src/lib.rs#L87){target=_blank} of a cent. Where 1 cent is `10^12 / 30,000`. Therefore, to calculate the cost of executing an XCM instruction, you can use the following formula: @@ -171,13 +171,13 @@ The total cost for that particular instruction is `{{ networks.kusama.xcm_instru As an example, you can calculate the total cost of KSM for sending an XCM message that transfers xcKSM to KSM on Kusama using the following weights and instruction costs: -| Instruction | Weight | Cost | -|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------:|:-----------------------------------------------------------------:| -| [`WithdrawAsset`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L54){target=_blank} | {{ networks.kusama.xcm_instructions.withdraw.total_weight.display }} | {{ networks.kusama.xcm_instructions.withdraw.ksm_cost }} KSM | -| [`ClearOrigin`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L135){target=_blank} | {{ networks.kusama.xcm_instructions.clear_origin.total_weight }} | {{ networks.kusama.xcm_instructions.clear_origin.ksm_cost }} KSM | -| [`BuyExecution`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L76){target=_blank} | {{ networks.kusama.xcm_instructions.buy_exec.total_weight }} | {{ networks.kusama.xcm_instructions.buy_exec.ksm_cost }} KSM | -| [`DepositAsset`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L132){target=_blank} | {{ networks.kusama.xcm_instructions.deposit_asset.total_weight }} | {{ networks.kusama.xcm_instructions.deposit_asset.ksm_cost }} KSM | -| **TOTAL** | **{{ networks.kusama.xcm_message.transfer.weight }}** | **{{ networks.kusama.xcm_message.transfer.cost }} KSM** | +| Instruction | Weight | Cost | +|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------:|:-----------------------------------------------------------------:| +| [`WithdrawAsset`](https://github.com/polkadot-fellows/runtimes/blob/{{ networks.kusama.spec_version }}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L54-L62){target=_blank} | {{ networks.kusama.xcm_instructions.withdraw.total_weight.display }} | {{ networks.kusama.xcm_instructions.withdraw.ksm_cost }} KSM | +| [`ClearOrigin`](https://github.com/polkadot-fellows/runtimes/blob/{{networks.kusama.spec_version}}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L135-L141){target=_blank} | {{ networks.kusama.xcm_instructions.clear_origin.total_weight }} | {{ networks.kusama.xcm_instructions.clear_origin.ksm_cost }} KSM | +| [`BuyExecution`](https://github.com/polkadot-fellows/runtimes/blob/{{networks.kusama.spec_version}}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L76-L82){target=_blank} | {{ networks.kusama.xcm_instructions.buy_exec.total_weight }} | {{ networks.kusama.xcm_instructions.buy_exec.ksm_cost }} KSM | +| [`DepositAsset`](https://github.com/polkadot-fellows/runtimes/blob/{{ networks.kusama.spec_version }}/relay/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L132-L140){target=_blank} | {{ networks.kusama.xcm_instructions.deposit_asset.total_weight }} | {{ networks.kusama.xcm_instructions.deposit_asset.ksm_cost }} KSM | +| **TOTAL** | **{{ networks.kusama.xcm_message.transfer.weight }}** | **{{ networks.kusama.xcm_message.transfer.cost }} KSM** | ## Moonbeam-based Networks XCM Fee Calculation {: #moonbeam-xcm-fee-calc } @@ -185,8 +185,8 @@ 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/master/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. diff --git a/variables.yml b/variables.yml index 326af6007..29c20623d 100644 --- a/variables.yml +++ b/variables.yml @@ -1080,7 +1080,7 @@ networks: display: 107,648,000 numbers_only: 107648000 kusama: - spec_version: v0.9.43 + spec_version: v1.0.0 rocks_db: read_weight: display: 25,000,000 @@ -1093,32 +1093,32 @@ networks: write_weight: 50,000,000 xcm_message: transfer: - weight: 299,506,000 - cost: '0.000092003956' + weight: 305,952,000 + cost: '0.000081779545' xcm_instructions: buy_exec: - base_weight: 3,697,000 - total_weight: 3,697,000 - ksm_cost: '0.000001135665' + base_weight: 2,714,000 + total_weight: 2,714,000 + ksm_cost: '0.000000725440' withdraw: base_weight: - display: 20,385,000 - numbers_only: 20385000 + display: 24,720,000 + numbers_only: 24720000 total_weight: - display: 145,385,000 - numbers_only: 145385000 - planck_ksm_cost: 44660191.1923 - ksm_cost: '0.000044660191' + display: 149,720,000 + numbers_only: 149720000 + planck_ksm_cost: 40019459.1011 + ksm_cost: '0.000040019459' clear_origin: - total_weight: 3,661,000 - ksm_cost: '0.000001124607' + total_weight: 2,614,000 + ksm_cost: '0.000000698710' deposit_asset: - total_weight: 146,763,000 - ksm_cost: '0.000045083493' - planck_ksm_weight: '0.307185687604' + total_weight: 150,904,000 + ksm_cost: '0.000040335936' + planck_ksm_weight: '0.267295345319' extrinsic_base_weight: - display: 108,512,000 - numbers_only: 108512000 + display: 124,706,000 + numbers_only: 124706000 moonbase_beta: xcm_message: transact: