fix: update added_validators and removed_validators on stake-bound force-removals#168
Open
matthias-wright wants to merge 3 commits into
Open
fix: update added_validators and removed_validators on stake-bound force-removals#168matthias-wright wants to merge 3 commits into
matthias-wright wants to merge 3 commits into
Conversation
|
LGTM. This PR stages stake-bound force removals into |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The finalized header for an epoch will be created on the penultimate block of an epoch. This is because the finalized header has to be included in the last block of an epoch, so that the aggregated signature from the finalization certificate can be used to attest to the finalized header.
Therefore, all the fields that will be included in the finalized header (including
removed_validators) have to be calculated after processing the penultimate block of an epoch.Protocol parameter updates are processed on the last block of an epoch. If
MinimumStakeis increased, validators whose stake is below the new minimum stake will be removed.However, when the validators are removed on the last block of an epoch, they won't be included in the
removed_validatorsfield of the finalized header.Similarly, validators that are scheduled to join in a future epoch won't be removed from the
added_validatorsmap.When a joining validator wants to verify a checkpoint, they calculate the validator set for each epoch based on the validator deltas included in the finalized headers. Stake-bound force-removals would be missing from this delta, and pending validators whose participation was aborted before joining will be included wrongfully.
Changes:
removed_validators. The list of joining validators whose stake is below the new minimum stake is calculated and removed fromadded_validators. The actual handling of the protocol parameter updates is still done at the last block of an epoch to ensure that the protocol parameter updates are only effective for the new epoch.MinimumStakearrives with the last block of an epoch, some validators could be removed, but the changes wouldn't be recorded inremoved_validators. Therefore, protocol param requests arriving with the last block of an epoch will be buffered until the next epoch.test_removed_validators_at_epoch_boundary_stake_boundis added to verify that the finalized header'sremoved_validatorsfield will include validators that were forcefully removed due to insufficient stake.test_joining_validator_activation_cancelled_on_stake_bound_force_removalis added to verify that if a joining validator is kicked before becoming active, they won't be included in the finalized header'sadded_validatorsfield.