test: replace the stateful mining RPC tests with regtest coverage - #11246
Open
oxarbitrage wants to merge 4 commits into
Open
test: replace the stateful mining RPC tests with regtest coverage#11246oxarbitrage wants to merge 4 commits into
oxarbitrage wants to merge 4 commits into
Conversation
|
Warning No auditable source files found in this PR's 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
Over the last 40
mainruns,rpc-submit-blockfailed 64% of the time andrpc-get-block-template46% — every failure I sampled a one hour timeout with zero panics and zeroassertion failures. Both sync a cached mainnet state to the tip before testing anything, so they
die in that prologue on
Transaction(TransparentInputNotFound)(#11168) and never reach their ownassertions. They test a sync bug that already has an issue, not the mining RPCs.
Implements Track A of #9941.
Solution
Two commits adding coverage, then two removing what they replace.
Added — unit tests for
LongPollId::submit_old(), which had none, andgetblocktemplate_long_poll_returns_submit_old_false_on_new_tipon Regtest: start a long poll,advance the tip with
generate, require a promptsubmit_old: falseand a template that validatesin proposal mode.
Removed —
stateful::rpc::rpc_submit_blockandstateful::rpc::rpc_get_block_template, withtheir GCP jobs.
submitblockis already better covered on Regtest, on every PR, in seconds: 200 submissions withtyped
Acceptedinsubmit_blocks_test, plus typedRejectedassertions innu6_funding_streams_and_coinbase_balancethat the deleted test never made.getblocktemplate'sonly unique coverage was long-poll invalidation, and the deleted test never asserted it — it
pushed to a channel
if let Some(false) = ...submit_old()and passed anyway when that never fired.So this is the first real assertion of that path, triggered deterministically.
Two deliberate trade-offs: no GCP job covers mining RPCs after this (intended; ten others still gate
integration-tests-success), and Regtest disables PoW and submits coinbase-only blocks, whichreaches no code inside
submit_block. Residual gap in Follow-up Work.Tests
zebra-rpc --lib91/91, clippy and fmt clean, new Regtest test stable over 4 runs at ~25s, all fourcommits compile standalone. Mutating
submit_old()to always returntruefails the new tests —the deleted test would still have passed. No changelog needed for a
test:PR.Specifications & References
#9941 (Track A plan), #11168 (the sync bug these jobs actually failed on), and BIP 22 long polling,
origin of
submitold: https://en.bitcoin.it/wiki/BIP_0022#Optional:_Long_PollingFollow-up Work
Acceptedfor a transaction-bearing Regtest block; everything needed is in tree, andTrack B needs the same helper.
AI Disclosure
description. Findings were verified against the code and CI logs.
PR Checklist
type(scope): description