From 5e65f7efa85fad169a6263d1bebc1b4f8d3701d4 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Thu, 22 Aug 2024 01:27:09 -0400 Subject: [PATCH] fix: calc of pivot slot before slot increment --- packages/state-transition/src/util/epochShuffling.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/state-transition/src/util/epochShuffling.ts b/packages/state-transition/src/util/epochShuffling.ts index ce4ad136c0b6..2342cd327c41 100644 --- a/packages/state-transition/src/util/epochShuffling.ts +++ b/packages/state-transition/src/util/epochShuffling.ts @@ -144,8 +144,10 @@ export function computeEpochShuffling( } function calculateDecisionRoot(state: BeaconStateAllForks, epoch: Epoch, beforeSlotIncrement = false): RootHex { - const pivotEpoch = beforeSlotIncrement ? epoch : epoch - 1; - const pivotSlot = computeStartSlotAtEpoch(pivotEpoch) - 1; + let pivotSlot = computeStartSlotAtEpoch(epoch - 1); + if (!beforeSlotIncrement) { + pivotSlot--; + } return toRootHex(getBlockRootAtSlot(state, pivotSlot)); }