diff --git a/packages/state-transition/src/cache/epochCache.ts b/packages/state-transition/src/cache/epochCache.ts index 10f9211f1b1..f9ae98d7eb8 100644 --- a/packages/state-transition/src/cache/epochCache.ts +++ b/packages/state-transition/src/cache/epochCache.ts @@ -920,18 +920,20 @@ export class EpochCache { */ async getBeaconProposersNextEpoch(): Promise { 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({ 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};