-
Notifications
You must be signed in to change notification settings - Fork 861
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
Validator disabling in session enhancements #7663
base: master
Are you sure you want to change the base?
Conversation
Looks good so far. |
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.
small nits, looks good overall
@@ -81,7 +83,7 @@ pub mod v17 { | |||
|
|||
#[frame_support::storage_alias] | |||
pub type DisabledValidators<T: Config> = | |||
StorageValue<Pallet<T>, BoundedVec<(u32, OffenceSeverity), ConstU32<100>>, ValueQuery>; | |||
StorageValue<Pallet<T>, BoundedVec<(u32, OffenceSeverity), ConstU32<300>>, ValueQuery>; |
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.
Didn't we wanted to merge v16 and v17?
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.
Sure but how does that connect to this bounded vec limit? @Ank4n
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.
GitHub wouldn’t let me comment on the mod v17
line.
This comment was marked as spam.
This comment was marked as spam.
/// Public function to access the disabled validators with their severities. | ||
pub fn disabled_validators_with_severities() -> Vec<(u32, OffenceSeverity)> { | ||
DisabledValidators::<T>::get() | ||
} |
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.
is the plan to expose this in a runtime API or how is it planned to be used?
/// Disable the validator identified by `c`. (If using with the staking pallet, | ||
/// this would be their *stash* account.) | ||
/// | ||
/// Returns `false` either if the validator could not be found or it was already | ||
/// disabled. | ||
pub fn disable(c: &T::ValidatorId) -> bool { | ||
Validators::<T>::get() | ||
.iter() | ||
.position(|i| i == c) | ||
.map(|i| Self::disable_index(i as u32)) | ||
.unwrap_or(false) | ||
} | ||
|
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.
any reason to keep disable_index
, but not disable
? i thought the former was done for backwards compatibility, but without the latter this is a breaking change
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.
We can disable, disable with severity and re-enable. All those could be called with either index or validator id. Instead of having 6+ different functions we provide index ones and supply pub fn validator_id_to_index(id: &T::ValidatorId) -> Option<u32>
so users can do the translation themselves.
Do you think it would be sensible to duplicate all those calls with _validator_id where we just bake in the call to validator_id_to_index?
- name: pallet-staking | ||
bump: major | ||
- name: pallet-session | ||
bump: major |
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 believe it doesn't have to be major if you keep disable
pub fn
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'd prefer removing old disable. It simplifies and unifies the interface while still allowing for old-scholl interface with the provided translation func (pub fn validator_id_to_index
).
All GitHub workflows were cancelled due to failure one of the required jobs. |
1 similar comment
All GitHub workflows were cancelled due to failure one of the required jobs. |
All GitHub workflows were cancelled due to failure one of the required jobs. |
On top of 7581.
Adds the missing testing cases and adresses some overdue review feedback post merge.