diff --git a/consensus/state_processing/src/common/altair.rs b/consensus/state_processing/src/common/altair.rs index 208ac701d..6d26abd2d 100644 --- a/consensus/state_processing/src/common/altair.rs +++ b/consensus/state_processing/src/common/altair.rs @@ -44,7 +44,7 @@ fn get_base_reward_per_increment( total_active_balance: u128, spec: &ChainSpec, ) -> Result { - spec.effective_balance_increment - .safe_mul(spec.base_reward_factor)? - .safe_div(total_active_balance.integer_sqrt() as u64) + Ok((spec.effective_balance_increment as u128) + .safe_mul(spec.base_reward_factor as u128)? + .safe_div(total_active_balance.integer_sqrt())? as u64) } diff --git a/consensus/state_processing/src/per_epoch_processing/slashings.rs b/consensus/state_processing/src/per_epoch_processing/slashings.rs index 7e30d9de2..4e9032422 100644 --- a/consensus/state_processing/src/per_epoch_processing/slashings.rs +++ b/consensus/state_processing/src/per_epoch_processing/slashings.rs @@ -22,14 +22,14 @@ pub fn process_slashings( && epoch.safe_add(T::EpochsPerSlashingsVector::to_u64().safe_div(2)?)? == validator.withdrawable_epoch { - let increment = spec.effective_balance_increment; + let increment = spec.effective_balance_increment as u128; let effective_balance = validator.effective_balance as u128; let penalty_numerator = effective_balance - .safe_div(increment as u128)? + .safe_div(increment)? .safe_mul(adjusted_total_slashing_balance)?; let penalty = penalty_numerator .safe_div(total_balance)? - .safe_mul(increment as u128)?; + .safe_mul(increment)?; // Equivalent to `decrease_balance(state, index, penalty)`, but avoids borrowing `state`. let balance = balances