This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
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.
Safe desired targets call #12826
Safe desired targets call #12826
Changes from 4 commits
d93cb65
62d6461
7a689a2
bbc807e
f672412
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 am leaning towards throwing an error if
desired_targets < MaxWinners
. Alternatively, we can cap thedesired_targets
toMaxWinners
silently.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.
My feeling is that error-ing the snapshot creation because
desired_targets < MaxWinners
is probably too harsh. I think that capping thedesired_targets
toMaxWinners
would be a good option, but I'd do it when infn snapshot_creation_external()
when handling the error from this call. And add a warning too. Something along the lines of: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 have been split about this. We are already capping
desired_targets
toelectable_targets
so in that way it makes sense to capdesired_targets
toMaxWinners
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 whileMaxWinners
anddesired_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 havetry_state
checks to make sure we are not making this configuration error before it becomes part of the runtime.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.
MaxWinners
is the cap that should NEVER be reached, I think returning an error is better.