diff --git a/consensus/state_processing/src/per_block_processing.rs b/consensus/state_processing/src/per_block_processing.rs index e7655b453a8..f289b6e0817 100644 --- a/consensus/state_processing/src/per_block_processing.rs +++ b/consensus/state_processing/src/per_block_processing.rs @@ -579,8 +579,7 @@ pub fn get_expected_withdrawals( .get_execution_withdrawal_address(spec) .ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?, amount: balance.safe_sub( - validator - .get_validator_max_effective_balance(spec, state.fork_name_unchecked()), + validator.get_max_effective_balance(spec, state.fork_name_unchecked()), )?, }); withdrawal_index.safe_add_assign(1)?; diff --git a/consensus/state_processing/src/per_epoch_processing/single_pass.rs b/consensus/state_processing/src/per_epoch_processing/single_pass.rs index 2f48cb5b25e..b41fefe5194 100644 --- a/consensus/state_processing/src/per_epoch_processing/single_pass.rs +++ b/consensus/state_processing/src/per_epoch_processing/single_pass.rs @@ -1027,8 +1027,7 @@ fn process_single_effective_balance_update( ) -> Result<(), Error> { // Use the higher effective balance limit if post-Electra and compounding withdrawal credentials // are set. - let effective_balance_limit = - validator.get_validator_max_effective_balance(spec, state_ctxt.fork_name); + let effective_balance_limit = validator.get_max_effective_balance(spec, state_ctxt.fork_name); let old_effective_balance = validator.effective_balance; let new_effective_balance = if balance.safe_add(eb_ctxt.downward_threshold)? diff --git a/consensus/types/src/beacon_state.rs b/consensus/types/src/beacon_state.rs index a08f6d720c7..8eed790a02b 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -2131,7 +2131,7 @@ impl BeaconState { let max_effective_balance = self .validators() .get(validator_index) - .map(|validator| validator.get_validator_max_effective_balance(spec, current_fork)) + .map(|validator| validator.get_max_effective_balance(spec, current_fork)) .ok_or(Error::UnknownValidator(validator_index))?; Ok(std::cmp::min( *self diff --git a/consensus/types/src/validator.rs b/consensus/types/src/validator.rs index 3c6037e23e3..298604d4f3e 100644 --- a/consensus/types/src/validator.rs +++ b/consensus/types/src/validator.rs @@ -236,7 +236,7 @@ impl Validator { spec: &ChainSpec, current_fork: ForkName, ) -> bool { - let max_effective_balance = self.get_validator_max_effective_balance(spec, current_fork); + let max_effective_balance = self.get_max_effective_balance(spec, current_fork); let has_max_effective_balance = self.effective_balance == max_effective_balance; let has_excess_balance = balance > max_effective_balance; self.has_execution_withdrawal_credential(spec) @@ -251,11 +251,7 @@ impl Validator { } /// Returns the max effective balance for a validator in gwei. - pub fn get_validator_max_effective_balance( - &self, - spec: &ChainSpec, - current_fork: ForkName, - ) -> u64 { + pub fn get_max_effective_balance(&self, spec: &ChainSpec, current_fork: ForkName) -> u64 { if current_fork >= ForkName::Electra { if self.has_compounding_withdrawal_credential(spec) { spec.max_effective_balance_electra @@ -273,7 +269,7 @@ impl Validator { spec: &ChainSpec, current_fork: ForkName, ) -> u64 { - let max_effective_balance = self.get_validator_max_effective_balance(spec, current_fork); + let max_effective_balance = self.get_max_effective_balance(spec, current_fork); std::cmp::min(validator_balance, max_effective_balance) } }