3 minor findings · 7 suggestions
Earlier concerns neither republished nor resolved: 2 minor findings · 5 suggestions. See the Run archive for their assessments.
Findings
[minor] · Regtest activation changes existing mining clients without a compatibility note
This 32.x backport newly enforces BIP54 on regtest, rejecting segwit-only GBT requests and noncompliant custom blocks, but its release note mentions only Testnet5.
Location: src/kernel/chainparams.cpp:740 (head).
Details and suggested fix
With the request fixed at {"rules":["segwit"]}, base regtest accepts it but head throws -8 because consensuscleanup is active and non-optional. Custom blocks must also use coinbase nLockTime = height - 1 and a non-final nSequence, and satisfy the new size, sigops and timestamp constraints. Base Core's assembler already sets those coinbase fields correctly, so this is not a blanket failure of older Core-generated blocks. If retaining this default on 32.x, add a regtest compatibility note covering the requirements and the deployment-override configuration available to legacy fixtures. Keeping regtest inactive and explicitly activating BIP54 in its tests would instead preserve the existing default contract.
[minor] · Future-leaf BIP54 vector repeats the Tapscript spend
The BIP54 unit test records the ordinary Tapscript spend twice, so its future-leaf-version case and generated vector do not exercise a 0xc2 leaf.
Location: src/test/bip54_tests.cpp:1100 (head).
Details and suggested fix
The first successful SignSignature call leaves sigdata.complete set. Changing the keystore keys and tr_spenddata does not clear it, so the second call returns immediately from ProduceSignature; UpdateInput then copies the old Tapscript witness back. Verification succeeds on that unchanged spend, which is recorded under the future-leaf description. Construct the witness explicitly from leaf_script_future and its control block from builder.GetSpendData(), then assert the masked control-block leaf version is 0xc2 and verify the input under consensus flags. Resetting complete alone is insufficient because SignTaprootScript only signs Tapscript leaves.
[minor] · BIP support versions omit the 32.x backport
Both new bips.md entries name only v33.0, which would misstate feature availability when these changes ship in a 32.x release.
Location: doc/bips.md:21 (head).
Details and suggested fix
The BIP54 entry dates implementation to v33.0, and the BIP95 entry dates -testnet5 support to the same version. Neither records availability on this release branch. Add the actual 32.x backport release to both entries, retaining the upstream introduction version if desired, as the BIP65 entry does. The exact shipping point release is not established by the current 32.1 build metadata, so that number needs to be supplied during release preparation.
Optional improvements
[suggestion] · Mempool compatibility changes are absent from release notes
The backport changes mempool reject strings on existing networks, including mainnet, and removes the test-network -acceptnonstdtxn sigops bypass, but documents only Testnet5.
Location: src/consensus/tx_verify.cpp:204 (head).
Details and suggested fix
For transactions reaching these checks, aggregate BIP54-sigops rejection changes from bad-txns-nonstandard-inputs to bad-txns-legacy-sigops, and exactly-64-byte witness-stripped rejection changes from tx-size-small to txn-size-64. Both now use the internal TX_CONSENSUS classification independently of activation. Moving the sigops check outside require_standard also prevents -acceptnonstdtxn=1 from bypassing it on test networks. Add a compatibility note listing the new reject strings and stricter test-network admission behavior. These mempool changes do not activate BIP54 block rules on mainnet.
[suggestion] · Inactive-deployment mempool enforcement lacks coverage
The new coverage never combines mempool admission with inactive BIP54, so it does not distinguish unconditional enforcement from deployment-gated enforcement.
Location: test/functional/feature_bip54.py:366 (head).
Details and suggested fix
PreChecks correctly passes enforce_bip54=true, unlike block connection's deployment-gated argument. The preactivation section here only submits blocks, while mempool_sigoplimit.py uses default, active regtest cleanup and the unit tests pass true directly. Add an inactive-deployment mempool rejection for an over-limit spend with default policy and with -acceptnonstdtxn=1, plus a fee-paying 2500-sigop control. Confirm the preparation transaction first and avoid other standardness failures masking the sigops result. The existing bare-script helper needs adaptation because its scriptSig is non-push-only and its spend pays no fee. Keep the assertion that the over-limit spend can still be mined before activation.
[suggestion] · BIP54-sigops rejects lose txid caching
Witness-bearing BIP54-sigops rejects now cache only their wtxid, allowing eligible child orphans to trigger repeated parent fetching and cheap revalidation; existing orphan and request limits still bound this work.
Location: src/consensus/tx_verify.cpp:205 (head).
Details and suggested fix
Under default standardness, this failure previously returned TX_INPUTS_NOT_STANDARD, which makes MempoolRejectedTx additionally cache the txid of a witness transaction. Returning TX_CONSENSUS skips that insertion. Since orphan handling checks parents by txid, a peer can now supply an eligible child and serve the rejected parent again with a different witness. The sigops result depends only on non-witness data, so that retry cannot help. Preserve txid caching for bad-txns-legacy-sigops specifically. This restores the existing optimization without treating all consensus failures as witness-independent; other such failures already share the current bounded behavior.
[suggestion] · Mandatory cleanup-rule rejection is not tested
mining_basic.py checks the advertised rule but does not exercise the rejection of segwit-only clients.
Location: test/functional/mining_basic.py:488 (head).
Details and suggested fix
The {} request fails at the earlier segwit-specific check, and NORMAL_GBT_REQUEST_PARAMS now includes both rules. Neither assertion depends on the active-deployment explicit-support guard rejecting an unsupported client. Add assert_raises_rpc_error(-8, "Support for 'consensuscleanup' rule requires explicit client support", node.getblocktemplate, {"rules": ["segwit"]}) alongside these assertions. It would protect the guard that prevents unaware clients from receiving templates requiring BIP54 coinbase changes.
[suggestion] · Testnet5 chain-selection branches lack coverage
The added alias and conflict term are absent from the argument-parsing tests, so those tests would not detect selecting the wrong chain or accepting conflicting flags.
Location: src/common/args.cpp:940 (head).
Details and suggested fix
util_GetChainTypeString registers and exercises Testnet3, Testnet4 and regtest, but not the new Testnet5 paths. Extend the fixture registration and assertions so -testnet5 and -chain=testnet5 select testnet5, -notestnet5 leaves main selected, and combining -testnet5 with -testnet4 or -chain=main throws. This would distinguish the new selection branch and conflict-count term from the otherwise similar existing-network cases.
[suggestion] · BIP54 fuzzing has no accounting oracle
The new fuzz target ignores the boolean result, so incorrect sigop accounting cannot fail the harness unless it also crashes.
Location: src/test/fuzz/bip54.cpp:53 (head).
Details and suggested fix
Accumulate an independent total across all constructed inputs and assert that CheckSigopsBIP54 agrees with total <= MAX_TX_BIP54_SIGOPS. Sum both scriptSig.GetSigOpCount(true) and the spent scriptPubKey's GetSigOpCount(scriptSig). The latter matters for P2SH: a malformed or non-push-only scriptSig contributes no redeem-script count, so counting the supplied redeem script directly would create false failures. This would test transaction-level aggregation, including omitted scriptSig counts or a running total reset per input, while preserving the existing crash coverage.
[suggestion] · The data-directory table omits Testnet5
The new network stores chain data in <datadir>/testnet5/, but doc/files.md gives users no Testnet5 mapping.
Location: src/chainparamsbase.cpp:50 (head).
Details and suggested fix
CreateBaseChainParams selects the testnet5 subdirectory, while the documented table lists every other supported chain. Add a row mapping -chain=testnet5 or -testnet5 to path_to_datadir/testnet5/ so users can locate the new network's files.
Backport verdict: Needs clarification
I couldn't confirm that this backport matches upstream. The packet lists 27 commits but resolves none of them to an upstream original, and no commit has Rebased-From or GitHub-Pull trailers. All 22 BIP54 commits (#35793) and all 5 Testnet5 commits therefore went unchecked against their originals. The PR description also says it should stay in draft "until #35793 lands", so it's unclear whether the BIP54 consensus commits being backported were ever merged on master. The target is the v32.1 release branch (CMakeLists sets 32.1.0 as a release). That makes several head-state items concrete problems for a point release. The docs say v33.0. The release note is a master-style snippet that leaves out user-visible BIP54 changes. Regtest now always enforces BIP54, so getblocktemplate fails for any client that doesn't pass 'consensuscleanup'. Mempool reject reasons change on every network. Testnet5 still has a TODO for its header-sync parameters, and its genesis contradicts the PR description. In the code I read, the Testnet5 wiring and the BIP54 validation hooks look internally consistent. I found no independently established code defect, so the verdict is Needs clarification rather than Defective.
Evidence:
- Missing provenance for all 27 commits (187f50f, 9c80714, 61efe64, b38223d, 1852d8c, 6622bfa, 9c09317, 31f89e5, 079297b, 06f8418, 8da847c, 196109b, 4065d73, 1d6b2f6, 69d6954, 6479f7b, ec85086, 7b2be92, b415126, 07dcb89, f99c168, be80686, ef12208, f45ad14, 5f5fcf3, d1b5fd6, ee50560): the packet says "No resolved Rebased-From provenance", sources is empty, and wreck_read_upstream_commit rejected the #35793 head SHA cited in the discussion (58b418f8…) as invalid. None of these commits was compared with an original, and the patches for f45ad14, 5f5fcf3, d1b5fd6 and ee50560 were also left out of the packet. I reviewed their changes only at the PR head (bitcoinkernel*.h/.cpp, kernel/chainparams.cpp, versionbits_tests.cpp, bips.md, release-notes-testnet5.md). No commit is intentionally omitted: the PR description says the first 22 are #35793 and the last 5 are #35861.
- Target branch: base CMakeLists.txt sets CLIENT_VERSION 32.1.0 with CLIENT_VERSION_IS_RELEASE true, and base doc/release-notes.md is the 'v32.1 Release Notes'. So this is a point-release backport of new consensus code and a new network.
- At head, doc/bips.md says BIP 54 rules are 'implemented as of version v33.0' and BIP 95 Testnet 5 is 'supported as of v33.0 (PR #35861)'. Both are wrong if this ships in 32.x.
- Release notes: ee50560 adds doc/release-notes-testnet5.md, a master-style snippet that only describes testnet5. Nothing is integrated into the branch's release notes. Nothing mentions that regtest now always enforces BIP54, or that the mempool reject reasons change.
- Regtest RPC break: kernel/chainparams.cpp sets regtest DEPLOYMENT_CONSENSUSCLEANUP to ALWAYS_ACTIVE, and deploymentinfo.cpp sets gbt_optional_rule=false. Base rpc/mining.cpp:1016-1021 throws 'Support for '%s' rule requires explicit client support' for any active non-optional rule the client doesn't list. Existing regtest and testnet5 getblocktemplate clients that send only ['segwit'] will now get an RPC error. The PR has to change NORMAL_GBT_REQUEST_PARAMS to add 'consensuscleanup' for the same reason.
- Mempool changes on every network (6622bfa, b415126): validation.cpp PreChecks calls CheckTxInputs(..., enforce_bip54=true), which now rejects with TX_CONSENSUS 'bad-txns-legacy-sigops' where policy used to say 'bad-txns-nonstandard-inputs'. That check can no longer be bypassed with -acceptnonstdtxn on test networks. 64-byte transactions now get 'txn-size-64' instead of 'tx-size-small'. The base 32.1 release notes describe the bad-txns-nonstandard-inputs debug messages (#29060), so RPC consumers can see these changed strings.
- Disconnection risk: I checked the commit-message claim that TX_CONSENSUS no longer drives disconnection on this branch. Base has no MaybePunishNodeForTx and no TX_CONSENSUS use in net_processing. Base txdownload_tests maps TX_CONSENSUS to a wtxid-only reject, so relabeling the result does not add a disconnect risk here.
- Branch prerequisites already exist at base: src/node/miner.cpp:182/211 sets the coinbase nSequence to MAX_SEQUENCE_NONFINAL and nLockTime to height-1. test_framework create_coinbase (blocktools.py:184-185) does the same. This supports the regtest ALWAYS_ACTIVE change on this branch.
- I checked the tests that use previous releases (mempool_compatibility, feature_txindex_compatibility, feature_coinstatsindex_compatibility, wallet_backwards_compatibility). In each one the current-version node or the cached chain mines, and the old nodes only sync. The only tests where old nodes mine, wallet_ancient_migration and wallet_migration, get -vbparams=consensuscleanup:0:0 in 69d6954.
- Testnet5 params (head kernel/chainparams.cpp:480-573): powLimit 0000000000000fffff…, which is 0x1a0fffff; fPowAllowMinDifficultyBlocks=false; enforce_BIP94=false; consensuscleanup ALWAYS_ACTIVE on bit 3, below VERSIONBITS_NUM_BITS=5. The asserted genesis hash 00000000000008c1… is below that target. Every ChainType switch at head (bitcoin-cli, chainparams, chainparamsbase, guiutil, chaintype, networkstyle, kernel C API) has a TESTNET5 case, and LIST_CHAIN_NAMES was updated.
- Release prep: Testnet5 m_headers_sync_params still carries the comment 'TODO: regenerate, assumes GENESIS_TIME 2026-12-01 and MINCHAINWORK_HEADERS 52560'. The genesis nTime 1794632593 is 2026-11-14. The PR description says 'The Genesis block has not been mined yet', yet head hard-codes and asserts a genesis whose output script is OP_RETURN 95ebf76a02000000 and whose nVersion is 0x2230c000. I couldn't check those values against BIP95.
- Tests are present in source only: new tests include pow_tests get_next_work_min_difficulty_exception, CheckProofOfWork_test_testnet5_pow_limit and ChainParams_TESTNET5_sanity, versionbits_tests testnet5_consensuscleanup_activation, bip54_tests, fuzz bip54_sigops, and feature_bip54.py. There is no getchainparams-testnet5.json case for bitcoin-util. I have no runner records for the pinned head.
Required fixes:
- Show where each commit comes from: add Rebased-From or GitHub-Pull trailers, or give a mapping to the merged upstream commits of #35793 and #35861, so each backported commit can be compared with its original. If #35793 is not merged on master, say explicitly whether consensus code is meant to be backported before it lands.
- Change the doc/bips.md entries for BIP 54 and BIP 95 so they name the 32.x version this will ship in instead of v33.0.
- Put the release notes into the release branch's point-release notes instead of a stand-alone release-notes-testnet5.md snippet. They should also cover the user-visible BIP54 changes: regtest now always enforces BIP54; getblocktemplate on regtest and testnet5 requires the 'consensuscleanup' client rule; getdeploymentinfo gains 'consensuscleanup'; mempool reject reasons become 'bad-txns-legacy-sigops' and 'txn-size-64'; and the BIP54 sigops limit can no longer be bypassed with -acceptnonstdtxn.
- Get an explicit maintainer decision on whether always-on BIP54 on regtest (including the getblocktemplate break for clients that don't send 'consensuscleanup') is acceptable in a 32.x point release. If it isn't, scope the regtest activation out of the backport and adapt the tests.
- Before release, regenerate the Testnet5 HeadersSyncParams with contrib/devtools/headerssync-params.py using the actual genesis time and remove the TODO, or explain why the current values are acceptable.
- Confirm that the hard-coded Testnet5 genesis (message, OP_RETURN output script, nTime, nNonce, nVersion 0x2230c000) matches the final BIP95 specification, and update the PR description, which still says the genesis has not been mined.
Limitations:
- No upstream originals could be resolved: the evidence lists none and the upstream tools rejected the candidate SHA. Fidelity, upstream dependencies left out of the backport, and whether the adaptations were intentional are all unverified.
- Patches for f45ad14, 5f5fcf3, d1b5fd6 and ee50560, and parts of 6622bfa, 31f89e5, 1d6b2f6, 6479f7b, f99c168 and ef12208, were cut off or left out of the packet. I reviewed them only through the head diff, and not the whole of bip54_tests.cpp, feature_bip54.py or the JSON test vectors.
- I didn't retrieve the BIP95 text, so I couldn't check the Testnet5 genesis, magic, ports or difficulty against the spec. The BIP54 text I had was cut short.
- I don't know whether #35793 or #35861 was merged on master, or what the 32.x branch maintainers decided about scope.
- I saw no build, unit, functional or fuzz results for the pinned head. The tests I mention are present in source, not known to pass.
- Truncated Git evidence: show --format=fuller --no-ext-diff
- Evidence byte budget exhausted
- No resolved Rebased-From provenance
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: Gate mempool BIP54 enforcement on activation
- [minor]: The socket cap shortens unlimited CLI receive waits to 24.8 days (earlier report)
- [suggestion]: The Testnet5 release note omits mandatory mining requirements (earlier report)
- [suggestion]: The Tor backoff assertion can reject a correctly timed reconnect (earlier report)
- [suggestion]: An unused tx_verify.h include remains after the BIP54 move (earlier report)
- [suggestion]: Testnet5's BIP95 definition is split across introduction and activation (earlier report)
- [suggestion]: Release note incorrectly says minimum-difficulty blocks are disallowed (earlier report)
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
The 20-minute difficulty exception was deliberately retained in Testnet4 to permit CPU mining of nonstandard transactions and help the chain progress after substantial hashpower leaves.
At the pinned base, Testnet4 enables fPowAllowMinDifficultyBlocks. GetNextWorkRequired uses the minimum target after a timestamp gap exceeding twice the target spacing. Testnet5 disables this exception, changing an intentional accessibility and recovery mechanism rather than merely removing an accidental special case.
Source 1 · Source 2 · Source 3
Testnet4's retarget changes attempted to retain that accessibility while preventing a minimum-difficulty final block from resetting the next period's effective difficulty. Testnet5 instead prioritizes reliability and similarity to mainnet after sustained exploitation of the exception.
The base sets enforce_BIP94, causing retargets to use the first block's difficulty. The head's Testnet5 parameters disable both the exception and BIP94, while retaining ordinary retargeting. The contemporary Testnet5 account identifies persistent difficulty-exception exploitation as the motivation for removing the rule and specifies the higher minimum difficulty.
Source 1 · Source 2 · Source 3
BIP54's timestamp restrictions address incentive failures beyond ordinary timestamp accuracy: timewarp can accelerate subsidy extraction and impose additional validation load, while alternating timestamps can exploit the difficulty-adjustment bounds. Its two-hour grace period was chosen conservatively over Testnet4's ten-minute bound.
The head checks the first block of a retarget period against its predecessor and prevents the last block from preceding the period's first block. Testnet5 uses these BIP54 checks rather than Testnet4's tighter BIP94 boundary rule. The documented grace-period choice balances attack resistance against unnecessarily constraining historical timestamp behavior.
The BIP54 per-transaction signature-operation limit was designed to bound adversarial validation work without broadly disabling Script features or confiscating funds that depend on them. The authors chose 2,500 as the tightest limit that preserved non-pathological standard transactions and argued that it substantially reduces worst-case validation time and raises attack preparation costs.
The base already applies this accounting as input-standardness policy. The head moves it into consensus input validation, counting potentially executed non-witness operations in scriptSig and spent scripts, including P2SH redeem scripts. Block enforcement is deployment-gated, while mempool acceptance applies the check independently of activation.
Exactly 64-byte transactions are singled out because Bitcoin's Merkle construction does not distinguish their serialization from the concatenation of two child hashes. BIP54's authors preferred eliminating this ambiguity at consensus over requiring SPV verifiers to recognize and implement an additional mitigation.
The head rejects witness-stripped transactions of exactly 64 bytes in blocks after activation and in mempool prechecks. Smaller transactions remain nonstandard rather than becoming invalid under this new block rule. That distinction follows the specific Merkle ambiguity, not a general consensus minimum transaction size.
Requiring coinbases to be height-timelocked prevents future duplication of early coinbases whose scripts accidentally encode valid future BIP34 heights. BIP54 motivates this as a route away from costly BIP30 validation, including a check Utreexo clients cannot perform, and as a way to expose coinbase height without parsing Script.
The head requires nLockTime equal to block height minus one and a non-final nSequence when BIP54 is active, excluding genesis. These fields make the coinbase unavailable at earlier heights and therefore distinguish it from a historical duplicate. This explains the restriction; it does not establish that this patch removes all BIP30 checks.
Ralph's inferences
Once the minimum-difficulty exception is absent, BIP94's special choice of the first block as the retarget difficulty base is no longer needed for its original purpose: within a period, ordinary proof-of-work rules preserve the same target.
This explains the combination fPowAllowMinDifficultyBlocks=false and enforce_BIP94=false in Testnet5. The separate BIP54 timestamp checks retain protection against timestamp manipulation without retaining the exception-specific retarget mechanism.
Starting the new network with BIP54 active provides a public environment using the new validation rules without requiring a coordinated transition of an existing chain or implying mainnet activation.
The head marks consensuscleanup ALWAYS_ACTIVE on Testnet5 and regtest, but NEVER_ACTIVE by default on the other inspected networks. The Testnet5 versionbits test explicitly evaluates activation for block 1. This interpretation separates the new test network's rule set from a mainnet deployment decision.
Unresolved disagreements
The inspected history leaves a continuing tradeoff between cheap independent public-chain experimentation and resilience to difficulty-rule exploitation. Earlier participants emphasized laptop mining and recovery after hashpower withdrawal; the Testnet5 proposal emphasizes reliability and mainnet-like behavior. The retrieved record does not demonstrate how removing the exception will perform under future large hashpower departures.
Testnet5 deliberately removes the CPU-mining escape hatch and raises the difficulty floor while retaining the two-week retarget schedule. This is historical context for that release-branch behavior, not a finding that the choice is incorrect or a recommendation to restore the exception.