Skip to content

Commit

Permalink
feat: add asyncShufflingCalculation to StateTransitionOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Nov 27, 2024
1 parent b78cb92 commit 79e2401
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
3 changes: 3 additions & 0 deletions packages/beacon-node/src/chain/regen/regen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
2 changes: 2 additions & 0 deletions packages/state-transition/src/stateTransition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type StateTransitionOpts = BlockExternalData &
verifyProposer?: boolean;
verifySignatures?: boolean;
dontTransferCache?: boolean;
asyncShufflingCalculation: boolean;
};

/**
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 79e2401

Please sign in to comment.