Skip to content

Commit 40e426c

Browse files
KiChjangbkonturjoepetrowskigilescopefranciscoaguirre
authored andcommitted
Introduce XcmFeesToAccount fee manager (#1234)
Combination of paritytech/polkadot#7005, its addon PR paritytech/polkadot#7585 and its companion paritytech/cumulus#2433. This PR introduces a new XcmFeesToAccount struct which implements the `FeeManager` trait, and assigns this struct as the `FeeManager` in the XCM config for all runtimes. The struct simply deposits all fees handled by the XCM executor to a specified account. In all runtimes, the specified account is configured as the treasury account. XCM __delivery__ fees are now being introduced (unless the root origin is sending a message to a system parachain on behalf of the originating chain). # Note for reviewers Most file changes are tests that had to be modified to account for the new fees. Main changes are in: - cumulus/pallets/xcmp-queue/src/lib.rs <- To make it track the delivery fees exponential factor - polkadot/xcm/xcm-builder/src/fee_handling.rs <- Added. Has the FeeManager implementation - All runtime xcm_config files <- To add the FeeManager to the XCM configuration # Important note After this change, instructions that create and send a new XCM (Query*, Report*, ExportMessage, InitiateReserveWithdraw, InitiateTeleport, DepositReserveAsset, TransferReserveAsset, LockAsset and RequestUnlock) will require the corresponding origin account in the origin register to pay for transport delivery fees, and the onward message will fail to be sent if the origin account does not have the required amount. This delivery fee is on top of what we already collect as tx fees in pallet-xcm and XCM BuyExecution fees! Wallet UIs that want to expose the new delivery fee can do so using the formula: ``` delivery_fee_factor * (base_fee + encoded_msg_len * per_byte_fee) ``` where the delivery fee factor can be obtained from the corresponding pallet based on which transport you are using (UMP, HRMP or bridges), the base fee is a constant, the encoded message length from the message itself and the per byte fee is the same as the configured per byte fee for txs (i.e. `TransactionByteFee`). --------- Co-authored-by: Branislav Kontur <[email protected]> Co-authored-by: joe petrowski <[email protected]> Co-authored-by: Giles Cope <[email protected]> Co-authored-by: command-bot <> Co-authored-by: Francisco Aguirre <[email protected]> Co-authored-by: Liam Aharon <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
1 parent 3a1d70f commit 40e426c

File tree

99 files changed

+2229
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2229
-468
lines changed

Cargo.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cumulus/pallets/parachain-system/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ sp-version = { path = "../../../substrate/primitives/version", default-features
2929

3030
# Polkadot
3131
polkadot-parachain-primitives = { path = "../../../polkadot/parachain", default-features = false, features = [ "wasm-api" ]}
32+
polkadot-runtime-parachains = { path = "../../../polkadot/runtime/parachains", default-features = false }
3233
xcm = { package = "staging-xcm", path = "../../../polkadot/xcm", default-features = false}
3334

3435
# Cumulus
@@ -63,6 +64,7 @@ std = [
6364
"frame-system/std",
6465
"log/std",
6566
"polkadot-parachain-primitives/std",
67+
"polkadot-runtime-parachains/std",
6668
"scale-info/std",
6769
"sp-core/std",
6870
"sp-externalities/std",
@@ -80,12 +82,14 @@ runtime-benchmarks = [
8082
"frame-support/runtime-benchmarks",
8183
"frame-system/runtime-benchmarks",
8284
"polkadot-parachain-primitives/runtime-benchmarks",
85+
"polkadot-runtime-parachains/runtime-benchmarks",
8386
"sp-runtime/runtime-benchmarks",
8487
]
8588

8689
try-runtime = [
8790
"frame-support/try-runtime",
8891
"frame-system/try-runtime",
92+
"polkadot-runtime-parachains/try-runtime",
8993
"sp-runtime/try-runtime",
9094
]
9195

0 commit comments

Comments
 (0)