-
Notifications
You must be signed in to change notification settings - Fork 803
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
XCM: Deny barrier checks for nested XCMs with specific instructions to be executed on the local chain #7200
Draft
bkontur
wants to merge
13
commits into
master
Choose a base branch
from
bko-deny-nested-xcm-barrier
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+447
−8
Draft
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9c80770
PoC: DenyInstructionsWithXcm for validating nested XCM instructions
bkontur 6c79a06
PoC: DenyInstructionsWithXcm for validating nested XCM instructions
bkontur a98fc0d
Merge branch 'bko-deny-nested-xcm-barrier' of https://github.com/pari…
raymondkfcheung a70881e
Merge branch 'master' into bko-deny-nested-xcm-barrier
raymondkfcheung 72bec5b
Fix merge conflicts
raymondkfcheung 7aec7fe
Merge branch 'master' into bko-deny-nested-xcm-barrier
raymondkfcheung 6f60579
Update from raymondkfcheung running command 'fmt'
github-actions[bot] 06c7e65
Fix merge conflicts
raymondkfcheung 7bd8e10
Merge branch 'master' into bko-deny-nested-xcm-barrier
raymondkfcheung 2d3d33d
Update from raymondkfcheung running command 'fmt'
github-actions[bot] df64f5f
poc(XCM): Deny Nested XCM Barriers (#7351)
raymondkfcheung 797f868
Merge branch 'master' into bko-deny-nested-xcm-barrier
raymondkfcheung 72f8fe4
Refactor DenyInstructionsWithXcm with new NestedXcmType
raymondkfcheung 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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.
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.
Regarding the naming, maybe we can use
DenyNestedXcmInstructions
, which may be better to state clearly with nested XCMs.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 think
DenyNestedXcmInstructions
is a better name, but we still need to ensure it's explicitly used only for the following instructions:SetAppendix
,SetErrorHandler
, andExecuteWithOrigin
—which are meant to be executed on the local chain.This is important because there are other instructions with nested XCM, such as
DepositReserveAsset { xcm: Xcm<()>, ... }
andInitiateReserveWithdraw { xcm: Xcm<()>, ... }
, where the innerxcm
is executed on a remote chain.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.
Good point! If we want to check all nested XCM instructions recursively (including those executed remotely), we could rename it to
DenyNestedXcmInstructions
and adjust the logic accordingly.However, since this implementation currently applies only to instructions executed on the local chain (
SetAppendix
,SetErrorHandler
, andExecuteWithOrigin
), we could instead introduce two separate types for clarity:DenyNestedLocalInstructions
: Covers only local execution cases (current behavior).DenyNestedRemoteInstructions
: Specifically targets instructions likeDepositReserveAsset
andInitiateReserveWithdraw
, ensuring remote execution filtering.Would this separation make sense, or do you think a more unified approach is preferable?
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.
Generally, a local chain should not assume rules about other chains' rules/barriers.
The design is that each chain only enforces its own local rules.
It is the job of the offchain component (wallet/ui/app) building the XCM to validate (e.g. through XCM dry-run APIs) that the XCM they build will pass barriers on all involved chains.
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've defined a new
NestedXcmType
when performing the deny execution. This categorises nested XCM calls as either Local or Remote, ensuring we handle them separately.Right now, both types go through
deny_recursively
, but I can implement two different denial strategies (DenyNestedLocalInstructions
andDenyNestedRemoteInstructions
) if needed. Let me know if you see any difference in behavior, or if you'd prefer keeping a singleDenyNestedXcmInstructions
that applies to both.Or shall I use
origin: &Location
to determine whether it's Local or Remote? If it's Remote, then I could deny all location-based instructions.