safe arith in upgrade to electra

This commit is contained in:
realbigsean
2024-04-25 16:15:49 -04:00
parent bd9b179ab0
commit 9ee134dcd8

View File

@@ -1,3 +1,4 @@
use safe_arith::SafeArith;
use std::mem;
use types::{
BeaconState, BeaconStateElectra, BeaconStateError as Error, ChainSpec, EpochCache, EthSpec,
@@ -19,7 +20,7 @@ pub fn upgrade_to_electra<E: EthSpec>(
.map(|v| v.exit_epoch)
.max()
.unwrap_or(epoch)
+ 1;
.safe_add(1)?;
let consolidation_balance_to_consume = pre_state.get_consolidation_churn_limit(spec)?;
let earliest_consolidation_epoch = spec.compute_activation_exit_epoch(epoch)?;