[XCM delivery fees] Add missing SetFeesMode instruction in xtokens#1006
Conversation
|
SetFeesMode was a mistake and it will be removed in XCM v5 so I don't really want to touch it. However if it is a blocking issue for you, I am fine with this change. Can you add some tests? |
Thanks! Yes I could add some tests. Although, I don't see a good way to test this, as if we would like to test the addition of The addition of What do you think? Do you have any suggestions? Thanks in advance :) |
|
I see. Ideally, we will want another mock runtime to test the code with different config. But I can merge this as it is fully backward compatible (i.e. all existing tests passes). |
Motivation
At Moonbeam, we are on process of enabling XCM delivery fees in our runtimes. While testing this functionality through xtokens pallet, some of our tests were failing.
The reason for this is that if XCM delivery fees are enabled on the origin chain (the chain that in this case is building the message though xtokens) and the
SetFeesModeinstruction is not appended to the final message, the local XCM execution prior to send the message will fail, as the XCM executor will try to deduct the delivery fees from the holding register (usually the origin chain's native asset) and they won't be there.More context on: https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-executor/src/lib.rs#L459-L467
Similar issue on polkadot-sdk
There was also a similar problem on polkadot-sdk. In that case,
SetFeesModewas missing in some part of the code thattransfer_assetsfunction ofpallet-xcmexecutes.Related PR: paritytech/polkadot-sdk#3792