mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
Merge branch 'eip4844' into deneb-free-blobs
This commit is contained in:
@@ -4,6 +4,7 @@ use crate::attestation_verification::{
|
||||
VerifiedUnaggregatedAttestation,
|
||||
};
|
||||
use crate::attester_cache::{AttesterCache, AttesterCacheKey};
|
||||
use crate::beacon_block_streamer::{BeaconBlockStreamer, CheckEarlyAttesterCache};
|
||||
use crate::beacon_proposer_cache::compute_proposer_duties_from_head;
|
||||
use crate::beacon_proposer_cache::BeaconProposerCache;
|
||||
use crate::blob_cache::BlobCache;
|
||||
@@ -76,7 +77,7 @@ use itertools::Itertools;
|
||||
use kzg::Kzg;
|
||||
use operation_pool::{AttestationRef, OperationPool, PersistedOperationPool, ReceivedPreCapella};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use proto_array::{CountUnrealizedFull, DoNotReOrg, ProposerHeadError};
|
||||
use proto_array::{DoNotReOrg, ProposerHeadError};
|
||||
use safe_arith::SafeArith;
|
||||
use slasher::Slasher;
|
||||
use slog::{crit, debug, error, info, trace, warn, Logger};
|
||||
@@ -106,6 +107,7 @@ use store::{
|
||||
DatabaseBlock, Error as DBError, HotColdDB, KeyValueStore, KeyValueStoreOp, StoreItem, StoreOp,
|
||||
};
|
||||
use task_executor::{ShutdownReason, TaskExecutor};
|
||||
use tokio_stream::Stream;
|
||||
use tree_hash::TreeHash;
|
||||
use types::beacon_state::CloneConfig;
|
||||
use types::blobs_sidecar::KzgCommitments;
|
||||
@@ -485,7 +487,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
pub fn load_fork_choice(
|
||||
store: BeaconStore<T>,
|
||||
reset_payload_statuses: ResetPayloadStatuses,
|
||||
count_unrealized_full: CountUnrealizedFull,
|
||||
spec: &ChainSpec,
|
||||
log: &Logger,
|
||||
) -> Result<Option<BeaconForkChoice<T>>, Error> {
|
||||
@@ -502,7 +503,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
persisted_fork_choice.fork_choice,
|
||||
reset_payload_statuses,
|
||||
fc_store,
|
||||
count_unrealized_full,
|
||||
spec,
|
||||
log,
|
||||
)?))
|
||||
@@ -949,14 +949,42 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
/// ## Errors
|
||||
///
|
||||
/// May return a database error.
|
||||
pub async fn get_block_checking_early_attester_cache(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
) -> Result<Option<Arc<SignedBeaconBlock<T::EthSpec>>>, Error> {
|
||||
if let Some(block) = self.early_attester_cache.get_block(*block_root) {
|
||||
return Ok(Some(block));
|
||||
}
|
||||
Ok(self.get_block(block_root).await?.map(Arc::new))
|
||||
pub fn get_blocks_checking_early_attester_cache(
|
||||
self: &Arc<Self>,
|
||||
block_roots: Vec<Hash256>,
|
||||
executor: &TaskExecutor,
|
||||
) -> Result<
|
||||
impl Stream<
|
||||
Item = (
|
||||
Hash256,
|
||||
Arc<Result<Option<Arc<SignedBeaconBlock<T::EthSpec>>>, Error>>,
|
||||
),
|
||||
>,
|
||||
Error,
|
||||
> {
|
||||
Ok(
|
||||
BeaconBlockStreamer::<T>::new(self, CheckEarlyAttesterCache::Yes)?
|
||||
.launch_stream(block_roots, executor),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_blocks(
|
||||
self: &Arc<Self>,
|
||||
block_roots: Vec<Hash256>,
|
||||
executor: &TaskExecutor,
|
||||
) -> Result<
|
||||
impl Stream<
|
||||
Item = (
|
||||
Hash256,
|
||||
Arc<Result<Option<Arc<SignedBeaconBlock<T::EthSpec>>>, Error>>,
|
||||
),
|
||||
>,
|
||||
Error,
|
||||
> {
|
||||
Ok(
|
||||
BeaconBlockStreamer::<T>::new(self, CheckEarlyAttesterCache::No)?
|
||||
.launch_stream(block_roots, executor),
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn get_blobs_checking_early_attester_cache(
|
||||
@@ -1944,7 +1972,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
self.slot()?,
|
||||
verified.indexed_attestation(),
|
||||
AttestationFromBlock::False,
|
||||
&self.spec,
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
@@ -2911,7 +2938,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
&state,
|
||||
payload_verification_status,
|
||||
&self.spec,
|
||||
count_unrealized.and(self.config.count_unrealized.into()),
|
||||
count_unrealized,
|
||||
)
|
||||
.map_err(|e| BlockError::BeaconChainError(e.into()))?;
|
||||
}
|
||||
@@ -3054,7 +3081,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
ResetPayloadStatuses::always_reset_conditionally(
|
||||
self.config.always_reset_payload_statuses,
|
||||
),
|
||||
self.config.count_unrealized_full,
|
||||
&self.store,
|
||||
&self.spec,
|
||||
&self.log,
|
||||
|
||||
Reference in New Issue
Block a user