Skip to content

Commit

Permalink
inline inactivity_penalty_quotient_for_state
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Feb 14, 2024
1 parent 10e7fe4 commit 90ee50f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions beacon_node/beacon_chain/src/attestation_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {

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 {
Expand Down
6 changes: 0 additions & 6 deletions consensus/types/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: EthSpec>(&self, state: &BeaconState<T>) -> 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,
Expand Down

0 comments on commit 90ee50f

Please sign in to comment.