Skip to content

Commit

Permalink
Implement process_epoch. Remove unnessesary const generics from `pr…
Browse files Browse the repository at this point in the history
…ocess_pending_consolidations`
  • Loading branch information
EchoAlice committed May 6, 2024
1 parent f949c62 commit 0502f08
Showing 1 changed file with 57 additions and 3 deletions.
60 changes: 57 additions & 3 deletions ethereum-consensus/src/electra/epoch_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,63 @@ use crate::electra::{
get_activation_exit_churn_limit, get_active_balance, initiate_validator_exit,
is_eligible_for_activation_queue, switch_to_compounding_validator,
},
increase_balance, is_active_validator, is_eligible_for_activation, BeaconState, Context, Error,
increase_balance, is_active_validator, is_eligible_for_activation,
process_effective_balance_updates, process_eth1_data_reset,
process_historical_summaries_update, process_inactivity_updates,
process_justification_and_finalization, process_participation_flag_updates,
process_randao_mixes_reset, process_rewards_and_penalties, process_slashings,
process_slashings_reset, process_sync_committee_updates, BeaconState, Context, Error,
};

pub fn process_epoch<
const SLOTS_PER_HISTORICAL_ROOT: usize,
const HISTORICAL_ROOTS_LIMIT: usize,
const ETH1_DATA_VOTES_BOUND: usize,
const VALIDATOR_REGISTRY_LIMIT: usize,
const EPOCHS_PER_HISTORICAL_VECTOR: usize,
const EPOCHS_PER_SLASHINGS_VECTOR: usize,
const MAX_VALIDATORS_PER_COMMITTEE: usize,
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
const PENDING_BALANCE_DEPOSITS_LIMIT: usize,
const PENDING_PARTIAL_WITHDRAWALS_LIMIT: usize,
const PENDING_CONSOLIDATIONS_LIMIT: usize,
>(
state: &mut BeaconState<
SLOTS_PER_HISTORICAL_ROOT,
HISTORICAL_ROOTS_LIMIT,
ETH1_DATA_VOTES_BOUND,
VALIDATOR_REGISTRY_LIMIT,
EPOCHS_PER_HISTORICAL_VECTOR,
EPOCHS_PER_SLASHINGS_VECTOR,
MAX_VALIDATORS_PER_COMMITTEE,
SYNC_COMMITTEE_SIZE,
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
PENDING_BALANCE_DEPOSITS_LIMIT,
PENDING_PARTIAL_WITHDRAWALS_LIMIT,
PENDING_CONSOLIDATIONS_LIMIT,
>,
context: &Context,
) -> Result<(), Error> {
process_justification_and_finalization(state, context)?;
process_inactivity_updates(state, context)?;
process_rewards_and_penalties(state, context)?;
process_registry_updates(state, context)?;
process_slashings(state, context)?;
process_eth1_data_reset(state, context);
process_pending_balance_deposits(state, context)?;
process_pending_consolidations(state, context)?;
process_effective_balance_updates(state, context);
process_slashings_reset(state, context);
process_randao_mixes_reset(state, context);
process_historical_summaries_update(state, context)?;
process_participation_flag_updates(state)?;
process_sync_committee_updates(state, context)?;
Ok(())
}

pub fn process_registry_updates<
const SLOTS_PER_HISTORICAL_ROOT: usize,
const HISTORICAL_ROOTS_LIMIT: usize,
Expand Down Expand Up @@ -138,8 +192,8 @@ pub fn process_pending_consolidations<
const PENDING_BALANCE_DEPOSITS_LIMIT: usize,
const PENDING_PARTIAL_WITHDRAWALS_LIMIT: usize,
const PENDING_CONSOLIDATIONS_LIMIT: usize,
const MAX_VALIDATORS_PER_SLOT: usize,
const MAX_COMMITTEES_PER_SLOT: usize,
// const MAX_VALIDATORS_PER_SLOT: usize,
// const MAX_COMMITTEES_PER_SLOT: usize,
>(
state: &mut BeaconState<
SLOTS_PER_HISTORICAL_ROOT,
Expand Down

0 comments on commit 0502f08

Please sign in to comment.