From 7d699224cbb8825f718540825e3d56ccae6e34ab Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Thu, 27 Mar 2025 14:00:55 -0600 Subject: [PATCH] add better logging --- Cargo.lock | 1 + .../beacon_chain/src/beacon_fork_choice_store.rs | 6 ++++++ beacon_node/beacon_chain/src/execution_payload.rs | 13 +++++++++++-- beacon_node/http_api/src/publish_inclusion_lists.rs | 3 ++- consensus/proto_array/Cargo.toml | 1 + consensus/proto_array/src/proto_array.rs | 13 +++++++++++++ 6 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be6e2bf3f3..a91ceabcf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6820,6 +6820,7 @@ dependencies = [ "serde", "serde_yaml", "superstruct", + "tracing", "types", ] diff --git a/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs b/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs index 7b0732f70e..60ac165162 100644 --- a/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs +++ b/beacon_node/beacon_chain/src/beacon_fork_choice_store.rs @@ -19,6 +19,7 @@ use types::{ AbstractExecPayload, BeaconBlockRef, BeaconState, BeaconStateError, Checkpoint, Epoch, EthSpec, FixedBytesExtended, Hash256, Slot, }; +use tracing::info; #[derive(Debug)] pub enum Error { @@ -352,6 +353,11 @@ where } fn set_unsatisfied_inclusion_list_block(&mut self, slot: Slot, block_root: Hash256) { + info!( + ?slot, + %block_root, + "Set unsatisfied inclusion list block" + ); self.unsatisfied_inclusion_list_blocks .insert(slot, block_root); } diff --git a/beacon_node/beacon_chain/src/execution_payload.rs b/beacon_node/beacon_chain/src/execution_payload.rs index e285af44a4..c7c6f2dd58 100644 --- a/beacon_node/beacon_chain/src/execution_payload.rs +++ b/beacon_node/beacon_chain/src/execution_payload.rs @@ -24,7 +24,7 @@ use state_processing::per_block_processing::{ }; use std::sync::Arc; use tokio::task::JoinHandle; -use tracing::{debug, warn}; +use tracing::{debug, warn, info}; use tree_hash::TreeHash; use types::payload::BlockProductionVersion; use types::*; @@ -164,6 +164,11 @@ async fn notify_new_payload( .ok_or(ExecutionPayloadError::NoExecutionConnection)?; let execution_block_hash = block.execution_payload()?.block_hash(); + + info!( + il_tx_count = il_transactions.len(), + "Submit new payload with il_transactions" + ); let new_payload_response = execution_layer .notify_new_payload(NewPayloadRequest::try_from_block_and_il_transactions( block, @@ -217,7 +222,11 @@ async fn notify_new_payload( // transactions for this slot, update the fork choice store before processing // the invalid EL payload. if *validation_error == Some("INVALID_INCLUSION_LIST".to_string()) { - debug!("Unsatisfied inclusion list"); + debug!( + slot = ?block.slot(), + blocK_root = %block.tree_hash_root(), + "Unsatisfied inclusion list" + ); chain .set_unsatisfied_inclusion_list_block( block.slot(), diff --git a/beacon_node/http_api/src/publish_inclusion_lists.rs b/beacon_node/http_api/src/publish_inclusion_lists.rs index f376e68e95..0ae7aa78e1 100644 --- a/beacon_node/http_api/src/publish_inclusion_lists.rs +++ b/beacon_node/http_api/src/publish_inclusion_lists.rs @@ -196,7 +196,8 @@ fn verify_and_publish_inclusion_list( info!( slot = ?verified_inclusion_list.signed_il.message.slot, - "Published inclusion list" + validator_index = verified_inclusion_list.signed_il.message.validator_index, + "Verified inclusion list and republished" ); // TODO(focil) add reprocess logic? diff --git a/consensus/proto_array/Cargo.toml b/consensus/proto_array/Cargo.toml index bd6757c0fa..293d6ab8f0 100644 --- a/consensus/proto_array/Cargo.toml +++ b/consensus/proto_array/Cargo.toml @@ -16,3 +16,4 @@ serde = { workspace = true } serde_yaml = { workspace = true } superstruct = { workspace = true } types = { workspace = true } +tracing = { workspace = true } diff --git a/consensus/proto_array/src/proto_array.rs b/consensus/proto_array/src/proto_array.rs index 3fdd3f18e2..b5742047db 100644 --- a/consensus/proto_array/src/proto_array.rs +++ b/consensus/proto_array/src/proto_array.rs @@ -10,6 +10,7 @@ use types::{ AttestationShufflingId, ChainSpec, Checkpoint, Epoch, EthSpec, ExecutionBlockHash, FixedBytesExtended, Hash256, Slot, }; +use tracing::info; // Define a "legacy" implementation of `Option` which uses four bytes for encoding the union // selector. @@ -197,6 +198,7 @@ impl ProtoArray { let execution_status_is_invalid = node.execution_status.is_invalid(); // TODO(focil) seems sketchy... + // TODO(focil) improve loggings // modify is viable for head // debug/fork_choice let mut node_delta = if execution_status_is_invalid @@ -206,6 +208,12 @@ impl ProtoArray { .get(¤t_slot) .unwrap_or(&Hash256::ZERO) { + info!( + root = %node.root, + ?current_slot, + is_unsatisfied_il_block = self.unsatisfied_inclusion_list_blocks.contains_key(¤t_slot), + "Potentially unsatisfied IL block", + ); // If the node has an invalid execution payload, or the payload doesn't satisfy // an inclusion list, reduce its weight to zero. 0_i64 @@ -905,6 +913,11 @@ impl ProtoArray { .get(¤t_slot) .unwrap_or(&Hash256::ZERO) { + info!( + ?current_slot, + source = "node_is_viable_for_head", + "this block doesn't satisfy the inclusion list" + ); return false; }