Skip to content

error-groups, tools, tests: add spec-mandated error-code fixtures for methods#784

Open
simsonraj wants to merge 2 commits into
ethereum:mainfrom
simsonraj:main
Open

error-groups, tools, tests: add spec-mandated error-code fixtures for methods#784
simsonraj wants to merge 2 commits into
ethereum:mainfrom
simsonraj:main

Conversation

@simsonraj
Copy link
Copy Markdown
Contributor

@simsonraj simsonraj commented Apr 19, 2026

Follow-up to #650 that turns the new error-code catalog into a forcing function for client adoption via hive's rpc-compat simulator.

  • Adds code 1002 "Replacement transaction underpriced" to txpool-errors.yaml.
  • Adds ExpectErrorCode to the testgen. When set, rpctestgen rewrites the captured error.code in the generated .io fixture to the spec-mandated value
  • Adds eth_sendRawTransaction error scenarios, each tagged with its catalog code.
  • Extends speccheck to validate each fixture's error.code against the method's resolved errors[]; emits [WARN] on unknown codes.

Scenarios

Fixture Spec code Group
send-nonce-too-low 1 ExecutionErrors
send-intrinsic-gas-too-low 800 GasErrors
send-tx-gas-exceeds-block-limit 803 GasErrors
send-tip-above-fee-cap 804 GasErrors
send-insufficient-funds 809 GasErrors
send-already-known 1000 TxPoolErrors
send-replacement-underpriced 1002 TxPoolErrors

Measured on docker-ized go-ethereum, hyperledger/besu, nethermind/nethermind (full data and fixtures: simsonraj/eth-err-tests).

Deferred

Four scenarios that can't yet be reliably reproduced across all clients because hive doesn't expose the relevant client-launch flags. (commented currently)

@MysticRyuujin
Copy link
Copy Markdown
Contributor

From RPC Standards call: Ideally, we need to get a go-ethereum PR to fix, so we can remove the error code overwriting logic from the generator, and then update the go-ethereum target.

@MysticRyuujin
Copy link
Copy Markdown
Contributor

Opened ethereum/go-ethereum#35105, which makes eth_sendTransaction / eth_sendRawTransaction emit the standardized catalog codes natively — mapping the core/txpool errors to ExecutionErrors / GasErrors / TxPoolErrors while preserving the existing error messages.

I verified it directly against the fixtures in this PR: regenerating the eth_sendRawTransaction error fixtures with that build, with the ExpectErrorCode / RewriteLastErrorCode rewrite disabled, reproduces them byte-for-byte, and speccheck passes.

So once #35105 merges, the rewrite shim here can be dropped: the codes come straight from go-ethereum, and the fixtures can be regenerated natively (a go-ethereum dependency bump instead of the rewrite step). Flagging now so the rewrite mechanism doesn't get baked in long-term — happy to help with the follow-up once it lands.

@s1na
Copy link
Copy Markdown
Contributor

s1na commented Jun 3, 2026

Do we know if clients have already shipped the error codes specified in #650?

I think it's unfortunate that the codes defined in #650 are inconsistent with the ones in eth_simulateV1 for the same failure mode. This means that eth_sendRawTransaction or e.g. eth_call return 800 for intrinsic gas too low, whereas eth_simulateV1 returns -38013. This surely creates confusion for clients.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants