diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts index b2f70d6274b3..7923e27861cf 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts @@ -56,6 +56,8 @@ export async function verifyBlocksStateTransitionOnly( // if block is trusted don't verify proposer or op signature verifyProposer: !useBlsBatchVerify && !validSignatures && !validProposerSignature, verifySignatures: !useBlsBatchVerify && !validSignatures, + // do no queue shuffling calculation, run it sync for epoch transitions + asyncShufflingCalculation: false }, metrics ); diff --git a/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts b/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts index 20a53c40d73d..7446254c3183 100644 --- a/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts +++ b/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts @@ -87,6 +87,8 @@ export async function getHistoricalState( verifyStateRoot: false, executionPayloadStatus: ExecutionPayloadStatus.valid, dataAvailableStatus: DataAvailableStatus.available, + // do no queue shuffling calculation, run it sync for epoch transitions + asyncShufflingCalculation: false, }, metrics ); diff --git a/packages/beacon-node/src/chain/produceBlock/computeNewStateRoot.ts b/packages/beacon-node/src/chain/produceBlock/computeNewStateRoot.ts index bfa30e570e06..9005be2147f1 100644 --- a/packages/beacon-node/src/chain/produceBlock/computeNewStateRoot.ts +++ b/packages/beacon-node/src/chain/produceBlock/computeNewStateRoot.ts @@ -38,6 +38,8 @@ export function computeNewStateRoot( verifySignatures: false, // Preserve cache in source state, since the resulting state is not added to the state cache dontTransferCache: true, + // This is called for produceBlockWrapper. Shuffling should be available so can run sync + asyncShufflingCalculation: false, }, metrics ); diff --git a/packages/beacon-node/src/chain/regen/regen.ts b/packages/beacon-node/src/chain/regen/regen.ts index 073556d8162f..a508192c1c4f 100644 --- a/packages/beacon-node/src/chain/regen/regen.ts +++ b/packages/beacon-node/src/chain/regen/regen.ts @@ -261,6 +261,9 @@ export class StateRegenerator implements IStateRegeneratorInternal { verifyStateRoot: false, verifyProposer: false, verifySignatures: false, + // If regen state is necessary do not run shuffling async. If an epoch boundary is crossed then the + // shuffling will be calculated JIT + asyncShufflingCalculation: false, }, this.modules.metrics ); diff --git a/packages/state-transition/src/stateTransition.ts b/packages/state-transition/src/stateTransition.ts index 929a37468c6e..4c701b0e632c 100644 --- a/packages/state-transition/src/stateTransition.ts +++ b/packages/state-transition/src/stateTransition.ts @@ -36,6 +36,7 @@ export type StateTransitionOpts = BlockExternalData & verifyProposer?: boolean; verifySignatures?: boolean; dontTransferCache?: boolean; + asyncShufflingCalculation: boolean; }; /** @@ -68,6 +69,7 @@ export function stateTransition( // Assume default to be valid and available executionPayloadStatus: ExecutionPayloadStatus.valid, dataAvailableStatus: DataAvailableStatus.available, + asyncShufflingCalculation: false, }, metrics?: BeaconStateTransitionMetrics | null ): CachedBeaconStateAllForks {