Skip to content

Commit

Permalink
Merge 1f42b8a into b05c93e
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 authored Sep 7, 2024
2 parents b05c93e + 1f42b8a commit cecd13a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions packages/state-transition/src/block/processWithdrawals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {toRootHex} from "@lodestar/utils";
import {CachedBeaconStateCapella, CachedBeaconStateElectra} from "../types.js";
import {
decreaseBalance,
getValidatorMaxEffectiveBalance,
getMaxEffectiveBalance,
hasEth1WithdrawalCredential,
hasExecutionWithdrawalCredential,
isCapellaPayloadHeader,
Expand Down Expand Up @@ -173,8 +173,7 @@ export function getExpectedWithdrawals(
});
withdrawalIndex++;
} else if (
effectiveBalance ===
(isPostElectra ? getValidatorMaxEffectiveBalance(withdrawalCredentials) : MAX_EFFECTIVE_BALANCE) &&
effectiveBalance === (isPostElectra ? getMaxEffectiveBalance(withdrawalCredentials) : MAX_EFFECTIVE_BALANCE) &&
balance > effectiveBalance
) {
// capella partial withdrawal
Expand Down
4 changes: 2 additions & 2 deletions packages/state-transition/src/util/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {EpochCacheImmutableData} from "../cache/epochCache.js";
import {processDeposit} from "../block/processDeposit.js";
import {increaseBalance} from "../index.js";
import {computeEpochAtSlot} from "./epoch.js";
import {getActiveValidatorIndices, getValidatorMaxEffectiveBalance} from "./validator.js";
import {getActiveValidatorIndices, getMaxEffectiveBalance} from "./validator.js";
import {getTemporaryBlockHeader} from "./blockRoot.js";
import {newFilledArray} from "./array.js";
import {getNextSyncCommittee} from "./syncCommittee.js";
Expand Down Expand Up @@ -195,7 +195,7 @@ export function applyDeposits(
const balance = balancesArr[i];
const effectiveBalance = Math.min(
balance - (balance % EFFECTIVE_BALANCE_INCREMENT),
getValidatorMaxEffectiveBalance(validator.withdrawalCredentials)
getMaxEffectiveBalance(validator.withdrawalCredentials)
);

validator.effectiveBalance = effectiveBalance;
Expand Down
4 changes: 2 additions & 2 deletions packages/state-transition/src/util/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function getConsolidationChurnLimit(epochCtx: EpochCache): number {
return getBalanceChurnLimit(epochCtx) - getActivationExitChurnLimit(epochCtx);
}

export function getValidatorMaxEffectiveBalance(withdrawalCredentials: Uint8Array): number {
export function getMaxEffectiveBalance(withdrawalCredentials: Uint8Array): number {
// Compounding withdrawal credential only available since Electra
if (hasCompoundingWithdrawalCredential(withdrawalCredentials)) {
return MAX_EFFECTIVE_BALANCE_ELECTRA;
Expand All @@ -85,7 +85,7 @@ export function getValidatorMaxEffectiveBalance(withdrawalCredentials: Uint8Arra
}

export function getActiveBalance(state: CachedBeaconStateElectra, validatorIndex: ValidatorIndex): number {
const validatorMaxEffectiveBalance = getValidatorMaxEffectiveBalance(
const validatorMaxEffectiveBalance = getMaxEffectiveBalance(
state.validators.getReadonly(validatorIndex).withdrawalCredentials
);

Expand Down

0 comments on commit cecd13a

Please sign in to comment.