Skip to content

Conversation

@MartinquaXD
Copy link
Contributor

@MartinquaXD MartinquaXD commented Jan 12, 2026

Description

#3985 changed (see here) the returned error variant. The most important issue is that Error::is_revert() always returns false for the new returned error variant which causes some error handling to behavior to be wrong now:

  1. the driver will no longer abort submitting transactions which fail to simulate before submitting them
  2. some error logs no longer contain all the tx information to resimulate a failing tx (which means some failing txs can't be debugged anymore)

Changes

Change returned error variant to Error::Rpc and implement is_revert() for it such that it's (mostly) compatible with the original code. Now any message returned from the RPC that is of this shape will be interpreted as a revert. The old web3 crate had some client specific error message parsing but that seems overly specific so I think the new code should be sufficient to fix the errors.

@MartinquaXD MartinquaXD requested a review from a team as a code owner January 12, 2026 08:14
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a critical issue where transaction simulation failures were not being detected, which could lead to submitting transactions that are known to fail. The fix is implemented by correctly mapping gas estimation errors to Error::Rpc and updating the is_revert method to properly identify RPC error responses as reverts. The changes are logical and effectively solve the problem described. I have one comment regarding a related inconsistency that this change brings to light, which could be addressed in a follow-up.

Comment on lines 357 to 358
Error::ContractRpc(_) => true,
Error::Rpc(_) => false,
Error::Rpc(err) => err.is_error_resp()

Choose a reason for hiding this comment

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

medium

This change is a good improvement for handling Error::Rpc. However, it highlights an inconsistency with how Error::ContractRpc is handled.

Error::ContractRpc(_) is always considered a revert, which is too broad as it would include transient network errors. Your change correctly handles this for Error::Rpc by checking is_error_resp().

This inconsistency could lead to different behavior for similar errors depending on whether they come from a contract call or a direct RPC call.

I recommend creating a follow-up to make the Error::ContractRpc handling more specific. For example:

use ethrpc::alloy::errors::ContractErrorExt;
// ...
Error::ContractRpc(err) => !err.is_node_error(),

This would make the revert detection more consistent and robust across different error types.

use ethrpc::alloy::errors::ContractErrorExt;
// ...
Error::ContractRpc(err) => !err.is_node_error(),

Copy link
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

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

I had noticed this on friday but I was not aware how bad it was. Great catch and thanks for the fix!

@MartinquaXD MartinquaXD enabled auto-merge January 12, 2026 10:16
@MartinquaXD MartinquaXD added this pull request to the merge queue Jan 12, 2026
Merged via the queue into main with commit bc10560 Jan 12, 2026
19 checks passed
@MartinquaXD MartinquaXD deleted the fix-revert-detection branch January 12, 2026 10:40
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants