Use milhouse pop_front

This commit is contained in:
Pawan Dhananjay
2025-01-22 12:15:45 -08:00
parent ea38409b2c
commit 47803496de
2 changed files with 6 additions and 14 deletions

View File

@@ -644,13 +644,9 @@ pub fn process_withdrawals<E: EthSpec, Payload: AbstractExecPayload<E>>(
// Update pending partial withdrawals [New in Electra:EIP7251]
if let Some(processed_partial_withdrawals_count) = processed_partial_withdrawals_count {
// TODO(electra): Use efficient pop_front after milhouse release https://github.com/sigp/milhouse/pull/38
let new_partial_withdrawals = state
.pending_partial_withdrawals()?
.iter_from(processed_partial_withdrawals_count)?
.cloned()
.collect::<Vec<_>>();
*state.pending_partial_withdrawals_mut()? = List::new(new_partial_withdrawals)?;
state
.pending_partial_withdrawals_mut()?
.pop_front(processed_partial_withdrawals_count)?;
}
// Update the next withdrawal index if this block contained withdrawals

View File

@@ -1075,13 +1075,9 @@ fn process_pending_consolidations<E: EthSpec>(
next_pending_consolidation.safe_add_assign(1)?;
}
let new_pending_consolidations = List::try_from_iter(
state
.pending_consolidations()?
.iter_from(next_pending_consolidation)?
.cloned(),
)?;
*state.pending_consolidations_mut()? = new_pending_consolidations;
state
.pending_consolidations_mut()?
.pop_front(next_pending_consolidation)?;
// the spec tests require we don't perform effective balance updates when testing pending_consolidations
if !perform_effective_balance_updates {