Skip to content
Snippets Groups Projects
Francisco Aguirre's avatar
Francisco Aguirre authored
# Context

Fees can already be paid in other assets locally thanks to the Trader
implementations we have.
This doesn't work when sending messages because delivery fees go through
a different mechanism altogether.
The idea is to fix this leveraging the `AssetExchanger` config item
that's able to turn the asset the user wants to pay fees in into the
asset the router expects for delivery fees.

# Main addition

An adapter was needed to use `pallet-asset-conversion` for exchanging
assets in XCM.
This was created in
https://github.com/paritytech/polkadot-sdk/pull/5130.

The XCM executor was modified to use `AssetExchanger` (when available)
to swap assets to pay for delivery fees.

## Limitations

We can only pay for delivery fees in different assets in intermediate
hops. We can't pay in different assets locally. The first hop will
always need the native token of the chain (or whatever is specified in
the `XcmRouter`).
This is a byproduct of using the `BuyExecution` instruction to know
which asset should be used for delivery fee payment.
Since this instruction is not present when executing an XCM locally, we
are left with this limitation.
To illustrate this limitation, I'll show two scenarios. All chains
involved have pools.

### Scenario 1

Parachain A --> Parachain B

Here, parachain A can use any asset in a pool with its native asset to
pay for local execution fees.
However, as of now we can't use those for local delivery fees.
This means transfers from A to B need some amount of A's native token to
pay for delivery fees.

### Scenario 2

Parachain A --> Parachain C --> Parachain B

Here, Parachain C's remote delivery fees can be paid with any asset in a
pool with its native asset.
This allows a reserve asset transfer between A and B with C as the
reserve to only need A's native token at the starting hop.
After that, it could all be pool assets.

## Future work

The fact that delivery fees go through a totally different mechanism
results in a lot of bugs and pain points.
Unfortunately, this is not so easy to solve in a backwards compatible
manner.
Delivery fees will be integrated into the language in future XCM
versions, following
https://github.com/polkadot-fellows/xcm-format/pull/53.

Old PR: https://github.com/paritytech/polkadot-sdk/pull/4375.
5291412e
Name Last commit Last update
..
1.10.0
1.11.0
1.12.0
1.13.0
1.14.0
1.15.0
1.15.1
1.3.0
1.4.0
1.5.0
1.6.0
1.7.0
1.8.0
1.9.0
.gitkeep
.template.prdoc
pr_2923.prdoc
pr_3786.prdoc
pr_3996.prdoc
pr_4129.prdoc
pr_4424.prdoc
pr_4460.prdoc
pr_4487.prdoc
pr_4488.prdoc
pr_4527.prdoc
pr_4564.prdoc
pr_4586.prdoc
pr_4613.prdoc
pr_4640.prdoc
pr_4665.prdoc
pr_4706.prdoc
pr_4739.prdoc
pr_4751.prdoc
pr_4792.prdoc
pr_4822.prdoc
pr_4845.prdoc
pr_4928.prdoc
pr_4930.prdoc
pr_4936.prdoc
pr_4938.prdoc
pr_4956.prdoc
pr_4959.prdoc
pr_4962.prdoc
pr_4963.prdoc
pr_4967.prdoc
pr_4970.prdoc
pr_4973.prdoc
pr_4976.prdoc
pr_4993.prdoc
pr_4998.prdoc
pr_4999.prdoc
pr_5029.prdoc
pr_5036.prdoc
pr_5055.prdoc
pr_5065.prdoc
pr_5067.prdoc
pr_5074.prdoc
pr_5078.prdoc
pr_5082.prdoc
pr_5113.prdoc
pr_5114.prdoc
pr_5124.prdoc
pr_5129.prdoc
pr_5130.prdoc
pr_5131.prdoc
pr_5132.prdoc
pr_5142.prdoc
pr_5155.prdoc
pr_5173.prdoc
pr_5174.prdoc
pr_5188.prdoc
pr_5195.prdoc
pr_5196.prdoc
pr_5197.prdoc
pr_5204.prdoc
pr_5205.prdoc
pr_5214.prdoc
pr_5240.prdoc
pr_5250.prdoc
pr_5252.prdoc
pr_5257.prdoc
pr_5262.prdoc
pr_5269.prdoc
pr_5270.prdoc
pr_5284.prdoc
pr_5288.prdoc
pr_5293.prdoc
pr_5316.prdoc
pr_5326.prdoc
pr_5339.prdoc
pr_5344.prdoc
pr_5348.prdoc
pr_5352.prdoc
pr_5354.prdoc
pr_5356.prdoc
pr_5359.prdoc
pr_5360.prdoc
pr_5369.prdoc
pr_5376.prdoc
pr_5380.prdoc
pr_5384.prdoc
pr_5392.prdoc
pr_5393.prdoc
pr_5396.prdoc
pr_5407.prdoc
pr_5410.prdoc
pr_5411.prdoc
pr_5424.prdoc
pr_5430.prdoc
pr_5431.prdoc
pr_5436.prdoc
pr_5439.prdoc
pr_5442.prdoc
pr_5443.prdoc
pr_5450.prdoc
pr_5465.prdoc
pr_5466.prdoc
pr_5467.prdoc
pr_5513.prdoc
schema_user.json