Skip to content

Commit 7516afe

Browse files
committed
lint
1 parent ebb2b1d commit 7516afe

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,7 +2892,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
28922892
}
28932893

28942894
self.data_availability_checker
2895-
.notify_gossip_blob(blob.slot(), block_root, &blob);
2895+
.notify_gossip_blob(block_root, &blob);
28962896
let r = self.check_gossip_blob_availability_and_import(blob).await;
28972897
self.remove_notified(&block_root, r)
28982898
}
@@ -2926,7 +2926,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
29262926
}
29272927

29282928
self.data_availability_checker
2929-
.notify_rpc_blobs(slot, block_root, &blobs);
2929+
.notify_rpc_blobs(block_root, &blobs);
29302930
let r = self
29312931
.check_rpc_blob_availability_and_import(slot, block_root, blobs)
29322932
.await;

beacon_node/beacon_chain/src/data_availability_checker.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::sync::Arc;
2222
use task_executor::TaskExecutor;
2323
use types::beacon_block_body::KzgCommitmentOpts;
2424
use types::blob_sidecar::{BlobIdentifier, BlobSidecar, FixedBlobSidecarList};
25-
use types::{BlobSidecarList, ChainSpec, Epoch, EthSpec, Hash256, SignedBeaconBlock, Slot};
25+
use types::{BlobSidecarList, ChainSpec, Epoch, EthSpec, Hash256, SignedBeaconBlock};
2626

2727
mod availability_view;
2828
mod child_components;
@@ -356,41 +356,30 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
356356
/// them here is useful to avoid duplicate downloads of blocks, as well as understanding
357357
/// our blob download requirements. We will also serve this over RPC.
358358
pub fn notify_block(&self, block_root: Hash256, block: Arc<SignedBeaconBlock<T::EthSpec>>) {
359-
let slot = block.slot();
360359
self.processing_cache
361360
.write()
362361
.entry(block_root)
363-
.or_insert_with(|| ProcessingComponents::new(slot))
362+
.or_default()
364363
.merge_block(block);
365364
}
366365

367366
/// Add a single blob commitment to the processing cache. This commitment is unverified but caching
368367
/// them here is useful to avoid duplicate downloads of blobs, as well as understanding
369368
/// our block and blob download requirements.
370-
pub fn notify_gossip_blob(
371-
&self,
372-
slot: Slot,
373-
block_root: Hash256,
374-
blob: &GossipVerifiedBlob<T>,
375-
) {
369+
pub fn notify_gossip_blob(&self, block_root: Hash256, blob: &GossipVerifiedBlob<T>) {
376370
let index = blob.index();
377371
let commitment = blob.kzg_commitment();
378372
self.processing_cache
379373
.write()
380374
.entry(block_root)
381-
.or_insert_with(|| ProcessingComponents::new(slot))
375+
.or_default()
382376
.merge_single_blob(index as usize, commitment);
383377
}
384378

385379
/// Adds blob commitments to the processing cache. These commitments are unverified but caching
386380
/// them here is useful to avoid duplicate downloads of blobs, as well as understanding
387381
/// our block and blob download requirements.
388-
pub fn notify_rpc_blobs(
389-
&self,
390-
slot: Slot,
391-
block_root: Hash256,
392-
blobs: &FixedBlobSidecarList<T::EthSpec>,
393-
) {
382+
pub fn notify_rpc_blobs(&self, block_root: Hash256, blobs: &FixedBlobSidecarList<T::EthSpec>) {
394383
let mut commitments = KzgCommitmentOpts::<T::EthSpec>::default();
395384
for blob in blobs.iter().flatten() {
396385
if let Some(commitment) = commitments.get_mut(blob.index as usize) {
@@ -400,7 +389,7 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
400389
self.processing_cache
401390
.write()
402391
.entry(block_root)
403-
.or_insert_with(|| ProcessingComponents::new(slot))
392+
.or_default()
404393
.merge_blobs(commitments);
405394
}
406395

beacon_node/beacon_chain/src/data_availability_checker/processing_cache.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::collections::hash_map::Entry;
33
use std::collections::HashMap;
44
use std::sync::Arc;
55
use types::beacon_block_body::KzgCommitmentOpts;
6-
use types::{EthSpec, Hash256, SignedBeaconBlock, Slot};
6+
use types::{EthSpec, Hash256, SignedBeaconBlock};
77

88
/// This cache is used only for gossip blocks/blobs and single block/blob lookups, to give req/resp
99
/// a view of what we have and what we require. This cache serves a slightly different purpose than
@@ -34,9 +34,8 @@ impl<E: EthSpec> ProcessingCache<E> {
3434
}
3535
}
3636

37-
#[derive(Debug, Clone)]
37+
#[derive(Default, Debug, Clone)]
3838
pub struct ProcessingComponents<E: EthSpec> {
39-
slot: Slot,
4039
/// Blobs required for a block can only be known if we have seen the block. So `Some` here
4140
/// means we've seen it, a `None` means we haven't. The `kzg_commitments` value helps us figure
4241
/// out whether incoming blobs actually match the block.
@@ -47,12 +46,8 @@ pub struct ProcessingComponents<E: EthSpec> {
4746
}
4847

4948
impl<E: EthSpec> ProcessingComponents<E> {
50-
pub fn new(slot: Slot) -> Self {
51-
Self {
52-
slot,
53-
block: None,
54-
blob_commitments: KzgCommitmentOpts::<E>::default(),
55-
}
49+
pub fn new() -> Self {
50+
Self::default()
5651
}
5752
}
5853

@@ -61,7 +56,6 @@ impl<E: EthSpec> ProcessingComponents<E> {
6156
impl<E: EthSpec> ProcessingComponents<E> {
6257
pub fn empty(_block_root: Hash256) -> Self {
6358
Self {
64-
slot: Slot::new(0),
6559
block: None,
6660
blob_commitments: KzgCommitmentOpts::<E>::default(),
6761
}

0 commit comments

Comments
 (0)