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

snowbridge: improve destination fee handling to avoid trapping fees dust #5563

Merged
merged 15 commits into from
Sep 24, 2024

Conversation

acatangiu
Copy link
Contributor

On messages Ethereum -> Polkadot Asset Hub: whether they are a token transfer or a Transact for registering new token, make sure to handle unspent fees, rather than trapping them.

This PR deposits them to Snowbridge's sovereign account on Asset Hub.

@acatangiu acatangiu added the T15-bridges This PR/Issue is related to bridges. label Sep 3, 2024
@acatangiu acatangiu self-assigned this Sep 3, 2024
@acatangiu
Copy link
Contributor Author

cc @vgeddes, @alistair-singh, @claravanstaden, @yrong

@acatangiu acatangiu requested review from a team September 3, 2024 12:06
@acatangiu acatangiu force-pushed the snowbridge-return-surplus-fees branch from 02e3ee6 to 2ea8842 Compare September 3, 2024 12:11
@paritytech-cicd-pr
Copy link

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

@yrong
Copy link
Contributor

yrong commented Sep 4, 2024

In #4175 we only cover the trapping on AH, thanks for the fix.

Btw:

cargo test -p bridge-hub-rococo-integration-tests --lib tests::snowbridge::send_token_from_ethereum_to_penpal  -- --nocapture

failed with the error

2024-09-04T05:57:38.016390Z TRACE xcm::execute: Message executed result=Err(ExecutorError { index: 3, xcm_error: FailedToTransactAsset("Account cannot exist with the funds that would be given"), weight: Weight { ref_time: 1000000000, proof_size: 65536 } })

I think we may need to increase the destination_fee on penpal or a lower ED here could also work.

@acatangiu
Copy link
Contributor Author

I think we may need to increase the destination_fee on penpal

Yes, and once this change is deployed you also need to check this in UIs in production, to avoid failures for users.

Check that beneficiary on final dest either:

  • has existing account satisfying ED,
  • current transfer adds enough destination_fee to also cover ED.

cc @alistair-singh

Copy link
Contributor

@vgeddes vgeddes left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for the improvement.

@paritytech paritytech deleted a comment from command-bot bot Sep 13, 2024
@paritytech paritytech deleted a comment from command-bot bot Sep 13, 2024
@acatangiu acatangiu added the A4-needs-backport Pull request must be backported to all maintained releases. label Sep 13, 2024
Copy link
Contributor

@franciscoaguirre franciscoaguirre left a comment

Choose a reason for hiding this comment

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

Left some comments but they're not that big. Overall looks good

@@ -340,17 +345,24 @@ impl<
match dest_para_id {
Some(dest_para_id) => {
let dest_para_fee_asset: Asset = (Location::parent(), dest_para_fee).into();
let bridge_location = Location::new(2, GlobalConsensus(network));
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it is just a hypothetical problem if dest_para_fee and/or asset do not cover the ED on BH. Do we need to prefund this SA?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this has already been prefunded on live chains and is guaranteed to exist (satisfy ED)

@acatangiu acatangiu added this pull request to the merge queue Sep 24, 2024
Merged via the queue into paritytech:master with commit 62534e5 Sep 24, 2024
209 of 211 checks passed
@acatangiu acatangiu deleted the snowbridge-return-surplus-fees branch September 24, 2024 12:45
@paritytech-cmd-bot-polkadot-sdk

Created backport PR for stable2407:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-5563-to-stable2407
git worktree add --checkout .worktree/backport-5563-to-stable2407 backport-5563-to-stable2407
cd .worktree/backport-5563-to-stable2407
git reset --hard HEAD^
git cherry-pick -x 62534e53eaeabe021de6fbe9ad51fa0e160a56c5
git push --force-with-lease

github-actions bot pushed a commit that referenced this pull request Sep 24, 2024
…ust (#5563)

On messages Ethereum -> Polkadot Asset Hub: whether they are a token
transfer or a `Transact` for registering new token, make sure to handle
unspent fees, rather than trapping them.

This PR deposits them to Snowbridge's sovereign account on Asset Hub.

---------

Co-authored-by: command-bot <>
(cherry picked from commit 62534e5)
@paritytech-cmd-bot-polkadot-sdk

Successfully created backport PR for stable2409:

acatangiu added a commit that referenced this pull request Sep 24, 2024
Backport #5563 into `stable2409` from acatangiu.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

Co-authored-by: Adrian Catangiu <adrian@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A4-needs-backport Pull request must be backported to all maintained releases. T15-bridges This PR/Issue is related to bridges.
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants