From 90ee50fbf37b1fcf543d3528786dfdb77e4808fe Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Wed, 14 Feb 2024 13:02:51 +1100 Subject: [PATCH] inline inactivity_penalty_quotient_for_state --- beacon_node/beacon_chain/src/attestation_rewards.rs | 6 +++--- consensus/types/src/chain_spec.rs | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/beacon_node/beacon_chain/src/attestation_rewards.rs b/beacon_node/beacon_chain/src/attestation_rewards.rs index e86c10a146b..25f05b32ff4 100644 --- a/beacon_node/beacon_chain/src/attestation_rewards.rs +++ b/beacon_node/beacon_chain/src/attestation_rewards.rs @@ -246,9 +246,9 @@ impl BeaconChain { let penalty_numerator = effective_balance .safe_mul(state.get_inactivity_score(validator_index)?)?; - let penalty_denominator = spec - .inactivity_score_bias - .safe_mul(spec.inactivity_penalty_quotient_for_state(&state))?; + let penalty_denominator = spec.inactivity_score_bias.safe_mul( + spec.inactivity_penalty_quotient_for_fork(state.fork_name_unchecked()), + )?; inactivity_penalty = -(penalty_numerator.safe_div(penalty_denominator)? as i64); } else if flag_index == TIMELY_SOURCE_FLAG_INDEX { diff --git a/consensus/types/src/chain_spec.rs b/consensus/types/src/chain_spec.rs index 44846402ba3..df305efc688 100644 --- a/consensus/types/src/chain_spec.rs +++ b/consensus/types/src/chain_spec.rs @@ -319,12 +319,6 @@ impl ChainSpec { } } - /// For a given `BeaconState`, return the inactivity penalty quotient associated with its variant. - // FIXME(sproul): delete once unused - pub fn inactivity_penalty_quotient_for_state(&self, state: &BeaconState) -> u64 { - self.inactivity_penalty_quotient_for_fork(state.fork_name_unchecked()) - } - pub fn inactivity_penalty_quotient_for_fork(&self, fork_name: ForkName) -> u64 { match fork_name { ForkName::Base => self.inactivity_penalty_quotient,