From 3b93447b96e69721ba4eab0ff53c9e628f30c0b7 Mon Sep 17 00:00:00 2001 From: hangleang Date: Sat, 21 Dec 2024 22:36:27 +0700 Subject: [PATCH] Update initial earliest_exit_epoch calculation --- helper_functions/src/fork.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/helper_functions/src/fork.rs b/helper_functions/src/fork.rs index 59e85e26..80a297cb 100644 --- a/helper_functions/src/fork.rs +++ b/helper_functions/src/fork.rs @@ -586,12 +586,14 @@ pub fn upgrade_to_electra( excess_blob_gas, }; + // initial value of `earliest_exit_epoch` + let earliest_activation_epoch = misc::compute_activation_exit_epoch::

(epoch); + let earliest_exit_epoch = validators .into_iter() .map(|validator| validator.exit_epoch) .filter(|exit_epoch| *exit_epoch != FAR_FUTURE_EPOCH) - .max() - .unwrap_or(epoch) + .fold(earliest_activation_epoch, |earliest, exit_epoch| earliest.max(exit_epoch)) + 1; let mut post = ElectraBeaconState { @@ -641,7 +643,7 @@ pub fn upgrade_to_electra( exit_balance_to_consume: 0, earliest_exit_epoch, consolidation_balance_to_consume: 0, - earliest_consolidation_epoch: misc::compute_activation_exit_epoch::

(epoch), + earliest_consolidation_epoch: earliest_activation_epoch, pending_deposits: PersistentList::default(), pending_partial_withdrawals: PersistentList::default(), pending_consolidations: PersistentList::default(),