Repository navigation
feat(jsonrpc): return code 3 for revert and 4444 for pruned history - #7004
Open
0xbigapple wants to merge 5 commits into
Open
0xbigapple wants to merge 5 commits into
0xbigapple wants to merge 5 commits into
Conversation
- eth_call / eth_estimateGas: contract revert changes from -32000 to 3 - data a node does not have (pruned on a LiteNode, or receipts with transHistory.switch off) returns 4444 "Pruned history unavailable"
- 4444 no longer carries the earliest available block in data, as geth - remove ResultCodeUtil; constant calls record only REVERT - test that a reverted constant call sets contractRet to REVERT
…ove init methods to the top - rename probeLowestBlockNumOfReceiptStore to initLowestBlockNumOfReceiptStore - move init and initLowestBlockNumOfReceiptStore to the top of ChainBaseManager methods
0xbigapple
requested review from
317787106 and
waynercheung
and removed request for
bladehan1
September 28, 2026 13:11
Collaborator
|
A few points from the parameter-handling review. These issues predate this PR, but the new
Some optional naming improvements:
The existing issues outside this PR’s scope can be handled in this PR or follow-ups. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of two PRs for #6676; request validation is split out (see Follow up).
What does this PR do?
Aligns two JSON-RPC error behaviors with the Ethereum Execution API:
Contract revert returns code
3.eth_callandeth_estimateGasreturncode: 3instead of-32000; other execution failures stay-32000.Wallet.callConstantContractnow recordscontractReton the result, so the JSON-RPC layer classifies on the enum rather than on the error message.Pruned history returns
4444 "Pruned history unavailable".eth_getBlockByNumber,eth_getBlockTransactionCountByNumber,eth_getTransactionByBlockNumberAndIndex): on a LiteNode, heights below the lowest stored block. Genesis stays queryable.eth_getBlockReceipts,eth_getLogs,eth_newFilter), including when the block is selected by hash: on any node whentransHistory.switch = off; otherwise on a LiteNode, heights below the lowest receipt block (the first block intransactionRetStore, read at startup). A FullNode has no such check — receipts from before June 2019 may still be served fromTransactionHistoryStore, so the store's first key is not a lower bound — and receipt gaps on a FullNode keep the current behavior.datais the"{}"placeholder every java-tron JSON-RPC error has.earliestresolves to the lowest block with all persisted data: on a LiteNode the lowest receipt block (the lowest stored block when receipts are not persisted), on a FullNode 0.Why are these changes required?
-32000, a contract revert cannot be told apart from out-of-energy or any other TVM failure.nullfor pruned blocks, which reads as "block does not exist", andeth_getLogsacross the cutoff returns incomplete results without an error.Breaking changes (release-note items):
eth_call/eth_estimateGas: a contract revert returns3instead of-32000.4444instead ofnullon block-body methods, and instead of-32000or incomplete results on receipt and log methods.transHistory.switch = off: receipt and log queries return4444, including for receipts already on disk.earlieston a LiteNode resolves to the lowest available block instead of 0.This PR has been tested by:
Follow up
jsonrpcversion, non-stringmethod, explicitid: null) in a new PR.Extra details
triggerConstantContractresponses now carrycontractRet: REVERTwhen the call reverts.3, including one with empty revert data; geth returns-32000in that case.eth_getLogsfrom0x0to a later block on a LiteNode returns4444, as geth does.null. Wheneth_getBlockReceiptsoreth_getLogsdoes find the block by hash, its number is known and the receipt rules above apply.eth_getBlockByHash,eth_getTransactionByHashandeth_getTransactionReceiptare unchanged.