-
Notifications
You must be signed in to change notification settings - Fork 5
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
SYS-4220 Disable lowering #438
Conversation
|
||
#[pallet::call_index(10)] | ||
#[pallet::weight(<T as pallet::Config>::WeightInfo::toggle_lowering())] | ||
pub fn toggle_lowering(origin: OriginFor<T>, enabled: bool) -> DispatchResult { |
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 prefer having a set_config
function where different values can be configured
we already have set_lower_schedule_period
so it would be better if we have one set admin function.
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 personally prefer having smaller extrinsics that do specific tasks. They are easier to test, benchmark and reason with. Happy to hear other thoughts
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.
For me, with the little experience I have, I feel like smaller extrinsics are easier to understand but happy either way!
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'm afraid I have to disagree, multiple entry points for sudo configuration is a security concern.
The codebase increases significantly if you have to replicate all origin and benchmark tests for each one of the entry points, making it difficult to navigate through files.
This is a common practice in many pallets with complex config.
Alternatively, we can make this a const, defined by the runtime. Its clean and minimal and the way many pallets are configured in substrate.
LoweringEnabled, | ||
LoweringDisabled, |
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.
One event for settings is better to avoid bloating the pallet codebase.
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 personally prefer having specific events that describe exactly what is happening instead of a generic one with different argument. Again happy to hear what others think.
…ain into nahu-sys-4220-disableLowering
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.
The functionality of the code introduced on this PR is correct, the approach to changing the configuration should improve as mentioned.
Although this has an overhead, this can be done on a separate refactor since the functionality needs to be expedited.
Approved on that basis.
Proposed changes
This PR introduces a flag to toggle lowering capabilities of the chain.
Type of change/Merge
🚨What type of change is this PR?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR.Further comments