Skip to content
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

Logic to handle new validators during epoch processing #8874

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

lucassaldanha
Copy link
Member

PR Description

This PR updates epoch processing logic to consider that post-Electra, the validator set can be updated in the mid-epoch processing (this did not happen before). The gist of the change is that we might need to update our ValidatorStatuses object, which acts as a cache of the validators in the validator set. We don't ever want to run this logic before Electra, and even in Electra, we only want to do it if we detect the validator set has changed.

Fixed Issue(s)

fixes #8849

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

final BeaconState state,
final ValidatorStatuses validatorStatuses,
final UInt64 currentEpoch) {
final int preValidatorCount = validatorStatuses.getValidatorCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd probably call this cachedValidatorCount

final ValidatorStatuses validatorStatuses,
final UInt64 currentEpoch) {
final int preValidatorCount = validatorStatuses.getValidatorCount();
final int postValidatorCount = state.getValidators().size();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stateValidatorCount

@lucassaldanha lucassaldanha marked this pull request as ready for review December 3, 2024 03:35
Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just nits.

@lucassaldanha lucassaldanha enabled auto-merge (squash) December 3, 2024 05:33
@lucassaldanha lucassaldanha merged commit a4d9efe into Consensys:master Dec 3, 2024
17 checks passed
@lucassaldanha lucassaldanha deleted the epoch_processing branch December 3, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle validator set update mid-epoch processing (Electra+)
2 participants