Skip to content

fix(rpc): error handling#3029

Merged
fridrik01 merged 4 commits intomainfrom
rpc-errors-handling
Feb 25, 2026
Merged

fix(rpc): error handling#3029
fridrik01 merged 4 commits intomainfrom
rpc-errors-handling

Conversation

@bar-bera
Copy link
Collaborator

@bar-bera bar-bera commented Feb 19, 2026

Not sure here on what we should consider transient as an error, beside -32000. Also added -32603 for now but maybe should be considered fatal.

@bar-bera bar-bera requested a review from a team as a code owner February 19, 2026 17:31
Copilot AI review requested due to automatic review settings February 19, 2026 17:31
Copy link
Contributor

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 RPC error handling in the execution client by properly distinguishing between transient and fatal JSON-RPC errors. The changes ensure that transient errors like server errors (-32000) and internal errors (-32603) trigger infinite retries, while fatal errors like parse errors (-32700) cause immediate failure without retrying.

Changes:

  • Added comprehensive test coverage for both transient and fatal RPC error scenarios using an HTTP proxy pattern
  • Introduced isTransientError helper function to classify transient errors (ErrServer, ErrInternal) that should be retried
  • Updated IsFatalError and IsNonFatalError logic to properly exclude transient errors from fatal classification
  • Added ErrorCode() method to RPC Error type to support error code inspection

Reviewed changes

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

File Description
testing/simulated/rpc_errors_test.go New test suite with HTTP proxy to inject JSON-RPC errors and verify recovery behavior for transient errors and immediate failure for fatal errors
execution/client/errors.go Added isTransientError helper and updated error classification logic to properly handle transient vs fatal errors
execution/client/ethclient/rpc/types.go Added ErrorCode() method to satisfy jsonrpc.Error interface

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.69%. Comparing base (01e5e7b) to head (59bc955).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3029      +/-   ##
==========================================
+ Coverage   62.63%   62.69%   +0.05%     
==========================================
  Files         357      357              
  Lines       17224    17226       +2     
==========================================
+ Hits        10788    10799      +11     
+ Misses       5580     5572       -8     
+ Partials      856      855       -1     
Files with missing lines Coverage Δ
execution/client/ethclient/rpc/types.go 50.00% <100.00%> (+50.00%) ⬆️

... and 3 files with indirect coverage changes

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we need to update behavior for the jsonrpc.ErrServer, jsonrpc.ErrInternal errors. Can you confirm from the EL (or maybe even CL spec) in which case these are returned and how they should be handled. I'm more inclined to file a ticket for this (to investigate further) and leave this change out of this bug fix PR @bar-bera

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, lets keep the IsFatalError/IsNonFatalError logic the same in this PR and look at them separately

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok agree to not touch the logic, just keep the test structure in case we want to test different behavior for different errors

Copy link
Contributor

@fridrik01 fridrik01 left a comment

Choose a reason for hiding this comment

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

LGTM

@fridrik01 fridrik01 merged commit b193bed into main Feb 25, 2026
22 checks passed
@fridrik01 fridrik01 deleted the rpc-errors-handling branch February 25, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants