Delete unused incomplete_processing_components (#5418)
* Delete unused incomplete_processing_components * lint
This commit is contained in:
parent
332e1bb9e6
commit
306d3eb0eb
@ -2891,7 +2891,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
self.data_availability_checker
|
||||
.notify_gossip_blob(blob.slot(), block_root, &blob);
|
||||
.notify_gossip_blob(block_root, &blob);
|
||||
let r = self.check_gossip_blob_availability_and_import(blob).await;
|
||||
self.remove_notified(&block_root, r)
|
||||
}
|
||||
@ -2925,7 +2925,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
self.data_availability_checker
|
||||
.notify_rpc_blobs(slot, block_root, &blobs);
|
||||
.notify_rpc_blobs(block_root, &blobs);
|
||||
let r = self
|
||||
.check_rpc_blob_availability_and_import(slot, block_root, blobs)
|
||||
.await;
|
||||
|
@ -22,7 +22,7 @@ use std::sync::Arc;
|
||||
use task_executor::TaskExecutor;
|
||||
use types::beacon_block_body::KzgCommitmentOpts;
|
||||
use types::blob_sidecar::{BlobIdentifier, BlobSidecar, FixedBlobSidecarList};
|
||||
use types::{BlobSidecarList, ChainSpec, Epoch, EthSpec, Hash256, SignedBeaconBlock, Slot};
|
||||
use types::{BlobSidecarList, ChainSpec, Epoch, EthSpec, Hash256, SignedBeaconBlock};
|
||||
|
||||
mod availability_view;
|
||||
mod child_components;
|
||||
@ -356,41 +356,30 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
|
||||
/// them here is useful to avoid duplicate downloads of blocks, as well as understanding
|
||||
/// our blob download requirements. We will also serve this over RPC.
|
||||
pub fn notify_block(&self, block_root: Hash256, block: Arc<SignedBeaconBlock<T::EthSpec>>) {
|
||||
let slot = block.slot();
|
||||
self.processing_cache
|
||||
.write()
|
||||
.entry(block_root)
|
||||
.or_insert_with(|| ProcessingComponents::new(slot))
|
||||
.or_default()
|
||||
.merge_block(block);
|
||||
}
|
||||
|
||||
/// Add a single blob commitment to the processing cache. This commitment is unverified but caching
|
||||
/// them here is useful to avoid duplicate downloads of blobs, as well as understanding
|
||||
/// our block and blob download requirements.
|
||||
pub fn notify_gossip_blob(
|
||||
&self,
|
||||
slot: Slot,
|
||||
block_root: Hash256,
|
||||
blob: &GossipVerifiedBlob<T>,
|
||||
) {
|
||||
pub fn notify_gossip_blob(&self, block_root: Hash256, blob: &GossipVerifiedBlob<T>) {
|
||||
let index = blob.index();
|
||||
let commitment = blob.kzg_commitment();
|
||||
self.processing_cache
|
||||
.write()
|
||||
.entry(block_root)
|
||||
.or_insert_with(|| ProcessingComponents::new(slot))
|
||||
.or_default()
|
||||
.merge_single_blob(index as usize, commitment);
|
||||
}
|
||||
|
||||
/// Adds blob commitments to the processing cache. These commitments are unverified but caching
|
||||
/// them here is useful to avoid duplicate downloads of blobs, as well as understanding
|
||||
/// our block and blob download requirements.
|
||||
pub fn notify_rpc_blobs(
|
||||
&self,
|
||||
slot: Slot,
|
||||
block_root: Hash256,
|
||||
blobs: &FixedBlobSidecarList<T::EthSpec>,
|
||||
) {
|
||||
pub fn notify_rpc_blobs(&self, block_root: Hash256, blobs: &FixedBlobSidecarList<T::EthSpec>) {
|
||||
let mut commitments = KzgCommitmentOpts::<T::EthSpec>::default();
|
||||
for blob in blobs.iter().flatten() {
|
||||
if let Some(commitment) = commitments.get_mut(blob.index as usize) {
|
||||
@ -400,7 +389,7 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
|
||||
self.processing_cache
|
||||
.write()
|
||||
.entry(block_root)
|
||||
.or_insert_with(|| ProcessingComponents::new(slot))
|
||||
.or_default()
|
||||
.merge_blobs(commitments);
|
||||
}
|
||||
|
||||
@ -409,14 +398,6 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
|
||||
self.processing_cache.write().remove(block_root)
|
||||
}
|
||||
|
||||
/// Gather all block roots for which we are not currently processing all components for the
|
||||
/// given slot.
|
||||
pub fn incomplete_processing_components(&self, slot: Slot) -> Vec<Hash256> {
|
||||
self.processing_cache
|
||||
.read()
|
||||
.incomplete_processing_components(slot)
|
||||
}
|
||||
|
||||
/// The epoch at which we require a data availability check in block processing.
|
||||
/// `None` if the `Deneb` fork is disabled.
|
||||
pub fn data_availability_boundary(&self) -> Option<Epoch> {
|
||||
|
@ -3,7 +3,7 @@ use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use types::beacon_block_body::KzgCommitmentOpts;
|
||||
use types::{EthSpec, Hash256, SignedBeaconBlock, Slot};
|
||||
use types::{EthSpec, Hash256, SignedBeaconBlock};
|
||||
|
||||
/// This cache is used only for gossip blocks/blobs and single block/blob lookups, to give req/resp
|
||||
/// a view of what we have and what we require. This cache serves a slightly different purpose than
|
||||
@ -29,23 +29,13 @@ impl<E: EthSpec> ProcessingCache<E> {
|
||||
.get(block_root)
|
||||
.map_or(false, |b| b.block_exists())
|
||||
}
|
||||
pub fn incomplete_processing_components(&self, slot: Slot) -> Vec<Hash256> {
|
||||
let mut roots_missing_components = vec![];
|
||||
for (&block_root, info) in self.processing_cache.iter() {
|
||||
if info.slot == slot && !info.is_available() {
|
||||
roots_missing_components.push(block_root);
|
||||
}
|
||||
}
|
||||
roots_missing_components
|
||||
}
|
||||
pub fn len(&self) -> usize {
|
||||
self.processing_cache.len()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct ProcessingComponents<E: EthSpec> {
|
||||
slot: Slot,
|
||||
/// Blobs required for a block can only be known if we have seen the block. So `Some` here
|
||||
/// means we've seen it, a `None` means we haven't. The `kzg_commitments` value helps us figure
|
||||
/// out whether incoming blobs actually match the block.
|
||||
@ -56,12 +46,8 @@ pub struct ProcessingComponents<E: EthSpec> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> ProcessingComponents<E> {
|
||||
pub fn new(slot: Slot) -> Self {
|
||||
Self {
|
||||
slot,
|
||||
block: None,
|
||||
blob_commitments: KzgCommitmentOpts::<E>::default(),
|
||||
}
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +56,6 @@ impl<E: EthSpec> ProcessingComponents<E> {
|
||||
impl<E: EthSpec> ProcessingComponents<E> {
|
||||
pub fn empty(_block_root: Hash256) -> Self {
|
||||
Self {
|
||||
slot: Slot::new(0),
|
||||
block: None,
|
||||
blob_commitments: KzgCommitmentOpts::<E>::default(),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user