test(zebra-rpc): assert submitblock serializes an accepted block to result: null - #11250
Open
natalieesk wants to merge 1 commit into
Open
test(zebra-rpc): assert submitblock serializes an accepted block to result: null#11250natalieesk wants to merge 1 commit into
natalieesk wants to merge 1 commit into
Conversation
…esult: null A report claimed accepted `submitblock` responses omit the JSON-RPC `result` member. It was not reproducible: `SubmitBlockResponse::Accepted` is a unit variant under `#[serde(untagged)]`, which serializes to an explicit `null`, so the response carries `"result": null`. Add unit tests locking this in — accepted serializes to `null`, and a non-accepted response serializes to its kebab-case string reason.
|
Note Complete: Audit complete. No review-worthy issues remain after automatic triage. One finding was auto-invalidated. Open the full results here. Analyzed one file, diff |
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.
Motivation
Closes #10571.
A report claimed accepted
submitblockresponses omit the JSON-RPCresultmember (so a strict client sees{"jsonrpc":"2.0","id":"submitblock"}with noresult). It is not reproducible:SubmitBlockResponse::Acceptedis a unit variant under#[serde(untagged)], which serializes to an explicitnull, so the response carries"result": null. The reported omission was almost certainly on the client side (the Stratum bridge). This PR locks the correct behaviour in with tests so the issue can be closed as not-reproducible.Solution
Add unit tests in
zebra-rpc/src/methods/types/submit_block.rs: an accepted response serializes toserde_json::Value::Null, and a non-accepted response serializes to its kebab-case string reason ("rejected"), matching the Zcash RPC contract. No behaviour change — tests only.Tests
cargo fmtandcargo clippy -p zebra-rpc --lib --all-featuresare clean.Specifications & References
zcashd
submitblockcontract: acceptance is anullresult, rejection is a string reason (https://zcash.github.io/rpc/submitblock.html).Follow-up Work
None. The issue is not-reproducible and can be closed once this merges.
AI Disclosure
PR Checklist
type(scope): description