This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
XCM: Allow reclaim of assets dropped from holding #3727
Merged
Merged
Conversation
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
gavofyork
added
A3-in_progress
Pull request is in progress. No review needed at this stage.
B7-runtimenoteworthy
C1-low
PR touches the given topic and has a low impact on builders.
D9-needsaudit 👮
PR contains changes to fund-managing logic that should be properly reviewed and externally audited.
labels
Aug 26, 2021
47 tasks
gavofyork
added
A0-please_review
Pull request needs code review.
and removed
A3-in_progress
Pull request is in progress. No review needed at this stage.
labels
Aug 27, 2021
gavofyork
changed the title
XCM: Introduce AssetTrap
XCM: Allow reclaim of assets dropped from holding
Aug 27, 2021
KiChjang
reviewed
Aug 27, 2021
KiChjang
reviewed
Aug 27, 2021
ClearError, | ||
|
||
/// Create some assets which are being held on behalf of the origin. |
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.
Do you mean "claim" instead of "create" 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.
In this context they're interchangeable - the Assets will be "created" in the sense that the MultiAsset
instance(s) will be created.
KiChjang
reviewed
Aug 27, 2021
KiChjang
reviewed
Aug 27, 2021
KiChjang
reviewed
Aug 27, 2021
KiChjang
approved these changes
Aug 27, 2021
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.
Nothing really stands out as concerning, aside from some minor documentation stuff.
ordian
added a commit
that referenced
this pull request
Sep 2, 2021
* master: dependabot: ignore yet another git dep (#3759) Bump serde_json from 1.0.66 to 1.0.67 (#3767) Bump syn from 1.0.74 to 1.0.75 (#3710) Companion for substrate #9371 (#3487) Fixes/improvements for disputes (#3753) chore: test helper arbitrary ordering for 2 (#3762) disputes: fix relay chain selection sanity check (#3750) technical committee is using the weight of council, but should have its own generated weight instead (#3511) new proxy for auctions, crowdloans, registrar, slots (#3683) Bump libc from 0.2.100 to 0.2.101 (#3726) Removed unneeded deps (#3658) Bump serde from 1.0.127 to 1.0.130 (#3739) Companion for Generate storage info for pallet authority_discovery #9428 (#3517) Return a Result in invert_location (#3730) XCM: Allow reclaim of assets dropped from holding (#3727)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
A0-please_review
Pull request needs code review.
C1-low
PR touches the given topic and has a low impact on builders.
D9-needsaudit 👮
PR contains changes to fund-managing logic that should be properly reviewed and externally audited.
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.
Introduces a mechanism for systematically allowing the rescue of lost contents of the Holding Register.
Fixes #3694
Trapping assets
XCM Executor's config now includes
AssetTrap
type which is a hook to which the contents of the Holding Register is passed at the close of execution. LikeOnResponse
, a (recommended) implementation is provided by the XCM pallet.This will record a hash of the assets left in the Holding Register at the finish of execution together with the origin. A later claim may be made from the origin in order to resurrect the assets. This is done through the single-function trait
ClaimAssets
which verifies that the assets to be claimed match a hash placed by the same origin.If the version with which the
MultiAssets
have been stored is not the most recent version, then the version index must be included within the claimticket
parameter, aMultiLocation
as aGeneralIndex
.ClaimAsset
A new instruction is provided,
ClaimAsset
, which gains access to anyClaimAssets
implementations exposed to the XCM Executor. If thepallet_xcm::Pallet
implementation is exposed and the origin has unclaimed assets trapped, then those assets may be provided (exactly, as a hash of them is used to validate the claim) together with a ticket reflecting the version of XCM at the time of the trap (orHere
if unchanged) and they will be resurrected into the Holding Register.Additional
Also introduces the
Trap
instruction and error type to force an error to be thrown, and be able to recognise it. It comes with au64
parameter to allow some degree of information to be conveyed with it (without bloating the stack footprint ofXcmError
).Migration
xcm_executor::Config
Two new type definitions are required, and they'll generally want to point at the XCM Pallet concrete type if there is one, e.g.:
Note that destinations which use v1 or v0 for message transport will not be able to use these features (even if the destination supports v2).
TODO
ShouldTrap
filter type to allow runtimes to dictate which assets/origins should be trapped.