Merge branch 'unstable' into electra-alpha7

This commit is contained in:
Pawan Dhananjay
2024-11-20 15:59:06 -08:00
162 changed files with 6474 additions and 3188 deletions

View File

@@ -1,6 +1,6 @@
/// A collection of all functions that mutates the `ProgressiveBalancesCache`.
use crate::metrics::{
PARTICIPATION_CURR_EPOCH_TARGET_ATTESTING_GWEI_PROGRESSIVE_TOTAL,
self, PARTICIPATION_CURR_EPOCH_TARGET_ATTESTING_GWEI_PROGRESSIVE_TOTAL,
PARTICIPATION_PREV_EPOCH_TARGET_ATTESTING_GWEI_PROGRESSIVE_TOTAL,
};
use crate::{BlockProcessingError, EpochProcessingError};
@@ -21,6 +21,8 @@ pub fn initialize_progressive_balances_cache<E: EthSpec>(
return Ok(());
}
let _timer = metrics::start_timer(&metrics::BUILD_PROGRESSIVE_BALANCES_CACHE_TIME);
// Calculate the total flag balances for previous & current epoch in a single iteration.
// This calculates `get_total_balance(unslashed_participating_indices(..))` for each flag in
// the current and previous epoch.

View File

@@ -1,6 +1,7 @@
use crate::common::altair::BaseRewardPerIncrement;
use crate::common::base::SqrtTotalActiveBalance;
use crate::common::{altair, base};
use crate::metrics;
use safe_arith::SafeArith;
use types::epoch_cache::{EpochCache, EpochCacheError, EpochCacheKey};
use types::{
@@ -138,6 +139,8 @@ pub fn initialize_epoch_cache<E: EthSpec>(
return Ok(());
}
let _timer = metrics::start_timer(&metrics::BUILD_EPOCH_CACHE_TIME);
let current_epoch = state.current_epoch();
let next_epoch = state.next_epoch().map_err(EpochCacheError::BeaconState)?;
let decision_block_root = state

View File

@@ -41,6 +41,20 @@ pub static PROCESS_EPOCH_TIME: LazyLock<Result<Histogram>> = LazyLock::new(|| {
"Time required for process_epoch",
)
});
pub static BUILD_EPOCH_CACHE_TIME: LazyLock<Result<Histogram>> = LazyLock::new(|| {
try_create_histogram(
"beacon_state_processing_epoch_cache",
"Time required to build the epoch cache",
)
});
pub static BUILD_PROGRESSIVE_BALANCES_CACHE_TIME: LazyLock<Result<Histogram>> =
LazyLock::new(|| {
try_create_histogram(
"beacon_state_processing_progressive_balances_cache",
"Time required to build the progressive balances cache",
)
});
/*
* Participation Metrics (progressive balances)
*/