Add more logs in the BN HTTP API during block production (#4025)

## Issue Addressed

NA

## Proposed Changes

Adds two new `DEBG` logs to the HTTP API:

1. As soon as we are requested to produce a block.
2. As soon as a signed block is received.

In #3858 we added some very helpful logs to the VC so we could see when things are happening with block proposals in the VC. After doing some more debugging, I found that I can tell when the VC is sending a block but I *can't* tell the time that the BN receives it (I can only get the time after the BN has started doing some work with the block). Knowing when the VC published and as soon as the BN receives is useful for determining the delays introduced by network latency (and some other things like JSON decoding, etc).

## Additional Info

NA
This commit is contained in:
Paul Hauner 2023-02-28 02:20:53 +00:00
parent 0155455990
commit 17d9a620cf
2 changed files with 16 additions and 2 deletions

View File

@ -2380,11 +2380,19 @@ pub fn serve<T: BeaconChainTypes>(
.and(not_while_syncing_filter.clone()) .and(not_while_syncing_filter.clone())
.and(warp::query::<api_types::ValidatorBlocksQuery>()) .and(warp::query::<api_types::ValidatorBlocksQuery>())
.and(chain_filter.clone()) .and(chain_filter.clone())
.and(log_filter.clone())
.and_then( .and_then(
|endpoint_version: EndpointVersion, |endpoint_version: EndpointVersion,
slot: Slot, slot: Slot,
query: api_types::ValidatorBlocksQuery, query: api_types::ValidatorBlocksQuery,
chain: Arc<BeaconChain<T>>| async move { chain: Arc<BeaconChain<T>>,
log: Logger| async move {
debug!(
log,
"Block production request from HTTP API";
"slot" => slot
);
let randao_reveal = query.randao_reveal.decompress().map_err(|e| { let randao_reveal = query.randao_reveal.decompress().map_err(|e| {
warp_utils::reject::custom_bad_request(format!( warp_utils::reject::custom_bad_request(format!(
"randao reveal is not a valid BLS signature: {:?}", "randao reveal is not a valid BLS signature: {:?}",

View File

@ -5,7 +5,7 @@ use beacon_chain::{
}; };
use lighthouse_network::{PubsubMessage, SignedBeaconBlockAndBlobsSidecar}; use lighthouse_network::{PubsubMessage, SignedBeaconBlockAndBlobsSidecar};
use network::NetworkMessage; use network::NetworkMessage;
use slog::{error, info, warn, Logger}; use slog::{debug, error, info, warn, Logger};
use slot_clock::SlotClock; use slot_clock::SlotClock;
use std::sync::Arc; use std::sync::Arc;
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
@ -27,6 +27,12 @@ pub async fn publish_block<T: BeaconChainTypes>(
) -> Result<(), Rejection> { ) -> Result<(), Rejection> {
let seen_timestamp = timestamp_now(); let seen_timestamp = timestamp_now();
debug!(
log,
"Signed block published to HTTP API";
"slot" => block.slot()
);
// Send the block, regardless of whether or not it is valid. The API // Send the block, regardless of whether or not it is valid. The API
// specification is very clear that this is the desired behaviour. // specification is very clear that this is the desired behaviour.