forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tx Payment: drop ED requirements for tx payments with exchangeable as…
…set (paritytech#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/115c2477eb287df55107cd95594100ba395ed239/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 <[email protected]>
- Loading branch information
Showing
10 changed files
with
541 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
title: "Tx Payment: drop ED requirements for tx payments with exchangeable asset" | ||
|
||
doc: | ||
- audience: Runtime Dev | ||
description: | | ||
Drop the Existential Deposit requirement for the asset amount exchangeable for the fee asset | ||
(eg. DOT/KSM) during transaction payments. | ||
|
||
This achieved by using `SwapCredit` implementation of asset conversion, which works with | ||
imbalances and does not require a temporary balance account within the transaction payment. | ||
|
||
This is a breaking change for the `pallet-asset-conversion-tx-payment` pallet, use examples | ||
from PR for the migration. | ||
|
||
crates: | ||
- name: pallet-asset-conversion-tx-payment | ||
bump: major | ||
- name: pallet-transaction-payment | ||
bump: patch | ||
- name: pallet-asset-conversion | ||
bump: patch | ||
- name: asset-hub-rococo-runtime | ||
bump: patch | ||
- name: asset-hub-westend-runtime | ||
bump: patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.