Skip to content

Commit

Permalink
fix: effectiveBalanceLimit should be per validator
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Aug 23, 2024
1 parent eeaefc1 commit 12296dc
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ export function processEffectiveBalanceUpdates(
const balances = cache.balances ?? state.balances.getAll();
const currentEpochValidators = cache.validators;
const newCompoundingValidators = cache.newCompoundingValidators ?? new Set();
let effectiveBalanceLimit: number | null = null;
if (fork < ForkSeq.electra) {
effectiveBalanceLimit = MAX_EFFECTIVE_BALANCE;
}

let numUpdate = 0;
for (let i = 0, len = balances.length; i < len; i++) {
Expand All @@ -60,8 +56,11 @@ export function processEffectiveBalanceUpdates(
let effectiveBalanceIncrement = effectiveBalanceIncrements[i];
let effectiveBalance = effectiveBalanceIncrement * EFFECTIVE_BALANCE_INCREMENT;

// from electra
if (effectiveBalanceLimit === null) {
let effectiveBalanceLimit: number;
if (fork < ForkSeq.electra) {
effectiveBalanceLimit = MAX_EFFECTIVE_BALANCE;
} else {
// from electra, effectiveBalanceLimit is per validator
const isCompoundingValidator =
hasCompoundingWithdrawalCredential(currentEpochValidators[i].withdrawalCredentials) ||
newCompoundingValidators.has(i);
Expand Down

0 comments on commit 12296dc

Please sign in to comment.