Skip to content

Commit 5032b92

Browse files
manav2401claude
andauthored
test(autobahn): cover new EVM-only RPC methods in the integration tests (#4547)
This PR covers the newly added EVM-only RPC methods in Autobahn's integration test. Currently, it only exercised six of the EVM-only RPC's methods (eth_sendRawTransaction, eth_getTransactionReceipt, eth_getBalance, eth_getTransactionCount, eth_chainId, eth_blockNumber). Everything added since, from block and receipt lookups to logs, fees, storage, and WebSocket newHeads, was covered only by unit tests against stubbed backends, so nothing checked these methods against a real cluster or that validators agree on what they return. `testEVMOnlyLoad` now continues after its 4,000-transfer load. - `assertEVMOnlyBlockQueries` takes the block holding a load transfer and checks every block-scoped method against it on all four validators: lookups by number, hash, and index agree with each other and with eth_getTransactionByHash and eth_getTransactionReceipt, the block's receipts sum to its gasUsed, eth_feeHistory reports the same block, and all four nodes return identical blocks and receipts. - `assertEVMOnlyContractQueries` deploys a tiny contract whose constructor writes a storage slot and emits a log, then checks eth_getCode, eth_getStorageAt, eth_call, eth_estimateGas, and eth_getLogs against what the constructor did. - `assertEVMOnlyNodeInfo` covers net_version, eth_syncing, and the fee suggestions - `assertEVMOnlyNewHeads` subscribes to newHeads over each node's WebSocket port and matches the pushed head to the served block. Assertions reuse the existing helpers and per-node client pattern. The README's method list is rewritten to match what the EVM-only RPC serves, with lists of methods not supported yet and not planned, a short known-limitations section, and fixes to stale lines (the cast wallet new jq path, pruned heights returning an error rather than null, and the removed claim that there are no fee, log, or WebSocket methods). Test plan - [x] make autobahn-integration-test passes locally (all four subtests) - [x] go vet -tags autobahn_integration ./integration_test/autobahn/... - [x] gofmt, goimports, and golangci-lint fmt --diff clean - [x] Contract bytecode checked in go-ethereum's EVM before use - [x] Every README limitation checked against the code Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3118674 commit 5032b92

2 files changed

Lines changed: 587 additions & 54 deletions

File tree

‎integration_test/autobahn/README.md‎

Lines changed: 90 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -370,43 +370,84 @@ For local debugging, follow a validator's `seid` log:
370370
tail -f build/generated/logs/seid-0.log
371371
```
372372

373-
The public EVM JSON-RPC surface intentionally contains only:
374-
375-
- `eth_sendRawTransaction`, used by `sei-load` and `cast publish`;
376-
- `eth_getTransactionReceipt`, for finalized receipts;
377-
- `eth_getTransactionByHash`, for a finalized transaction's decoded fields;
378-
- `eth_getBalance`, for an address's EVM balance at the latest or a past block;
379-
- `eth_getTransactionCount`, for an address's nonce at the latest or a past
380-
block;
381-
- `eth_getCode`, for the contract code at an address at the latest or a past
382-
block;
383-
- `eth_getStorageAt`, for the value of a contract storage slot at the latest or
384-
a past block;
385-
- `eth_blockNumber`, for the current committed block height;
386-
- `eth_chainId`, for the configured EVM chain ID;
387-
- `eth_call`, for a read-only message call against current committed state;
388-
- `eth_estimateGas`, for the lowest gas limit that lets a message succeed
389-
against current committed state;
390-
- `eth_getBlockByNumber` and `eth_getBlockByHash`, for a finalized block, by
391-
height (including any height still within the node's retention window) or
392-
by hash;
393-
- `eth_getBlockTransactionCountByNumber` and
394-
`eth_getBlockTransactionCountByHash`, for the number of transactions in a
395-
finalized block, resolved the same way as `eth_getBlockByNumber` and
396-
`eth_getBlockByHash`;
397-
- `eth_getBlockReceipts`, for the receipts stored for a finalized block, by
398-
height, tag, or hash. Tags resolve to the latest block whose receipts are
399-
indexed, and a block whose receipts are not indexed yet returns `null`. Only
400-
receipts stored for that block are listed: a rejected transaction with no
401-
receipt is skipped, and a repeated transaction's receipt stays with the block
402-
where it first executed.
403-
- `eth_getTransactionByBlockNumberAndIndex` and
404-
`eth_getTransactionByBlockHashAndIndex`, for the transaction at a position in
405-
a finalized block, exactly as the full-transaction `eth_getBlockByNumber` and
406-
`eth_getBlockByHash` list it.
407-
408-
All other `eth_*` methods currently return JSON-RPC method-not-found. A lookup
409-
for a pending or unknown hash returns `null`.
373+
The EVM-only JSON-RPC serves these methods over HTTP (port 8545 by default) and
374+
WebSocket (port 8546 by default):
375+
376+
- Transactions: `eth_sendRawTransaction` (used by `sei-load` and
377+
`cast publish`), `eth_getTransactionReceipt`, `eth_getTransactionByHash`,
378+
and `eth_getTransactionByBlockNumberAndIndex` /
379+
`eth_getTransactionByBlockHashAndIndex`, which return the transaction at a
380+
position in a block exactly as the full-transaction block lists it.
381+
- State: `eth_getBalance`, `eth_getTransactionCount`, `eth_getCode`, and
382+
`eth_getStorageAt`, at the latest block or a past one still within a full
383+
node's retention window; `eth_call` and `eth_estimateGas`, against the
384+
latest state only.
385+
- Blocks: `eth_blockNumber`, `eth_getBlockByNumber`, `eth_getBlockByHash`,
386+
`eth_getBlockTransactionCountByNumber` /
387+
`eth_getBlockTransactionCountByHash`, and `eth_getBlockReceipts`. Block
388+
lookups accept any height still within the node's retention window.
389+
`eth_getBlockReceipts` lists only receipts stored for that block: a rejected
390+
transaction with no receipt is skipped, and a repeated transaction's receipt
391+
stays with the block where it first executed. Its tags resolve to the latest
392+
block whose receipts are indexed, and a block whose receipts are not indexed
393+
yet returns `null`.
394+
- Logs: `eth_getLogs`.
395+
- Fees: `eth_gasPrice`, `eth_maxPriorityFeePerGas`, and `eth_feeHistory`.
396+
- Node: `eth_chainId`, `net_version`, and `eth_syncing`, which returns a
397+
not-supported error, as on the regular RPC.
398+
- Subscriptions, over WebSocket only: `eth_subscribe("newHeads")`.
399+
400+
A lookup for a pending or unknown hash returns `null`. Every other method
401+
returns JSON-RPC method-not-found, and `eth_subscribe` rejects any
402+
subscription other than `newHeads`:
403+
404+
- Not supported yet: the `debug_*` tracing and raw-data methods, the polling
405+
filter methods (`eth_newFilter`, `eth_newBlockFilter`,
406+
`eth_newPendingTransactionFilter`, `eth_getFilterChanges`,
407+
`eth_getFilterLogs`, `eth_uninstallFilter`), `eth_subscribe("logs")`,
408+
`eth_getVMError`, `eth_getTransactionErrorByHash`, `eth_createAccessList`,
409+
`eth_estimateGasAfterCalls`, and `web3_clientVersion`.
410+
- Not planned, because they need something the EVM-only chain does not have
411+
(Cosmos accounts, server-side keys, a mempool view, blobs, or state proofs),
412+
duplicate another method, or are development-only: `sei_getSeiAddress`,
413+
`sei_getEVMAddress`, `sei_getCosmosTx`, `eth_sign`, `eth_signTransaction`,
414+
`eth_sendTransaction`, `eth_accounts`, `eth_coinbase`, `eth_getNonce`,
415+
`txpool_content`, `eth_blobBaseFee`, `eth_getProof`, and the `echo` and
416+
`test` namespaces.
417+
418+
### Known limitations
419+
420+
- Past state needs a full node. `eth_getBalance`, `eth_getTransactionCount`,
421+
`eth_getCode`, and `eth_getStorageAt` answer an explicit height or
422+
`earliest` only on a node that keeps the EVM state store (a full node, not a
423+
validator), and only within its retention window. A block hash returns an
424+
error. `eth_call` and `eth_estimateGas` serve the latest state only.
425+
- Any address that has never been written reports `2^200` wei, including
426+
inside `eth_call` and `eth_estimateGas`. This is the test network's funding
427+
rule, in place of genesis allocations.
428+
- `eth_call` and `eth_estimateGas` take no state or block override arguments,
429+
unlike the regular RPC.
430+
- `pending` means the latest committed state, and there is no mempool view, so
431+
a submitted transaction is not returned by hash until it executes.
432+
- Block fields: `logsBloom` is always empty, `baseFeePerGas` is always zero,
433+
`gasLimit` is the current limit even for old blocks, and `gasUsed` covers
434+
one Autobahn lane. `stateRoot` is the app hash and `receiptsRoot` the
435+
results hash, not Ethereum trie roots.
436+
- A block lists every finalized transaction, including rejected ones, and
437+
`transactionIndex` is the position in that list, so a block's receipts can
438+
skip positions. Hiding rejected transactions from block results is planned.
439+
- `eth_getLogs` covers at most 2,000 blocks and 10,000 logs per query, and a
440+
bound outside the indexed, retained range returns an error.
441+
`eth_feeHistory` covers at most 1,024 blocks.
442+
- `newHeads` is the only subscription.
443+
- Blocks and receipts below the node's retention window are pruned: a lookup by
444+
number returns an error, and a lookup by hash returns `null`.
445+
- Blob (EIP-4844) transactions are not accepted.
446+
447+
`make autobahn-integration-test` starts a local four-validator cluster and,
448+
after a 4,000-transfer load and one contract deploy, checks every method above
449+
on all four validators, including that they return the same blocks and
450+
receipts.
410451

411452
### Request and WebSocket limits
412453

@@ -475,7 +516,7 @@ offline, publish the raw transaction, and fetch its receipt:
475516

476517
```sh
477518
RPC_URL=http://127.0.0.1:8545
478-
TEST_KEY=$(cast wallet new --json | jq -r '.[0].private_key')
519+
TEST_KEY=$(cast wallet new --json | jq -r '.data[0].private_key')
479520
RAW_TX=$(cast mktx \
480521
0x000000000000000000000000000000000000dEaD \
481522
--private-key "$TEST_KEY" \
@@ -620,11 +661,11 @@ cast block --rpc-url http://127.0.0.1:8545 1
620661
cast block --rpc-url http://127.0.0.1:8545 0xYOUR_BLOCK_HASH
621662
```
622663

623-
A height above the current chain head, `earliest` (this executor's first
624-
committed height is 1, not 0), or a height the node has since pruned all
625-
return `null` rather than an error, matching `eth_getTransactionByHash`'s
626-
treatment of an unknown hash. `nonce`, `mixHash`, `sha3Uncles`, `difficulty`,
627-
`extraData`, `uncles`, and `totalDifficulty` are always their
664+
A height above the current chain head or `earliest` (this executor's first
665+
committed height is 1, not 0) returns `null`, matching
666+
`eth_getTransactionByHash`'s treatment of an unknown hash. A height the node
667+
has since pruned returns an error. `nonce`, `mixHash`, `sha3Uncles`,
668+
`difficulty`, `extraData`, `uncles`, and `totalDifficulty` are always their
628669
Ethereum-inapplicable zero value, matching `eth_getBlockByNumber` on the
629670
regular (non-EVM-only) RPC. `logsBloom` is always empty, unlike the regular
630671
RPC, which aggregates it from a receipt per transaction. `gasUsed` and the
@@ -643,21 +684,19 @@ transaction counts, and the by-block-and-index lookups) all report that full
643684
list. Two kinds of rejected transaction have no receipt at the block that lists
644685
them:
645686

646-
- A transaction that can still succeed later (nonce too high or insufficient
647-
funds) has no receipt; `eth_getTransactionReceipt` returns `null` unless it
648-
later executes in another block, and then reports that block.
687+
- A transaction rejected for any reason other than an already-used nonce (for
688+
example nonce too high, insufficient funds, or the block's gas limit
689+
reached) has no receipt; `eth_getTransactionReceipt` returns `null` unless
690+
it later executes in another block, and then reports that block.
649691
- A transaction repeated after it already executed keeps its original receipt,
650692
so `eth_getTransactionReceipt` and `eth_getTransactionByHash` report the
651693
earlier block and index where it ran.
652694

653695
Indexers that pair each listed transaction with a receipt at the same block
654696
and index should expect these two cases.
655697

656-
The remaining `cast` gaps are RPC gaps, not receipt-decoding gaps. `sei-load`
657-
does not currently print every submitted hash.
658-
There are also no fee-estimation, log, or WebSocket subscription methods.
659-
Commands that depend on those queries cannot operate normally; raw
660-
transactions must still provide gas price offline as in the example above.
698+
`sei-load` does not currently print every submitted hash. `cast` commands
699+
that depend on a method listed above as not supported cannot operate normally.
661700

662701
## Tear down
663702

0 commit comments

Comments
 (0)