From 440c2a20d8634ae6788304fc2d83fb7d27eee87d Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Sat, 12 Oct 2024 21:29:08 +0700 Subject: [PATCH] fix: failed unit test --- packages/state-transition/src/cache/epochCache.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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};