mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 19:02:42 +00:00
Remove state dependency from core module in consensus/types (#8653)
#8652 - This removes instances of `BeaconStateError` from `eth_spec.rs`, and replaces them directly with `ArithError` which can be trivially converted back to `BeaconStateError` at the call site. - Also moves the state related methods on `ChainSpec` to be methods on `BeaconState` instead. I think this might be a more natural place for them to exist anyway. Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
@@ -886,7 +886,7 @@ impl SlashingsContext {
|
||||
) -> Result<Self, Error> {
|
||||
let sum_slashings = state.get_all_slashings().iter().copied().safe_sum()?;
|
||||
let adjusted_total_slashing_balance = min(
|
||||
sum_slashings.safe_mul(spec.proportional_slashing_multiplier_for_state(state))?,
|
||||
sum_slashings.safe_mul(state.get_proportional_slashing_multiplier(spec))?,
|
||||
state_ctxt.total_active_balance,
|
||||
);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ pub fn process_slashings<E: EthSpec>(
|
||||
let sum_slashings = state.get_all_slashings().iter().copied().safe_sum()?;
|
||||
|
||||
let adjusted_total_slashing_balance = std::cmp::min(
|
||||
sum_slashings.safe_mul(spec.proportional_slashing_multiplier_for_state(state))?,
|
||||
sum_slashings.safe_mul(state.get_proportional_slashing_multiplier(spec))?,
|
||||
total_balance,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user