Skip to content

Commit

Permalink
Publish block without waiting for blob and column proof computation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmygchen committed Oct 18, 2024
1 parent a65030b commit 63427e9
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 249 deletions.
8 changes: 2 additions & 6 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2977,7 +2977,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
pub async fn process_gossip_blob(
self: &Arc<Self>,
blob: GossipVerifiedBlob<T>,
publish_fn: impl FnOnce() -> Result<(), BlockError>,
) -> Result<AvailabilityProcessingStatus, BlockError> {
let block_root = blob.block_root();

Expand All @@ -2998,9 +2997,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {

self.emit_sse_blob_sidecar_events(&block_root, std::iter::once(blob.as_blob()));

let r = self
.check_gossip_blob_availability_and_import(blob, publish_fn)
.await;
let r = self.check_gossip_blob_availability_and_import(blob).await;
self.remove_notified(&block_root, r)
}

Expand Down Expand Up @@ -3488,15 +3485,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
async fn check_gossip_blob_availability_and_import(
self: &Arc<Self>,
blob: GossipVerifiedBlob<T>,
publish_fn: impl FnOnce() -> Result<(), BlockError>,
) -> Result<AvailabilityProcessingStatus, BlockError> {
let slot = blob.slot();
if let Some(slasher) = self.slasher.as_ref() {
slasher.accept_block_header(blob.signed_block_header());
}
let availability = self.data_availability_checker.put_gossip_blob(blob)?;

self.process_availability(slot, availability, None, publish_fn)
self.process_availability(slot, availability, None, || Ok(()))
.await
}

Expand Down
6 changes: 0 additions & 6 deletions beacon_node/beacon_chain/src/blob_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::{metrics, BeaconChainError};
use kzg::{Error as KzgError, Kzg, KzgCommitment};
use slog::debug;
use ssz_derive::{Decode, Encode};
use ssz_types::VariableList;
use std::time::Duration;
use tree_hash::TreeHash;
use types::blob_sidecar::BlobIdentifier;
Expand Down Expand Up @@ -156,11 +155,6 @@ impl From<BeaconStateError> for GossipBlobError {
}
}

pub type GossipVerifiedBlobList<T> = VariableList<
GossipVerifiedBlob<T>,
<<T as BeaconChainTypes>::EthSpec as EthSpec>::MaxBlobsPerBlock,
>;

/// A wrapper around a `BlobSidecar` that indicates it has been approved for re-gossiping on
/// the p2p network.
#[derive(Debug)]
Expand Down
2 changes: 0 additions & 2 deletions beacon_node/beacon_chain/src/data_column_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ impl From<BeaconStateError> for GossipDataColumnError {
}
}

pub type GossipVerifiedDataColumnList<T> = RuntimeVariableList<GossipVerifiedDataColumn<T>>;

/// A wrapper around a `DataColumnSidecar` that indicates it has been approved for re-gossiping on
/// the p2p network.
#[derive(Debug)]
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/tests/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ async fn block_gossip_verification() {

harness
.chain
.process_gossip_blob(gossip_verified, || Ok(()))
.process_gossip_blob(gossip_verified)
.await
.expect("should import valid gossip verified blob");
}
Expand Down Expand Up @@ -1247,7 +1247,7 @@ async fn verify_block_for_gossip_slashing_detection() {
.unwrap();
harness
.chain
.process_gossip_blob(verified_blob, || Ok(()))
.process_gossip_blob(verified_blob)
.await
.unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/tests/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async fn blob_sidecar_event_on_process_gossip_blob() {

let _ = harness
.chain
.process_gossip_blob(gossip_verified_blob, || Ok(()))
.process_gossip_blob(gossip_verified_blob)
.await
.unwrap();

Expand Down
Loading

0 comments on commit 63427e9

Please sign in to comment.