You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
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
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
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
The reason will be displayed to describe this comment to others. Learn more.
My feeling is that error-ing the snapshot creation because desired_targets < MaxWinners is probably too harsh. I think that capping the desired_targets to MaxWinners would be a good option, but I'd do it when in fn snapshot_creation_external() when handling the error from this call. And add a warning too. Something along the lines of:
fn create_snapshot_external(// ...
let mut desired_targets = <Pallet<T>asElectionProviderBase>::desired_targets_checked().or_else(|e|
match e {Error::DesiredTargetsGreaterThanMaxWinners => {// warning: capping the desired targetsOk(<Pallet<T>asElectionProviderBase>::MaxWinners::get())}
_ => Err(ElectionError::DataProvider(e)),})?;// ...
The reason will be displayed to describe this comment to others. Learn more.
I have been split about this. We are already capping desired_targets to electable_targets so in that way it makes sense to cap desired_targets to MaxWinners as well.
But to present another perspective why this is a different case, electable_targets is a dynamic value that depends on total number of validator intentions while MaxWinners and desired_targets are static value configured in the runtime. If we consider this as a configuration issue, we should ideally fail till this configuration is fixed. We also have try_state checks to make sure we are not making this configuration error before it becomes part of the runtime.
The reason will be displayed to describe this comment to others. Learn more.
MaxWinners is the cap that should NEVER be reached, I think returning an error is better.
},
Err(e) => Err(e),
}
Expand Down
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.
Uh oh!
There was an error while loading. Please reload this page.