diff --git a/packages/beacon-state-transition/src/allForks/epoch/processEffectiveBalanceUpdates.ts b/packages/beacon-state-transition/src/allForks/epoch/processEffectiveBalanceUpdates.ts index f5d195777f1d..717fbe0af3e0 100644 --- a/packages/beacon-state-transition/src/allForks/epoch/processEffectiveBalanceUpdates.ts +++ b/packages/beacon-state-transition/src/allForks/epoch/processEffectiveBalanceUpdates.ts @@ -21,7 +21,12 @@ export function processEffectiveBalanceUpdates( // update effective balances with hysteresis (process.balances ?? state.balances).forEach((balance: bigint, i: number) => { const effectiveBalance = process.validators[i].effectiveBalance; - if (balance + DOWNWARD_THRESHOLD < effectiveBalance || effectiveBalance + UPWARD_THRESHOLD < balance) { + if ( + // Too big + effectiveBalance > balance + DOWNWARD_THRESHOLD || + // Too small. Check effectiveBalance < MAX_EFFECTIVE_BALANCE to prevent unnecessary updates + (effectiveBalance < MAX_EFFECTIVE_BALANCE && effectiveBalance < balance - UPWARD_THRESHOLD) + ) { validators.update(i, { effectiveBalance: bigIntMin(balance - (balance % EFFECTIVE_BALANCE_INCREMENT), MAX_EFFECTIVE_BALANCE), });