Skip to content

Commit

Permalink
Avoid computing columns from EL blobs if block has already been impor…
Browse files Browse the repository at this point in the history
…ted (#6816)

* Avoid computing columns from EL blobs if block has already been imported.

* Downgrade a `warn` log to `debug` and update handling.
  • Loading branch information
jimmygchen authored Jan 22, 2025
1 parent 2b6ec96 commit f008b84
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions beacon_node/beacon_chain/src/fetch_blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,20 @@ pub async fn fetch_and_process_engine_blobs<T: BeaconChainTypes>(
return Ok(None);
}

if chain
.canonical_head
.fork_choice_read_lock()
.contains_block(&block_root)
{
// Avoid computing columns if block has already been imported.
debug!(
log,
"Ignoring EL blobs response";
"info" => "block has already been imported",
);
return Ok(None);
}

let data_columns_receiver = spawn_compute_and_publish_data_columns_task(
&chain,
block.clone(),
Expand Down Expand Up @@ -248,18 +262,21 @@ fn spawn_compute_and_publish_data_columns_task<T: BeaconChainTypes>(
}
};

if let Err(e) = data_columns_sender.send(all_data_columns.clone()) {
error!(log, "Failed to send computed data columns"; "error" => ?e);
if data_columns_sender.send(all_data_columns.clone()).is_err() {
// Data column receiver have been dropped - block may have already been imported.
// This race condition exists because gossip columns may arrive and trigger block
// import during the computation. Here we just drop the computed columns.
debug!(
log,
"Failed to send computed data columns";
);
return;
};

// Check indices from cache before sending the columns, to make sure we don't
// publish components already seen on gossip.
let is_supernode = chain_cloned.data_availability_checker.is_supernode();

// At the moment non supernodes are not required to publish any columns.
// TODO(das): we could experiment with having full nodes publish their custodied
// columns here.
if !is_supernode {
if !chain_cloned.data_availability_checker.is_supernode() {
return;
}

Expand Down

0 comments on commit f008b84

Please sign in to comment.