mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
Merge remote-tracking branch 'upstream/unstable' into gloas-containers
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
use crate::common::update_progressive_balances_cache::initialize_progressive_balances_cache;
|
||||
use crate::epoch_cache::initialize_epoch_cache;
|
||||
use types::{
|
||||
BeaconState, ChainSpec, EpochCacheError, EthSpec, FixedBytesExtended, Hash256, RelativeEpoch,
|
||||
};
|
||||
use tracing::instrument;
|
||||
use types::{BeaconState, ChainSpec, EpochCacheError, EthSpec, Hash256, RelativeEpoch};
|
||||
|
||||
/// Mixin trait for the beacon state that provides operations on *all* caches.
|
||||
///
|
||||
@@ -23,6 +22,7 @@ pub trait AllCaches {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> AllCaches for BeaconState<E> {
|
||||
#[instrument(skip_all)]
|
||||
fn build_all_caches(&mut self, spec: &ChainSpec) -> Result<(), EpochCacheError> {
|
||||
self.build_caches(spec)?;
|
||||
initialize_epoch_cache(self, spec)?;
|
||||
@@ -32,8 +32,7 @@ impl<E: EthSpec> AllCaches for BeaconState<E> {
|
||||
|
||||
fn all_caches_built(&self) -> bool {
|
||||
let current_epoch = self.current_epoch();
|
||||
let Ok(epoch_cache_decision_block_root) =
|
||||
self.proposer_shuffling_decision_root(Hash256::zero())
|
||||
let Ok(epoch_cache_decision_block_root) = self.epoch_cache_decision_root(Hash256::ZERO)
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -123,7 +123,7 @@ pub fn is_epoch_cache_initialized<E: EthSpec>(
|
||||
let current_epoch = state.current_epoch();
|
||||
let epoch_cache: &EpochCache = state.epoch_cache();
|
||||
let decision_block_root = state
|
||||
.proposer_shuffling_decision_root(Hash256::zero())
|
||||
.epoch_cache_decision_root(Hash256::zero())
|
||||
.map_err(EpochCacheError::BeaconState)?;
|
||||
|
||||
Ok(epoch_cache
|
||||
@@ -146,7 +146,7 @@ pub fn initialize_epoch_cache<E: EthSpec>(
|
||||
let current_epoch = state.current_epoch();
|
||||
let next_epoch = state.next_epoch().map_err(EpochCacheError::BeaconState)?;
|
||||
let decision_block_root = state
|
||||
.proposer_shuffling_decision_root(Hash256::zero())
|
||||
.epoch_cache_decision_root(Hash256::zero())
|
||||
.map_err(EpochCacheError::BeaconState)?;
|
||||
|
||||
state.build_total_active_balance_cache(spec)?;
|
||||
|
||||
@@ -26,7 +26,7 @@ impl From<ArithError> for Error {
|
||||
/// If the root of the supplied `state` is known, then it can be passed as `state_root`. If
|
||||
/// `state_root` is `None`, the root of `state` will be computed using a cached tree hash.
|
||||
/// Providing the `state_root` makes this function several orders of magnitude faster.
|
||||
#[instrument(skip_all)]
|
||||
#[instrument(level = "debug", skip_all)]
|
||||
pub fn per_slot_processing<E: EthSpec>(
|
||||
state: &mut BeaconState<E>,
|
||||
state_root: Option<Hash256>,
|
||||
|
||||
@@ -33,9 +33,7 @@ fn initialize_proposer_lookahead<E: EthSpec>(
|
||||
);
|
||||
}
|
||||
|
||||
Vector::new(lookahead).map_err(|e| {
|
||||
Error::PleaseNotifyTheDevs(format!("Failed to initialize proposer lookahead: {:?}", e))
|
||||
})
|
||||
Vector::new(lookahead).map_err(|e| e.into())
|
||||
}
|
||||
|
||||
pub fn upgrade_state_to_fulu<E: EthSpec>(
|
||||
|
||||
Reference in New Issue
Block a user