This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Root origin always bypass all filter, other origin cannot bypass BaseCallFilter even when constructed from Root origin#9948
Merged
7 commits merged intomasterfrom Oct 7, 2021
Conversation
athei
reviewed
Oct 6, 2021
KiChjang
reviewed
Oct 6, 2021
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
bkchr
approved these changes
Oct 6, 2021
| // when caller is system Root. One can use `OriginTrait::reset_filter` to do so. | ||
| /// The runtime origin type represanting the origin of a call. | ||
| /// | ||
| /// Origin is always created with the base filter configured in `frame_system::Config::BaseCallFilter`. |
Member
There was a problem hiding this comment.
Using proper intra doc links here would be nice.
Contributor
Author
There was a problem hiding this comment.
I'll do in a follow up when I get more time #9962
| fn filter_call(&self, call: &Self::Call) -> bool { | ||
| (self.filter)(call) | ||
| // Root bypasses all filters | ||
| matches!(self.caller, OriginCaller::system(#system_path::Origin::<#runtime>::Root)) |
Member
There was a problem hiding this comment.
Suggested change
| matches!(self.caller, OriginCaller::system(#system_path::Origin::<#runtime>::Root)) | |
| match self.caller { OriginCaller::system(#system_path::Origin::<#runtime>::Root) => true, _ => false } |
Or use an absolute path to matches! here.
Contributor
Author
|
bot merge |
|
Waiting for commit status. |
19 tasks
This pull request was closed.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Currently when an origin caller is constructed from root then it has no filter, this allowed to have root origin bypassing filters.
But:
reset_filterthen the origin had theBaseCallFilterregardless of being root or notNow those behavior are "fixed", an origin with a root caller always bypass filter, and if the origin caller is changed this property still hold.
So any origin will have BaseCallFilter (and the added one if some were added) and if the origin caller is root then all filters are bypassed.
Idea from @basti,
cc @athei