Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcm-executor: allow deposit of multiple assets if at least one of them satisfies ED #4460

Merged

Conversation

jpserrat
Copy link
Contributor

@jpserrat jpserrat commented May 14, 2024

Closes #4242

XCM programs that deposit assets to some new (empty) account will now succeed if at least one of the deposited assets satisfies ED. Before this change, the requirement was that the first asset had to satisfy ED, but assets order can be changed during reanchoring so it is not reliable.

With this PR, ordering doesn't matter, any one(s) of them can satisfy ED for the whole deposit to work.

Kusama address: FkB6QEo8VnV3oifugNj5NeVG3Mvq1zFbrUu4P5YwRoe5mQN

Copy link
Contributor

@acatangiu acatangiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the approach looks good, only have implementation details comments

also, you should move this to a helper function because it needs to happen for DepositReserveAsset instruction as well as DepositAsset (it too uses does Config::AssetTransactor::deposit_asset)

polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
@jpserrat jpserrat marked this pull request as ready for review June 9, 2024 18:54
@jpserrat jpserrat requested a review from a team as a code owner June 9, 2024 18:54
@jpserrat
Copy link
Contributor Author

jpserrat commented Jun 9, 2024

@acatangiu Sorry for the long delay with this one. One last thing, I'm not sure how to do the tests for this one. What do you guys usually do with the xcm executor test?

Copy link
Contributor

@acatangiu acatangiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional changes look good! 👍

Regarding tests:

I was looking at xcm-executor unit tests, but unfortunately test-runtime only has pallet_balances so it doesn't support multiple asset types (so we can properly test this PR).

So I think it's best to add an actual Asset Hub regression test (testing the actual runtime, not just a mock). An example scenario that fails without the fix, and should work with it:
Initiate transfer from Penpal to Rococo Asset Hub, to a new beneficiary account on AH, transferring:

  • XCMTEST token ({ parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(6)) }) - this is not sufficient on AssetHub
    and
  • rTether USD token ({ parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) }) - this is sufficient on AssetHub

A somewhat similar test can be seen here: https://github.com/acatangiu/polkadot-sdk/blob/796890979e5d7d16a522c304376d78eec120f3cb/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/reserve_transfer.rs#L945

I am aware that these emulated tests require low level knowledge of the system, and are complex and hard to set up, so I am also happy to write it myself and push to your branch if you can't figure it out :)

polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
@acatangiu acatangiu changed the title check if at least one of the transactions satisfy existential deposit xcm-executor: allow deposit of multiple assets if at least one of them satisfies ED Jun 17, 2024
@acatangiu
Copy link
Contributor

@jpserrat is it ok if we take over and take this over the finish line? or do you want to do it yourself?

Either way, please add your Polkadot address to the PR description so we can propose a tip for the work done so far.

@jpserrat
Copy link
Contributor Author

Hi @acatangiu sorry for the long delay with this one, I did the fixes that you requested, I'm only missing the tests. Can you do this part?

@acatangiu
Copy link
Contributor

Hi @acatangiu sorry for the long delay with this one, I did the fixes that you requested, I'm only missing the tests. Can you do this part?

Sure. Can you check what happened with the latest push you did? it messed up the PR, it's showing a million changes now.

@jpserrat jpserrat force-pushed the jpserrat/depositing-multiple-assets branch from 4bc901a to 1d26287 Compare July 18, 2024 10:25
@jpserrat
Copy link
Contributor Author

Fixed!

polkadot/xcm/xcm-executor/src/lib.rs Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Show resolved Hide resolved
polkadot/xcm/xcm-executor/src/lib.rs Outdated Show resolved Hide resolved
@acatangiu
Copy link
Contributor

bot clean

@command-bot command-bot bot deleted a comment from github-actions bot Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

We are migrating the command bot to be a GitHub Action

Please, see the documentation on how to use it

@command-bot command-bot bot deleted a comment from github-actions bot Aug 9, 2024
@command-bot command-bot bot deleted a comment from github-actions bot Aug 9, 2024
@command-bot command-bot bot deleted a comment from github-actions bot Aug 9, 2024
@command-bot command-bot bot deleted a comment from github-actions bot Aug 9, 2024
@command-bot command-bot bot deleted a comment from github-actions bot Aug 9, 2024
@command-bot command-bot bot deleted a comment from github-actions bot Aug 9, 2024
@paritytech paritytech deleted a comment from paritytech-cicd-pr Aug 9, 2024
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 3/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6955504

@franciscoaguirre franciscoaguirre added this pull request to the merge queue Aug 12, 2024
Merged via the queue into paritytech:master with commit ebcbca3 Aug 12, 2024
168 of 173 checks passed
@kianenigma
Copy link
Contributor

/tip small

Copy link

@kianenigma A referendum for a small (4 KSM) tip was successfully submitted for @jpserrat (FkB6QEo8VnV3oifugNj5NeVG3Mvq1zFbrUu4P5YwRoe5mQN on kusama).

Referendum number: 440.
tip

Copy link

The referendum has appeared on Polkassembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[xcm] depositing multiple assets to inexistent account should work if at least one of them satisfies ED
6 participants