[xcm-v5] implement RFC#122: InitiateTransfer can alias XCM original origin on destination#5971
Merged
acatangiu merged 23 commits intoparitytech:xcm-v5from Oct 29, 2024
Merged
Conversation
407cbd1 to
8ea5622
Compare
This was referenced Oct 14, 2024
8ea5622 to
d9d68a9
Compare
6737a77 to
2429429
Compare
Signed-off-by: Adrian Catangiu <adrian@parity.io>
059ddb0 to
2113ebb
Compare
Contributor
|
bot fmt |
Contributor
|
bot bench cumulus-assets --subcommand=xcm --runtime=asset-hub-westend --pallet=pallet_xcm_benchmarks::generic bot bench cumulus-assets --subcommand=xcm --runtime=asset-hub-westend --pallet=pallet_xcm_benchmarks::fungible |
added 4 commits
October 25, 2024 18:30
…set-hub-rococo --runtime_dir=assets --target_dir=cumulus --pallet=pallet_xcm_benchmarks::fungible
…set-hub-westend --runtime_dir=assets --target_dir=cumulus --pallet=pallet_xcm_benchmarks::generic
…set-hub-rococo --runtime_dir=assets --target_dir=cumulus --pallet=pallet_xcm_benchmarks::generic
…set-hub-westend --runtime_dir=assets --target_dir=cumulus --pallet=pallet_xcm_benchmarks::fungible
franciscoaguirre
approved these changes
Oct 25, 2024
Contributor
Author
|
bot clean |
bkontur
reviewed
Oct 29, 2024
bkontur
reviewed
Oct 29, 2024
bkontur
approved these changes
Oct 29, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 6, 2024
# Context This PR aims to introduce XCMv5, for now it's in progress and will be updated over time. This branch will serve as a milestone branch for merging in all features we want to add to XCM, roughly outlined [here](polkadot-fellows/xcm-format#60). More features could be added. ## TODO - [x] Migrate foreign assets from v3 to v4 - [x] Setup v5 skeleton - [x] Remove XCMv2 - [x] #5390 - [x] #5585 - [x] #5420 - [x] #5876 - [x] #5971 - [x] #6148 - [x] #6228 Fixes #3434 Fixes #4190 Fixes #5209 Fixes #5241 Fixes #4284 --------- Signed-off-by: Adrian Catangiu <adrian@parity.io> Co-authored-by: Adrian Catangiu <adrian@parity.io> Co-authored-by: Andrii <ndk@parity.io> Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: Joseph Zhao <65984904+programskillforverification@users.noreply.github.com> Co-authored-by: Nazar Mokrynskyi <nazar@mokrynskyi.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: command-bot <> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Serban Iorga <serban@parity.io>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Built on top of #5876
Description
Currently, all XCM asset transfer instructions ultimately clear the origin in the remote XCM message by use of the
ClearOrigininstruction. This is done for security considerations to ensure that subsequent (user-controlled) instructions cannot command the authority of the sending chain.The problem with this approach is that it limits what can be achieved on remote chains through XCM. Most XCM operations require having an origin, and following any asset transfer the origin is lost, meaning not much can be done other than depositing the transferred assets to some local account or transferring them onward to another chain.
For example, we cannot transfer some funds for buying execution, then do a
Transact(all in the same XCM message).In the case of XCM programs going from source-chain directly to dest-chain without an intermediary hop, we can enable scenarios such as above by using the AliasOrigin instruction instead of the ClearOrigin instruction.
Instead of clearing the source-chain origin, the destination chain shall attempt to alias source-chain to "original origin" on the source chain. Most common such origin aliasing would be X1(Parachain(source-chain)) -> X2(Parachain(source-chain), AccountId32(origin-account)) for the case of a single hop transfer where the initiator is a (signed/pure/proxy) account origin-account on source-chain. This is equivalent to using the DescendOrigin instruction in this case, but also usable in the multi hop case.
This allows an actor on chain A to Transact on chain B without having to prefund its SA account on chain B, instead they can simply transfer the required fees in the same XCM program as the Transact.
As long as the asset transfer has the same XCM route/hops as the rest of the program, this pattern of usage can be composed across multiple hops, to ultimately Transact on the final hop using the original origin on the source chain, effectively abstracting away any intermediary hops.
XCM
InitiateAssetsTransferinstruction changesA new parameter
preserve_originto be added to theInitiateAssetsTransferXCM instruction that specifies if the original origin should be preserved or cleared.InitiateAssetsTransfer { destination: Location, assets: Vec<AssetTransferFilter>, remote_fees: Option<AssetTransferFilter>, + preserve_origin: bool, remote_xcm: Xcm<()>, }This parameter is explicitly necessary because the instruction should be usable between any two chains regardless of their origin-aliasing trust relationship. Preserving the origin requires some level of trust, while clearing it works regardless of that relationship.
Specifying
preserve_origin: falsewill always work regardless of the configured alias filters of theinvolved chains.
Testing