mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 05:07:12 +00:00
Removes the remaining facade re-exports from `consensus/types`. I have left `graffiti` as I think it has some utility so am leaning towards keeping it in the final API design. Co-Authored-By: Mac L <mjladson@pm.me>
38 lines
999 B
Rust
38 lines
999 B
Rust
use super::errors::EpochProcessingError;
|
|
use milhouse::List;
|
|
use safe_arith::SafeArith;
|
|
use typenum::Unsigned;
|
|
use types::core::EthSpec;
|
|
use types::state::BeaconState;
|
|
|
|
pub fn process_eth1_data_reset<E: EthSpec>(
|
|
state: &mut BeaconState<E>,
|
|
) -> Result<(), EpochProcessingError> {
|
|
if state
|
|
.slot()
|
|
.safe_add(1)?
|
|
.safe_rem(E::SlotsPerEth1VotingPeriod::to_u64())?
|
|
== 0
|
|
{
|
|
*state.eth1_data_votes_mut() = List::empty();
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
pub fn process_slashings_reset<E: EthSpec>(
|
|
state: &mut BeaconState<E>,
|
|
) -> Result<(), EpochProcessingError> {
|
|
let next_epoch = state.next_epoch()?;
|
|
state.set_slashings(next_epoch, 0)?;
|
|
Ok(())
|
|
}
|
|
|
|
pub fn process_randao_mixes_reset<E: EthSpec>(
|
|
state: &mut BeaconState<E>,
|
|
) -> Result<(), EpochProcessingError> {
|
|
let current_epoch = state.current_epoch();
|
|
let next_epoch = state.next_epoch()?;
|
|
state.set_randao_mix(next_epoch, *state.get_randao_mix(current_epoch)?)?;
|
|
Ok(())
|
|
}
|