-
Notifications
You must be signed in to change notification settings - Fork 739
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
Snowbridge: deposit extra fee to beneficiary on Asset Hub #4175
Merged
serban300
merged 16 commits into
paritytech:master
from
Snowfork:deposit-fee-to-beneficiary
Apr 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8f86f35
Deposit fee to beneficiary
yrong 0a218c7
E2E tests
yrong 3fd810c
Add SetErrorHandler
yrong db52103
Revert "Add SetErrorHandler"
yrong bf3856b
Merge branch 'master' into deposit-fee-to-beneficiary
yrong 908442b
Add prdoc
yrong 54d8d4e
Merge branch 'master' into deposit-fee-to-beneficiary
yrong dee6ecc
Merge branch 'master' into deposit-fee-to-beneficiary
yrong 76755f9
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
yrong 3eed3aa
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
yrong bd36b4d
Merge branch 'master' into deposit-fee-to-beneficiary
claravanstaden 45481f9
Update prdoc/pr_4175.prdoc
yrong 3c7a66d
Update prdoc/pr_4175.prdoc
yrong 3c1ac1a
Merge branch 'master' into deposit-fee-to-beneficiary
yrong a194ca5
Merge branch 'master' into deposit-fee-to-beneficiary
yrong b79bc16
Merge branch 'master' into deposit-fee-to-beneficiary
yrong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe whole XCM fails if the beneficiary account does not exist and the leftover fees do not satisfy ED... :(
Maybe add an
SetErrorHandler
and fall back to deposit just the assets if the wildcard one fails.I recommend building a test or more to validate both happy and corner cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review it.
Currently WETH or any foreign asset from Ethereum is created as
non_sufficient
, so the fall back won't help in this case.As mentioned in Snowfork#137 (comment), we'll ensure this won't happen.
Sure, I'll do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid using
DepositAsset(Wild(All))
because it can be quite expensive, e.g on the AssetHub here: https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs#L33-L51. It's better to use eitherWild(AllOfCounted(2))
to deposit both the asset and fees, or to useDefinite([asset, fees])
.We encountered a very similar issue raised by the security audit team here: #3157, and there was also a recommendation to use
SetAppendix
to avoid potential trapping.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👆 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More tests added in
0a218c7
@bkontur I'm not sure
SetAppendix
will help in this case, theDepositAsset
is the last instruction of the xcm and if any of the preceding instructions fails, we do want the xcm fail as a whole.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you put something in the holding register (e.g.
WithdrawAsset
...) and another instruction fails, then the assets are trapped. But if you useSetAppendix(DepositAssets
and place it before the failing instruction, then assets won't be trapped in the case of error, but instead Deposited to some account, so no asset trapping.But it depends case-by-case, I'm not saying that you need to use it, I am just saying that there is this possibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder. I'll let our team to double check though I do think
DepositAsset
should be the last instruction here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkontur Confirmed that we don't need the
SetAppendix
. We'll just leave the asset trapped when error happens.