mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 08:52:54 +00:00
Merge remote-tracking branch 'sigp/epoch-single-pass' into tree-states
This commit is contained in:
@@ -115,7 +115,6 @@ pub enum Error {
|
||||
SszTypesError(ssz_types::Error),
|
||||
TreeHashCacheNotInitialized,
|
||||
NonLinearTreeHashCacheHistory,
|
||||
ParticipationCacheError(String),
|
||||
ProgressiveBalancesCacheNotInitialized,
|
||||
ProgressiveBalancesCacheInconsistent,
|
||||
TreeHashCacheSkippedSlot {
|
||||
@@ -1593,7 +1592,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
))
|
||||
}
|
||||
|
||||
pub fn compute_total_active_balance(
|
||||
pub fn compute_total_active_balance_slow(
|
||||
&self,
|
||||
epoch: Epoch,
|
||||
spec: &ChainSpec,
|
||||
@@ -1661,7 +1660,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
epoch: Epoch,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
let total_active_balance = self.compute_total_active_balance(epoch, spec)?;
|
||||
let total_active_balance = self.compute_total_active_balance_slow(epoch, spec)?;
|
||||
*self.total_active_balance_mut() = Some((epoch, total_active_balance));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ impl ProgressiveBalancesCache {
|
||||
}
|
||||
}
|
||||
|
||||
/// `ProgressiveBalancesCache` is only enabled from `Altair` as it requires `ParticipationCache`.
|
||||
/// `ProgressiveBalancesCache` is only enabled from `Altair` as it uses Altair-specific logic.
|
||||
pub fn is_progressive_balances_enabled<E: EthSpec>(state: &BeaconState<E>) -> bool {
|
||||
match state {
|
||||
BeaconState::Base(_) => false,
|
||||
|
||||
@@ -3,6 +3,7 @@ use rpds::HashTrieMapSync as HashTrieMap;
|
||||
|
||||
type ValidatorIndex = usize;
|
||||
|
||||
#[allow(clippy::len_without_is_empty)]
|
||||
#[derive(Debug, PartialEq, Clone, Default)]
|
||||
pub struct PubkeyCache {
|
||||
/// Maintain the number of keys added to the map. It is not sufficient to just use the
|
||||
|
||||
@@ -326,12 +326,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,
|
||||
|
||||
Reference in New Issue
Block a user