Rename Functions to More Closely Match Spec (#5591)

* Rename Functions to More Closely Match Spec
This commit is contained in:
ethDreamer
2024-04-16 14:03:08 -05:00
committed by GitHub
parent f68989815c
commit cda926ce1b
6 changed files with 11 additions and 11 deletions

View File

@@ -26,7 +26,7 @@ pub fn initiate_validator_exit<E: EthSpec>(
.map_or(delayed_epoch, |epoch| max(epoch, delayed_epoch));
let exit_queue_churn = state.exit_cache().get_churn_at(exit_queue_epoch)?;
if exit_queue_churn >= state.get_churn_limit(spec)? {
if exit_queue_churn >= state.get_validator_churn_limit(spec)? {
exit_queue_epoch.safe_add_assign(1)?;
}

View File

@@ -1,5 +1,5 @@
use super::per_block_processing::{
errors::BlockProcessingError, process_operations::process_deposit,
errors::BlockProcessingError, process_operations::apply_deposit,
};
use crate::common::DepositDataTree;
use crate::upgrade::{
@@ -37,7 +37,7 @@ pub fn initialize_beacon_state_from_eth1<E: EthSpec>(
.push_leaf(deposit.data.tree_hash_root())
.map_err(BlockProcessingError::MerkleTreeError)?;
state.eth1_data_mut().deposit_root = deposit_tree.root();
process_deposit(&mut state, deposit, spec, true)?;
apply_deposit(&mut state, deposit, spec, true)?;
}
process_activations(&mut state, spec)?;

View File

@@ -371,14 +371,14 @@ pub fn process_deposits<E: EthSpec>(
// Update the state in series.
for deposit in deposits {
process_deposit(state, deposit, spec, false)?;
apply_deposit(state, deposit, spec, false)?;
}
Ok(())
}
/// Process a single deposit, optionally verifying its merkle proof.
pub fn process_deposit<E: EthSpec>(
pub fn apply_deposit<E: EthSpec>(
state: &mut BeaconState<E>,
deposit: &Deposit,
spec: &ChainSpec,

View File

@@ -120,7 +120,7 @@ pub fn process_epoch_single_pass<E: EthSpec>(
let next_epoch = state.next_epoch()?;
let is_in_inactivity_leak = state.is_in_inactivity_leak(previous_epoch, spec)?;
let total_active_balance = state.get_total_active_balance()?;
let churn_limit = state.get_churn_limit(spec)?;
let churn_limit = state.get_validator_churn_limit(spec)?;
let activation_churn_limit = state.get_activation_churn_limit(spec)?;
let finalized_checkpoint = state.finalized_checkpoint();
let fork_name = state.fork_name_unchecked();

View File

@@ -1444,7 +1444,7 @@ impl<E: EthSpec> BeaconState<E> {
/// Return the churn limit for the current epoch (number of validators who can leave per epoch).
///
/// Uses the current epoch committee cache, and will error if it isn't initialized.
pub fn get_churn_limit(&self, spec: &ChainSpec) -> Result<u64, Error> {
pub fn get_validator_churn_limit(&self, spec: &ChainSpec) -> Result<u64, Error> {
Ok(std::cmp::max(
spec.min_per_epoch_churn_limit,
(self
@@ -1462,10 +1462,10 @@ impl<E: EthSpec> BeaconState<E> {
BeaconState::Base(_)
| BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Capella(_) => self.get_churn_limit(spec)?,
| BeaconState::Capella(_) => self.get_validator_churn_limit(spec)?,
BeaconState::Deneb(_) | BeaconState::Electra(_) => std::cmp::min(
spec.max_per_epoch_activation_churn_limit,
self.get_churn_limit(spec)?,
self.get_validator_churn_limit(spec)?,
),
})
}