Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions beacon_node/http_api/src/publish_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Duration;
use tokio::sync::mpsc::UnboundedSender;
use tracing::{Span, debug, debug_span, error, info, instrument, warn};
use tracing::{Span, debug, debug_span, error, field, info, instrument, warn};
use tree_hash::TreeHash;
use types::{
AbstractExecPayload, BeaconBlockRef, BlobSidecar, BlobsList, BlockImportSource,
Expand Down Expand Up @@ -80,7 +80,7 @@ impl<T: BeaconChainTypes> ProvenancedBlock<T, Arc<SignedBeaconBlock<T::EthSpec>>
name = SPAN_PUBLISH_BLOCK,
level = "info",
skip_all,
fields(?block_root, ?validation_level, provenance = tracing::field::Empty)
fields(block_root = field::Empty, ?validation_level, block_slot = field::Empty, provenance = field::Empty)
)]
pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
block_root: Option<Hash256>,
Expand All @@ -103,12 +103,16 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
} else {
"builder"
};
let current_span = Span::current();
current_span.record("provenance", provenance);

let block = unverified_block.inner_block();
let block_root = block_root.unwrap_or_else(|| block.canonical_root());

let current_span = Span::current();
current_span.record("provenance", provenance);
current_span.record("block_root", field::display(block_root));
current_span.record("block_slot", field::display(block.slot()));

debug!(slot = %block.slot(), "Signed block received in HTTP API");
debug!("Signed block received in HTTP API");

/* actually publish a block */
let publish_block_p2p = move |block: Arc<SignedBeaconBlock<T::EthSpec>>,
Expand Down Expand Up @@ -152,12 +156,6 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(

// Gossip verify the block and blobs/data columns separately.
let gossip_verified_block_result = unverified_block.into_gossip_verified_block(&chain);
let block_root = block_root.unwrap_or_else(|| {
gossip_verified_block_result.as_ref().map_or_else(
|_| block.canonical_root(),
|verified_block| verified_block.block_root,
)
});

let should_publish_block = gossip_verified_block_result.is_ok();
if BroadcastValidation::Gossip == validation_level && should_publish_block {
Expand Down Expand Up @@ -309,9 +307,8 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
.into_response())
}
}
Err(BlockError::DuplicateImportStatusUnknown(root)) => {
Err(BlockError::DuplicateImportStatusUnknown(_)) => {
debug!(
block_root = ?root,
slot = %block.slot(),
"Block previously seen"
);
Expand Down
Loading