Skip to content

Commit

Permalink
fix: only transfer cache at epoch transition (#6102)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Nov 10, 2023
1 parent a06c719 commit fa30bcf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/beacon-node/src/chain/blocks/verifyBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export async function verifyBlocksInEpoch(

if (!isStateValidatorsNodesPopulated(preState0)) {
this.logger.verbose("verifyBlocksInEpoch preState0 SSZ cache stats", {
slot: preState0.slot,
cache: isStateValidatorsNodesPopulated(preState0),
clonedCount: preState0.clonedCount,
clonedCountWithTransferCache: preState0.clonedCountWithTransferCache,
Expand Down
5 changes: 3 additions & 2 deletions packages/beacon-node/src/chain/prepareNextSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ export class PrepareNextSlotScheduler {
const prepareState = await this.chain.regen.getBlockSlotState(
headRoot,
prepareSlot,
// the 1st slot of next epoch will likely use this Previous Root Checkpoint state so we transfer cache here
{dontTransferCache: false},
// the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
// for other slots dontTransferCached=true because we don't run state transition on this state
{dontTransferCache: !isEpochTransition},
RegenCaller.precomputeEpoch
);

Expand Down

0 comments on commit fa30bcf

Please sign in to comment.