Skip to content

Commit

Permalink
fix: include skipped partial withdrawal to partialWithdrawalsCount (#…
Browse files Browse the repository at this point in the history
…7118)

Include skipped partial withdrawal to count
  • Loading branch information
ensi321 authored Oct 8, 2024
1 parent 0d1fd9c commit f2b96ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/params/src/presets/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const minimalPreset: BeaconPreset = {
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2,
MAX_ATTESTER_SLASHINGS_ELECTRA: 1,
MAX_ATTESTATIONS_ELECTRA: 8,
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1,
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 2,
// 2**11 * 10**9 (= 2,048,000,000,000) Gwei
MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000,
MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA: 4096,
Expand Down
5 changes: 3 additions & 2 deletions packages/state-transition/src/block/processWithdrawals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export function getExpectedWithdrawals(

const withdrawals: capella.Withdrawal[] = [];
const isPostElectra = fork >= ForkSeq.electra;
// partialWithdrawalsCount is withdrawals coming from EL since electra (EIP-7002)
let partialWithdrawalsCount = 0;

if (isPostElectra) {
const stateElectra = state as CachedBeaconStateElectra;
Expand Down Expand Up @@ -138,11 +140,10 @@ export function getExpectedWithdrawals(
});
withdrawalIndex++;
}
partialWithdrawalsCount++;
}
}

// partialWithdrawalsCount is withdrawals coming from EL since electra (EIP-7002)
const partialWithdrawalsCount = withdrawals.length;
const bound = Math.min(validators.length, MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP);
let n = 0;
// Just run a bounded loop max iterating over all withdrawals
Expand Down

0 comments on commit f2b96ff

Please sign in to comment.