Tx Payment: drop ED requirements for tx payments with exchangeable asset (#4488)
Drop the Existential Deposit (ED) requirement for the asset amount exchangeable for the fee asset (eg. DOT/KSM) during transaction payments. This achieved by using `SwapCredit` implementation of swap, which works with imbalances and does not require a temporary balance account within the transaction payment. ### Problem Currently, every swap during transaction payment, processed with asset `A` for native asset, must be for an amount greater than the ED of a native asset if the user lacks a native asset account. Since fees are typically smaller, the current implementation necessitates additional swaps to meet the ED during `pre_dispatch`, with refunds for excess ED swap occurring during `post_dispatch`. Further details can be found [here](https://github.com/paritytech/polkadot-sdk/blob/115c2477 /substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs#L115). This setup presents an issue where a user is unable to transfer their entire balance and close the account. Instead, the user must transfer slightly less of asset `A` to ensure there is enough not only for the fee payment but also some extra to meet the ED requirement for their native account during `pre_dispatch`. In some cases during `post_dispatch`, the user will have the excess ED swapped back to asset `A`, while in other cases, it may not be sufficient to meet the ED requirement for asset `A`, leading it being left in the user's 'temporary' native asset account. --------- Co-authored-by:Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
parent
71109c5f
Showing
- cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs 12 additions, 4 deletions...us/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
- cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs 12 additions, 4 deletions...s/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
- prdoc/pr_4488.prdoc 25 additions, 0 deletionsprdoc/pr_4488.prdoc
- substrate/bin/node/runtime/src/lib.rs 11 additions, 18 deletionssubstrate/bin/node/runtime/src/lib.rs
- substrate/frame/asset-conversion/src/swap.rs 52 additions, 0 deletionssubstrate/frame/asset-conversion/src/swap.rs
- substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs 70 additions, 109 deletions...ransaction-payment/asset-conversion-tx-payment/src/lib.rs
- substrate/frame/transaction-payment/asset-conversion-tx-payment/src/mock.rs 23 additions, 4 deletions...ansaction-payment/asset-conversion-tx-payment/src/mock.rs
- substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs 182 additions, 112 deletions...action-payment/asset-conversion-tx-payment/src/payment.rs
- substrate/frame/transaction-payment/asset-conversion-tx-payment/src/tests.rs 149 additions, 22 deletions...nsaction-payment/asset-conversion-tx-payment/src/tests.rs
- substrate/frame/transaction-payment/src/lib.rs 5 additions, 0 deletionssubstrate/frame/transaction-payment/src/lib.rs
Please register or sign in to comment