Skip to content

test(zebra-rpc): assert submitblock serializes an accepted block to result: null - #11250

Open
natalieesk wants to merge 1 commit into
mainfrom
rpc_submitblock_accepted_null_test_10571
Open

test(zebra-rpc): assert submitblock serializes an accepted block to result: null#11250
natalieesk wants to merge 1 commit into
mainfrom
rpc_submitblock_accepted_null_test_10571

Conversation

@natalieesk

Copy link
Copy Markdown
Contributor

Motivation

Closes #10571.

A report claimed accepted submitblock responses omit the JSON-RPC result member (so a strict client sees {"jsonrpc":"2.0","id":"submitblock"} with no result). It is not reproducible: SubmitBlockResponse::Accepted is a unit variant under #[serde(untagged)], which serializes to an explicit null, 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 to serde_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 test -p zebra-rpc --lib -- methods::types::submit_block::tests
test result: ok. 2 passed

cargo fmt and cargo clippy -p zebra-rpc --lib --all-features are clean.

Specifications & References

zcashd submitblock contract: acceptance is a null result, 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

  • No AI tools were used in this PR
  • AI tools were used: Claude (Claude Code) — wrote the tests and this description.

PR Checklist

  • The PR title follows conventional commits format: type(scope): description
  • The PR follows the contribution guidelines.
  • This change was discussed in an issue or with the team beforehand.
  • The solution is tested.
  • The documentation and changelogs are up to date.

…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.
@v12-auditor

v12-auditor Bot commented Aug 12, 2026

Copy link
Copy Markdown

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 f5c5277...6da4fdc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-testing Category: These are tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

submitblock omits JSON-RPC result member when a block is accepted

2 participants