eth: add eth_getRawTransactionBy* methods to spec#836
Conversation
Add eth_getRawTransactionByHash, eth_getRawTransactionByBlockHashAndIndex, and eth_getRawTransactionByBlockNumberAndIndex to src/eth/transaction.yaml. These methods are implemented by all major clients (Geth, Nethermind, Besu, Reth) but were absent from the spec. Each method mirrors its structured eth_getTransactionBy* counterpart in params and error codes, returning oneOf: [notFound, bytes] (null when not found, RLP-encoded hex when found). Block-indexed variants include error code 4444 (Pruned history unavailable).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hey @manusw7 - we need tests - to get tests we need something in generators and a You can, in theory, point the PR at your branch via updating the |
…Transaction not-found Add MethodTests vars for eth_getRawTransactionByHash, eth_getRawTransactionByBlockHashAndIndex, and eth_getRawTransactionByBlockNumberAndIndex. Each covers found, not-found, and (where applicable) out-of-range-index cases. Also add a get-notfound-tx test to the existing DebugGetRawTransaction. The 7 not-found .io fixtures are hand-written with result:null since upstream geth currently returns "0x" for missing raw txs; the spec (oneOf: [notFound, bytes]) requires null. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use a replace directive to swap in manusw7/go-ethereum@fix/raw-tx-null-not-found,
which returns *hexutil.Bytes (null) instead of hexutil.Bytes ("0x") for missing
transactions. This lets `make fill` generate the correct null responses in the
eth_getRawTransactionBy* and debug_getRawTransaction .io test fixtures.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Done — I've added a The fork branch is Running Once the go-ethereum PR is merged and a new release tagged, this replace directive can be dropped and |
Summary
Adds
eth_getRawTransactionByHash,eth_getRawTransactionByBlockHashAndIndex, andeth_getRawTransactionByBlockNumberAndIndextosrc/eth/transaction.yaml.Also aligns
debug_getRawTransactioninsrc/debug/getters.yamlwith the same convention: its result schema becomesoneOf: [notFound, bytes]so it returnsnullwhen the transaction is not found.These three methods are implemented by all major execution clients (Geth, Nethermind, Besu, Reth) but were absent from the spec.
Rationale
The structured counterparts (
eth_getTransactionByHash/ByBlockHashAndIndex/ByBlockNumberAndIndex) are already specified withoneOf: [notFound, TransactionInfo]— returningnullwhen the transaction is not found. The raw variants should follow the same convention.Geth currently returns
"0x"for not-found (a Go nil-slice serialisation artifact, not an intentional choice). A companion PR fixes this: ethereum/go-ethereum#35227. Nethermind, Reth, and Besu already returnnull.Changes
Three new method entries in
src/eth/transaction.yaml, inserted betweeneth_getTransactionByBlockNumberAndIndexandeth_getTransactionReceipt:eth_getRawTransactionByHash— same param as the structured variant; resultoneOf: [notFound, bytes]eth_getRawTransactionByBlockHashAndIndex— same params as the structured variant; resultoneOf: [notFound, bytes]; error4444eth_getRawTransactionByBlockNumberAndIndex— same params as the structured variant; resultoneOf: [notFound, bytes]; error4444debug_getRawTransaction(src/debug/getters.yaml) — result schema changed frombytestooneOf: [notFound, bytes], matching theeth_getRawTransaction*variants. Adds aget-notfound-txtest assertingnull.Each entry mirrors the structure of its
eth_getTransactionBy*counterpart exactly, only swappingTransactionInfoforbytesin the result schema.