[xcm] Failing to deposit dust (below minimum value) will fail the whole XCM program #4408
Labels
C1-mentor
A task where a mentor is available. Please indicate in the issue who the mentor could be.
C2-good-first-issue
A task for a first time contributor to become familiar with the Polkadot-SDK.
T6-XCM
This PR/Issue is related to XCM.
Description
The implementation of
DepositAsset
will directly abort if any asset can't be deposited. This can happen if the amount of the asset is below its minimum balance and the receiver doesn't have a balance of it yet, in that case the asset transactor will directly fail withTokenError::BelowMinimum
via the following call flow:polkadot-sdk/polkadot/xcm/xcm-executor/src/lib.rs
Line 625 in ac3773e
polkadot-sdk/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs
Line 390 in 3dece31
polkadot-sdk/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs
Line 291 in 3dece31
polkadot-sdk/substrate/frame/support/src/traits/tokens/fungibles/regular.rs
Line 264 in bdbe982
polkadot-sdk/substrate/frame/support/src/traits/tokens/fungibles/regular.rs
Line 231 in bdbe982
This is especially a problem for more complex XCMs that transfer multiple assets, which can completely fail when the leftover fee-asset amount (after paying the fees) is just dust and might not meet "min value" for depositing.
Proposed solution
Treat
TokenError::BelowMinimum
error as non-fatal in xcm-executor, effectively ignore errors of failures to deposit dust.The text was updated successfully, but these errors were encountered: