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

[stable2412] Backport #4834 #6812

Merged
merged 4 commits into from
Dec 11, 2024
Merged

Conversation

paritytech-cmd-bot-polkadot-sdk[bot]

Backport #4834 into stable2412 from acatangiu.

See the documentation on how to use this bot.

…#4834)

# Description

Sending XCM messages to other chains requires paying a "transport fee".
This can be paid either:
- from `origin` local account if `jit_withdraw = true`,
- taken from Holding register otherwise.

This currently works for following hops/scenarios:
1. On destination no transport fee needed (only sending costs, not
receiving),
2. Local/originating chain: just set JIT=true and fee will be paid from
signed account,
3. Intermediary hops - only if intermediary is acting as reserve between
two untrusted chains (aka only for `DepositReserveAsset` instruction) -
this was fixed in #3142

But now we're seeing more complex asset transfers that are mixing
reserve transfers with teleports depending on the involved chains.

# Example

E.g. transferring DOT between Relay and parachain, but through AH (using
AH instead of the Relay chain as parachain's DOT reserve).

In the `Parachain --1--> AssetHub --2--> Relay` scenario, DOT has to be
reserve-withdrawn in leg `1`, then teleported in leg `2`.
On the intermediary hop (AssetHub), `InitiateTeleport` fails to send
onward message because of missing transport fees. We also can't rely on
`jit_withdraw` because the original origin is lost on the way, and even
if it weren't we can't rely on the user having funded accounts on each
hop along the way.

# Solution/Changes

- Charge the transport fee in the executor from the transferred assets
(if available),
- Only charge from transferred assets if JIT_WITHDRAW was not set,
- Only charge from transferred assets if unless using XCMv5 `PayFees`
where we do not have this problem.

# Testing

Added regression tests in emulated transfers.

Fixes #4832
Fixes #6637

---------

Signed-off-by: Adrian Catangiu <[email protected]>
Co-authored-by: Francisco Aguirre <[email protected]>
(cherry picked from commit e79fd2b)
@paritytech-cmd-bot-polkadot-sdk paritytech-cmd-bot-polkadot-sdk bot requested a review from a team as a code owner December 9, 2024 20:57
@github-actions github-actions bot added the A3-backport Pull request is already reviewed well in another branch. label Dec 9, 2024
@paritytech-review-bot paritytech-review-bot bot requested a review from a team December 9, 2024 20:59
Copy link

github-actions bot commented Dec 9, 2024

This pull request is amending an existing release. Please proceed with extreme caution,
as to not impact downstream teams that rely on the stability of it. Some things to consider:

  • Backports are only for 'patch' or 'minor' changes. No 'major' or other breaking change.
  • Should be a legit fix for some bug, not adding tons of new features.
  • Must either be already audited or not need an audit.
Emergency Bypass

If you really need to bypass this check: add validate: false to each crate
in the Prdoc where a breaking change is introduced. This will release a new major
version of that crate and all its reverse dependencies and basically break the release.

@franciscoaguirre franciscoaguirre enabled auto-merge (squash) December 10, 2024 12:54
x3c41a
x3c41a previously approved these changes Dec 10, 2024
bkontur
bkontur previously approved these changes Dec 10, 2024
@bkontur bkontur dismissed stale reviews from x3c41a and themself via 5b4cd0a December 10, 2024 14:57
@EgorPopelyaev EgorPopelyaev merged commit 145ea2b into stable2412 Dec 11, 2024
198 of 200 checks passed
@EgorPopelyaev EgorPopelyaev deleted the backport-4834-to-stable2412 branch December 11, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A3-backport Pull request is already reviewed well in another branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants