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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: failed unit test
matthewkeil committed Oct 12, 2024
commit 440c2a20d8634ae6788304fc2d83fb7d27eee87d
10 changes: 6 additions & 4 deletions packages/state-transition/src/cache/epochCache.ts
Original file line number Diff line number Diff line change
@@ -920,18 +920,20 @@ export class EpochCache {
*/
async getBeaconProposersNextEpoch(): Promise<ValidatorIndex[]> {
matthewkeil marked this conversation as resolved.
Show resolved Hide resolved
if (!this.proposersNextEpoch.computed) {
const shuffling = await this.shufflingCache?.get(this.nextEpoch, this.nextDecisionRoot);
if (!shuffling) {
if (!this.nextShuffling) {
this.nextShuffling = (await this.shufflingCache?.get(this.nextEpoch, this.nextDecisionRoot)) ?? null;
}
if (!this.nextShuffling) {
throw new EpochCacheError({
matthewkeil marked this conversation as resolved.
Show resolved Hide resolved
code: EpochCacheErrorCode.NEXT_SHUFFLING_NOT_AVAILABLE,
epoch: this.nextEpoch,
decisionRoot: this.getShufflingDecisionRoot(this.nextEpoch),
});
}
}
const indexes = computeProposers(
this.config.getForkSeqAtEpoch(this.epoch + 1),
this.proposersNextEpoch.seed,
shuffling,
this.nextShuffling,
this.effectiveBalanceIncrements
);
this.proposersNextEpoch = {computed: true, indexes};