More robust wait for block. - #899
Conversation
|
Claude finished @ZanCorDX's task in 1m 19s —— View job PR Review: More robust wait for block
SummaryThe refactoring to extract Issues found
|
| match try_to_read_block_header(block, parent_hash, payload_id, provider).await { | ||
| Ok(header) => return Ok(header), | ||
| Err(err) => { | ||
| info!(?err, "Failed to_read_block_header"); |
There was a problem hiding this comment.
Typo: "Failed to_read_block_header" — looks like a copy-paste from the function name. Should be "Failed to read block header".
Also, logging provider errors (e.g. DB issues) at info level may make them hard to notice in production. Consider warn here since these are errors that were previously propagated as failures.
| info!(?err, "Failed to_read_block_header"); | |
| info!(?err, "Failed to read block header"); |
| let current_parent_hash = provider | ||
| .header_by_number(block.checked_sub(1).unwrap_or(1))? | ||
| .map(|h| h.hash_slow()); | ||
| info!( |
There was a problem hiding this comment.
When the header is not found (the else branch below), this logs at info level with details, and then the caller also logs the returned error at info level (line 491). This produces two log lines per retry iteration for the common "not found yet" case. Consider removing one of the two log sites or making the inner one debug to reduce noise.
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
|
Claude finished @ZanCorDX's task in 1m 10s —— View job PR Review: More robust wait for block
SummaryGood progress from the previous review —
|
| sleep_duration = None; | ||
| } else { | ||
| sleep_duration = Some(time_to_sleep.try_into().unwrap()); | ||
| match try_to_read_block_header(block, parent_hash, payload_id, provider).await { |
There was a problem hiding this comment.
Bug: .await on a non-async function. try_to_read_block_header was correctly changed to a regular fn (line 505), but this call site still has .await. Since eyre::Result<Header> does not implement Future, this should be a compile error.
| match try_to_read_block_header(block, parent_hash, payload_id, provider).await { | |
| match try_to_read_block_header(block, parent_hash, payload_id, provider) { |
| match try_to_read_block_header(block, parent_hash, payload_id, provider).await { | ||
| Ok(header) => return Ok(header), | ||
| Err(err) => { | ||
| info!(?err, "Failed to_read_block_header"); |
There was a problem hiding this comment.
Typo still present from previous review: "Failed to_read_block_header" should be "Failed to read block header".
| info!(?err, "Failed to_read_block_header"); | |
| info!(?err, "Failed to read block header"); |
| ?current_parent_hash, | ||
| payload_id, | ||
| "Payload parent header not found, trying again" | ||
| ); |
There was a problem hiding this comment.
Double logging is still present: this info! fires on every "not found" iteration, and the caller at line 491 also logs the returned error at info. Consider removing one or demoting this inner log to debug! to reduce noise.
|
Claude finished @ZanCorDX's task in 46s —— View job PR Review: More robust wait for block
SummaryThe previous issues ( Remaining issue
|
| match try_to_read_block_header(block, parent_hash, payload_id, provider) { | ||
| Ok(header) => return Ok(header), | ||
| Err(err) => { | ||
| info!(?err, "try_to_read_block_header failed"); |
There was a problem hiding this comment.
Double logging on "not found" iterations is still present. When the header isn't found, try_to_read_block_header logs at info with full context (line 520-526), then returns an error, and this line logs the error again at info. This produces two log lines per poll cycle for the common case.
Consider removing this outer log (the inner one has all the useful details), or demoting it to debug:
| info!(?err, "try_to_read_block_header failed"); | |
| debug!(?err, "try_to_read_block_header failed"); |
📝 Summary
Some new bug in reth (between 1.9.3 and 1.11.3) generated a rece condition that would give the last block but then when asked for it it's not there.
Now wait_for_block_header waits until the deadline no matter the errors it gets.
✅ I have completed the following steps:
make lintmake test