Skip to content

Commit fcdfa4c

Browse files
committed
Undo buggy changes in block publish flow
1 parent 7ce4d23 commit fcdfa4c

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

beacon_node/http_api/src/publish_blocks.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,34 +234,29 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
234234
tokio::time::sleep(delay).await;
235235
}
236236
}
237-
// Publish columns to network first (eager push for builder/producer case)
238237
publish_column_sidecars(network_tx, &gossip_verified_columns, &chain).map_err(|_| {
239238
warp_utils::reject::custom_server_error("unable to publish data column sidecars".into())
240239
})?;
241-
242-
// Add full columns directly to DA checker (not via gossip verification)
243240
let epoch = block.slot().epoch(T::EthSpec::slots_per_epoch());
244241
let sampling_columns_indices = chain.sampling_columns_for_epoch(epoch);
245-
let sampling_columns: Vec<_> = gossip_verified_columns
242+
let sampling_columns = gossip_verified_columns
246243
.into_iter()
247244
.filter(|data_column| sampling_columns_indices.contains(&data_column.index()))
248-
.map(|gv| gv.into_inner().to_data_column())
249-
.collect();
245+
.collect::<Vec<_>>();
250246

251247
if !sampling_columns.is_empty() {
252-
// Add columns directly to DA checker (block producer case)
253-
let block_root = block.tree_hash_root();
254-
if let Err(e) = chain
255-
.data_availability_checker
256-
.put_full_data_columns(block_root, sampling_columns)
248+
// Importing the columns could trigger block import and network publication in the case
249+
// where the block was already seen on gossip.
250+
if let Err(e) =
251+
Box::pin(chain.process_gossip_data_columns(sampling_columns, publish_fn)).await
257252
{
258-
let msg = format!("Failed to add data columns to DA checker: {e:?}");
253+
let msg = format!("Invalid data column: {e}");
259254
return if let BroadcastValidation::Gossip = validation_level {
260255
Err(warp_utils::reject::broadcast_without_import(msg))
261256
} else {
262257
error!(
263258
reason = &msg,
264-
"Data column addition failed during block publication"
259+
"Invalid data column during block publication"
265260
);
266261
Err(warp_utils::reject::custom_bad_request(msg))
267262
};

0 commit comments

Comments
 (0)