From f2b96ff008bf201b0109bd5bac868b631f9a241b Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:08:26 -0700 Subject: [PATCH] fix: include skipped partial withdrawal to `partialWithdrawalsCount` (#7118) Include skipped partial withdrawal to count --- packages/params/src/presets/minimal.ts | 2 +- packages/state-transition/src/block/processWithdrawals.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/params/src/presets/minimal.ts b/packages/params/src/presets/minimal.ts index 5dc8fc10d80..f93e3b1ca2c 100644 --- a/packages/params/src/presets/minimal.ts +++ b/packages/params/src/presets/minimal.ts @@ -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, diff --git a/packages/state-transition/src/block/processWithdrawals.ts b/packages/state-transition/src/block/processWithdrawals.ts index d4dfd47b4d9..610a2ed62b4 100644 --- a/packages/state-transition/src/block/processWithdrawals.ts +++ b/packages/state-transition/src/block/processWithdrawals.ts @@ -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; @@ -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