-
Notifications
You must be signed in to change notification settings - Fork 29
feat: [v0.8-develop, experimental]: move runtime validation always allow to execution function definition [4/N] #61
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
Conversation
jaypaik
left a comment
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 really like this simplification too. Would be great to get rid of the last magic value if possible too...
| // The selector to install | ||
| bytes4 executionSelector; | ||
| // If true, the function won't need runtime validaiton, and can be called by anyone. | ||
| bool isPublic; |
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.
Perhaps isUnprotected or isUnguarded (or something else similar) is clearer?
Or maybe even isRuntimeUnprotected?
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.
Yeah good ideas. I also thought of needsValidation, but I thought the intuition around isPublic might be simpler.
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.
Using a name that includes runtime might help reduce user errors
| // The selector to install | ||
| bytes4 executionSelector; | ||
| // If true, the function won't need runtime validaiton, and can be called by anyone. | ||
| bool isPublic; |
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.
Using a name that includes runtime might help reduce user errors
c179b20 to
f2ebe06
Compare
c83ac72 to
e871784
Compare
f2ebe06 to
34ccb35
Compare
96934cc to
77ce9ff
Compare
34ccb35 to
7d9b2f1
Compare
77ce9ff to
f48ccd7
Compare
…on function definition (#61)
Motivation
To allow for multiple validation functions per selector, we need a way to deal with overlapping values. The "always allow in runtime" magic value for validation poses a problem, where it could create additional overlapping values, similar to the "always deny" validation hook.
Solution
Instead of doing another special-casing in the validation storage, we can add a property to the definition of an execution function to indicate whether or not the function requires validation.
This is a more logical organization, because the implementer of a function should know whether it is a sensitive function or not. It avoids having to define validation functions for each of these, which simplifies most plugin manifests.
Although this will most often be applied to view functions, this PR avoids restricting it to only view functions and to using
staticcall- there may be legitimate non-view functions that can be called by anyone, and allowing them comes at no incremental cost.Future work
This introduces a new struct to the manifest, even though the fields within it would easily fit within a single word. The spec should pack these in the future, once we are more certain of its format.