fix(ReceiptForRpc): omit non-spec error field from receipt JSON-RPC responses#11454
fix(ReceiptForRpc): omit non-spec error field from receipt JSON-RPC responses#11454
error field from receipt JSON-RPC responses#11454Conversation
…and ignore in JSON output
error field from receipt JSON-RPC responses
|
Claude finished @manusw7's task in 3m 29s —— View job PR Review
SummaryThe fix is spec-correct: One medium issue needs to be addressed or explicitly acknowledged before merge. FindingsMedium —
|
| public Hash256? Root { get; set; } | ||
| public long? Status { get; set; } | ||
|
|
||
| [JsonIgnore] |
There was a problem hiding this comment.
Medium — [JsonIgnore] suppresses deserialization too, silently breaking debug_insertReceipts
Plain [JsonIgnore] is equivalent to JsonIgnoreCondition.Always, which excludes the property from both serialization and deserialization in System.Text.Json. The serialization suppression is the intended fix, but the deserialization side effect is a regression.
Affected path — DebugRpcModule.debug_insertReceipts (line 213):
debugBridge.InsertReceipts(blockParameter, receiptForRpc.Select(static r => r.ToReceipt()).ToArray());ReceiptForRpc is deserialized from the caller's JSON body. With [JsonIgnore], any "error" field the caller includes is now silently dropped, so ToReceipt() always produces TxReceipt { Error = null }. Previously the caller's error string was preserved.
TxReceiptConverter.Read() is not additionally affected: TxReceiptConverter.Write() never emitted error, so the round-trip was already lossy there before this PR.
Since error is non-spec data and debug_insertReceipts is a debug-only endpoint the practical impact is low, but the behavioural change should be acknowledged. If you want to preserve read-side behaviour, a [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] won't help (it would still emit non-null values); a custom converter or a separate setter-only property would be needed — likely overkill here. Explicitly documenting the intent (e.g. a comment or a test) would be sufficient.
|
@claude review again |
|
Claude finished @manusw7's task in 1m 10s —— View job PR Review
SummaryThe previous Medium finding (deserialization side-effect on The PR is spec-correct, well-tested, and no outstanding Medium (or above) issues remain. What's now in the PR
What looks good
Low — No remaining issuesNo Critical, High, or Medium findings. |
|
@manusw7 please attach hive tests job run |
https://github.com/NethermindEth/nethermind/actions/runs/25318851815 |
| [JsonIgnore] | ||
| public string? Error { get; set; } |
There was a problem hiding this comment.
why not remove the property entirely?
There was a problem hiding this comment.
my though was that even if it should not be in the rpc response, keeping error internally can still be useful for internal use/debugging
There was a problem hiding this comment.
not really, it is there in Receipt, we can drop it from RPC type
Fixes #11207
Changes
ReceiptForRpc.Errorwith[JsonIgnore]so it is no longer emitted in JSON-RPC responses. The Ethereum execution-apisReceiptInfoschema declaresadditionalProperties: false, prohibiting the non-standarderrorfield that Nethermind previously included for failed transactions.eth_getBlockReceipts,eth_getTransactionReceipt,parity_getBlockReceipts, proof receipt sub-object inProofRpcModule, and the internalDataFeedmonitoring stream.EthRpcModuleTestshardcoded JSON expectations to drop,"error":"error".Error_field_is_not_serializedinReceiptsForRpcTestsasserting the field is absent from serialized output.Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Nethermind.JsonRpc.Test/Data/ReceiptsForRpcTests.cs.rpc-testsfixtures:eth_getBlockReceipts/test_01(pre-Byzantium block0x41B582withBadInstruction) andtest_07(post-Byzantium block with revert reasons) now match Geth-aligned expectations.Documentation
Requires documentation update
Requires explanation in Release Notes
JSON-RPC receipt responses no longer include the non-standard
errorfield on failed transactions. This aligns Nethermind with the Ethereum execution-apis spec and Geth behavior.Clients that relied on this field for failure reasons should use
debug_traceTransactioninstead.