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 <bkontur@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Giles Cope <gilescope@gmail.com>
Co-authored-by: command-bot <>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
`PayOverXcm` type accepts two converters to transform the `AssetKind`
and `Beneficiary` parameter types into recognized `xcm` types. In this
PR, we've modified the bounds for these converters, transitioning from
`Convert` to `TryConvert`.
One such use case for this adjustment is when dealing with versioned xcm
types for `AssetKind` and `Beneficiary`. These types might be not
convertible to the latest xcm version, hence the need for fallible
conversion.
This changes required for
https://github.com/paritytech/polkadot-sdk/pull/1333
* Move XCM query functionality to trait
* Fix tests
* Add PayOverXcm implementation
* fix the PayOverXcm trait to compile
* moved doc comment out of trait implmeentation and to the trait
* PayOverXCM documentation
* Change documentation a bit
* Added empty benchmark methods implementation and changed docs
* update PayOverXCM to convert AccountIds to MultiLocations
* Implement benchmarking method
* Change v3 to latest
* Descend origin to an asset sender (#6970)
* descend origin to an asset sender
* sender as tuple of dest and sender
* Add more variants to the QueryResponseStatus enum
* Change Beneficiary to Into<[u8; 32]>
* update PayOverXcm to return concrete errors and use AccountId as sender
* use polkadot-primitives for AccountId
* fix dependency to use polkadot-core-primitives
* force Unpaid instruction to the top of the instructions list
* modify report_outcome to accept interior argument
* use new_query directly for building final xcm query, instead of report_outcome
* fix usage of new_query to use the XcmQueryHandler
* fix usage of new_query to use the XcmQueryHandler
* tiny method calling fix
* xcm query handler (#7198)
* drop redundant query status
* rename ReportQueryStatus to OuterQueryStatus
* revert rename of QueryResponseStatus
* update mapping
* Update xcm/xcm-builder/src/pay.rs
Co-authored-by: Gavin Wood <gavin@parity.io>
* Updates
* Docs
* Fix benchmarking stuff
* Destination can be determined based on asset_kind
* Tweaking API to minimise clones
* Some repotting and docs
---------
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
Co-authored-by: Anthony Alaribe <anthony.alaribe@parity.io>
Co-authored-by: Gavin Wood <gavin@parity.io>