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

fix: make sure shuffling is calculated when querying next epoch proposers #7156

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,8 @@ export function getValidatorApi(
break;

case stateEpoch + 1:
// make sure shuffling is calculated and ready for next call to calculate nextProposers
await chain.shufflingCache.get(state.epochCtx.nextEpoch, state.epochCtx.nextDecisionRoot);
// Requesting duties for next epoch is allowed since they can be predicted with high probabilities.
// @see `epochCtx.getBeaconProposersNextEpoch` JSDocs for rationale.
indexes = state.epochCtx.getBeaconProposersNextEpoch();
Expand Down
2 changes: 1 addition & 1 deletion packages/state-transition/src/cache/epochCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ export class EpochCache {
getBeaconProposersNextEpoch(): ValidatorIndex[] {
if (!this.proposersNextEpoch.computed) {
const indexes = computeProposers(
this.config.getForkSeqAtEpoch(this.epoch + 1),
this.config.getForkSeqAtEpoch(this.nextEpoch),
this.proposersNextEpoch.seed,
this.getShufflingAtEpoch(this.nextEpoch),
matthewkeil marked this conversation as resolved.
Show resolved Hide resolved
this.effectiveBalanceIncrements
Expand Down
Loading