From 2ea18e81768f624b2ffef3376002e3d1aa596f33 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Sat, 12 Oct 2024 15:50:59 +0700 Subject: [PATCH] fix: build error in getBeaconProposersNextEpoch --- packages/state-transition/src/cache/epochCache.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/state-transition/src/cache/epochCache.ts b/packages/state-transition/src/cache/epochCache.ts index dbca366f28c..10f9211f1b1 100644 --- a/packages/state-transition/src/cache/epochCache.ts +++ b/packages/state-transition/src/cache/epochCache.ts @@ -920,10 +920,18 @@ export class EpochCache { */ async getBeaconProposersNextEpoch(): Promise { if (!this.proposersNextEpoch.computed) { + const shuffling = await this.shufflingCache?.get(this.nextEpoch, this.nextDecisionRoot); + if (!shuffling) { + 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, - await this.shufflingCache?.get(this.nextEpoch, this.nextDecisionRoot); + shuffling, this.effectiveBalanceIncrements ); this.proposersNextEpoch = {computed: true, indexes};