Skip to content

Conversation

@fedacking
Copy link
Contributor

Motivation

We are in the process of downgrading logs that are useless to the user to debug and moving the format to structured logging from tracing.

Description

  • Reviewed peer_handler logs, downgrading and structuring them
  • Reviewed transaction broadcast logs
  • Made the current allocator log debug
  • Made gas estimator error debug (they are expected after snap sync)
  • Made rocksdb not print column families in info (useless info for the user)

Progress for #4950

@fedacking fedacking requested a review from a team as a code owner October 31, 2025 21:34
@fedacking fedacking self-assigned this Oct 31, 2025
@github-actions github-actions bot added the L1 Ethereum client label Oct 31, 2025
@github-actions
Copy link

Lines of code report

Total lines added: 27
Total lines removed: 0
Total lines changed: 27

Detailed view
+----------------------------------------------+-------+------+
| File                                         | Lines | Diff |
+----------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/peer_handler.rs | 1789  | +26  |
+----------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/rocksdb.rs    | 1541  | +1   |
+----------------------------------------------+-------+------+

"Sync Log 5: Requesting block headers from peer {peer_id}, chunk_limit: {chunk_limit}"
%peer_id,
%chunk_limit,
"request_block_headers: Requesting block headers"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the message a bit redundant?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

"We had an error dumping the last accounts to disk {}",
err.error
error=%err.error,
"We had an error dumping the last accounts to disk",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"We had an error dumping the last accounts to disk",
"Failed to dump the last accounts to disk",

.expect("Shouldn't have a join error")
.inspect_err(|err| {
error!("We found this error while dumping to file {err:?}")
error!(error=?err.error, "We found this error while dumping to file")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error!(error=?err.error, "We found this error while dumping to file")
error!(error=?err.error, "Error dumping to file")

result
.inspect_err(|err| error!("We found this error while dumping to file {err:?}"))
result.inspect_err(
|err| error!(error=?err.error, "We found this error while dumping to file"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|err| error!(error=?err.error, "We found this error while dumping to file"),
|err| error!(error=?err.error, "Error dumping to file"),

});
connection.outgoing_message(txs_message).await.unwrap_or_else(|err| {
error!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions");
debug!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok to have this on error: If it fails the broadcaster is broken and user should be aware.

);
connection.outgoing_message(hashes_message.clone()).await.unwrap_or_else(|err| {
error!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions hashes");
debug!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions hashes");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same


let _ = self.broadcast_txs().await.inspect_err(|_| {
error!("Failed to broadcast transactions");
debug!("Failed to broadcast transactions");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Contributor

@ElFantasma ElFantasma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it LGTM.

Left some minor comments and suggestions

let sync_head_number_retrieval_start = SystemTime::now();

info!("Retrieving sync head block number from peers");
debug!("Retrieving sync head block number from peers");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe having one log when the requesting start isn't bad, but I'll check if there aren't anothers.

.unwrap_or_default();

info!("Sync head block number retrieved");
debug!("Sync head block number retrieved");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace?

"[SYNCING] Received empty/invalid headers from peer, penalizing peer {peer_id}"
debug!(
%peer_id,
"[SYNCING] Received empty/invalid headers from peer, penalizing peer"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the [SYNCING], or in general every [FOO]

chunk_limit: u64,
) -> Result<Vec<BlockHeader>, PeerHandlerError> {
debug!("Requesting block headers from peer {peer_id}");
debug!(%peer_id, "Requesting block headers from peer");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace

state_root: H256,
tx: tokio::sync::mpsc::Sender<(Vec<AccountRangeUnit>, H256, Option<(H256, H256)>)>,
) -> Result<(), PeerHandlerError> {
debug!(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace

remaining_start: chunk_start,
remaining_end: chunk_end,
};
debug!(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace

task_count += 1;
}
debug!("Split big storage account into {chunk_count} chunks.");
debug!(chunk_count, "Split big storage account into chunks.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably trace? Or is this exceptional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants