Skip to content

Conversation

@pinebit
Copy link
Collaborator

@pinebit pinebit commented Oct 21, 2025

Fix: Handle 404 errors gracefully in inclusion checker and improve error handling

Problem

The inclusion checker was treating 404 responses from the beacon node as errors, causing:

  • Unnecessary retries when blocks are missed, putting load on the beacon node
  • Spurious warnings for expected 404 responses (missed proposals are valid)

Solution

  1. Handle 404 errors gracefully
    Detect 404 status codes and treat them as "block not found" (expected behavior)
    Stop retrying and stop logging warnings for 404 responses
    Added comprehensive tests to verify correct behavior
  2. Improve error handling approach
    Modified eth2wrap.wrapError() to use errors.Wrap() instead of errors.New()
    Preserves original eth2api.Error in the error chain
    Enables standard Go error checking with errors.As() instead of relying on logging fields
    Applied consistently across inclusion.go and synthproposer.go

category: bug
ticket: #4035

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the inclusion checker's error handling by treating 404 responses from the beacon node as valid "block not found" scenarios rather than errors. When a block proposal is missed (no block at a slot), the beacon node returns a 404, which previously caused unnecessary retries and spurious warnings.

Key Changes:

  • Added 404 status code detection using z.ContainsField() utility in both checkBlock and checkBlockAndAtts functions
  • Modified error handling to return nil for 404 responses, stopping unnecessary retries
  • Added comprehensive test coverage for both 404 and non-404 error scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
core/tracker/inclusion.go Added 404 error handling in checkBlock and checkBlockAndAtts to treat missing blocks as valid scenarios
core/tracker/inclusion_internal_test.go Added comprehensive test suite covering 404 handling for both block and attestation checks, plus validation that non-404 errors still propagate

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ObolNetwork ObolNetwork deleted a comment from Copilot AI Oct 21, 2025
@ObolNetwork ObolNetwork deleted a comment from Copilot AI Oct 21, 2025
@pinebit pinebit changed the title core/tracker: handle 404 errors gracefully in inclusion checker core/tracker: handle 404 errors gracefully Oct 21, 2025
@ObolNetwork ObolNetwork deleted a comment from Copilot AI Oct 21, 2025
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.80%. Comparing base (938ab64) to head (da44729).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4041   +/-   ##
=======================================
  Coverage   53.79%   53.80%           
=======================================
  Files         242      242           
  Lines       39412    39425   +13     
=======================================
+ Hits        21203    21213   +10     
- Misses      15967    15970    +3     
  Partials     2242     2242           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

@pinebit pinebit added the merge when ready Indicates bulldozer bot may merge when all checks pass label Oct 22, 2025
@obol-bulldozer obol-bulldozer bot merged commit bba43cd into main Oct 22, 2025
16 checks passed
@obol-bulldozer obol-bulldozer bot deleted the pinebit/inclusion-warn-fix branch October 22, 2025 08:21
KaloyanTanev pushed a commit that referenced this pull request Oct 23, 2025
Fix: Handle 404 errors gracefully in inclusion checker and improve error handling

**Problem**

The inclusion checker was treating 404 responses from the beacon node as errors, causing:
- Unnecessary retries when blocks are missed, putting load on the beacon node
- Spurious warnings for expected 404 responses (missed proposals are valid)

**Solution**

1. Handle 404 errors gracefully
Detect 404 status codes and treat them as "block not found" (expected behavior)
Stop retrying and stop logging warnings for 404 responses
Added comprehensive tests to verify correct behavior
2. Improve error handling approach
Modified eth2wrap.wrapError() to use errors.Wrap() instead of errors.New()
Preserves original eth2api.Error in the error chain
Enables standard Go error checking with errors.As() instead of relying on logging fields
Applied consistently across inclusion.go and synthproposer.go

category: bug
ticket: #4035
@KaloyanTanev KaloyanTanev mentioned this pull request Oct 23, 2025
obol-bulldozer bot pushed a commit that referenced this pull request Oct 23, 2025
Charon v1.7.1

#4024 
#4029 
#4041 

category: feature
ticket: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge when ready Indicates bulldozer bot may merge when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants