Skip to content

Commit

Permalink
Fix earliestExitEpoch
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 authored and nflaig committed Dec 3, 2024
1 parent 79a814c commit d3fdb52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/state-transition/src/slot/upgradeStateToElectra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function upgradeStateToElectra(stateDeneb: CachedBeaconStateDeneb): Cache

const validatorsArr = stateElectraView.validators.getAllReadonly();
const exitEpochs: Epoch[] = [];
const currentEpochPre = stateDeneb.epochCtx.epoch;

// [EIP-7251]: add validators that are not yet active to pending balance deposits
const preActivation: ValidatorIndex[] = [];
Expand All @@ -70,10 +71,9 @@ export function upgradeStateToElectra(stateDeneb: CachedBeaconStateDeneb): Cache
}
}

const currentEpochPre = stateDeneb.epochCtx.epoch;

if (exitEpochs.length === 0) {
exitEpochs.push(currentEpochPre);
exitEpochs.push(computeActivationExitEpoch(currentEpochPre));
}
stateElectraView.earliestExitEpoch = Math.max(...exitEpochs) + 1;
stateElectraView.consolidationBalanceToConsume = BigInt(0);
Expand Down

0 comments on commit d3fdb52

Please sign in to comment.