Skip to content

Prevent AuxPoW signalling in permissionless GBT - #22

Merged
kiwidream merged 1 commit into
0.1.xfrom
fix-issue-18-gbt-0.1.x
Jun 26, 2026
Merged

kiwidream merged 1 commit into
0.1.xfrom
fix-issue-18-gbt-0.1.x

Conversation

@kiwidream

@kiwidream kiwidream commented Jun 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Sanitize regtest permissionless -blockversion overrides that set the AuxPoW flag.
  • Keep permissionless getblocktemplate responses canonical with chain_id=0, auxpow=false, and low versionbits preserved.
  • Add functional regression coverage for -blockversion=0x20000100 while preserving benign BIP9 override behavior.

Root Cause

Permissionless block templates can be built without an AuxPoW payload, but a regtest -blockversion override could set an AuxPoW-signalling BIP9-shaped version. getblocktemplate then exposed a version that normal submitblock or proposal flow could not decode without an AuxPoW payload.

Validation

  • Docker lint image: docker run --rm ... bitcoin-linter
  • cmake --build build --target qbitd qbit-cli test_qbit -j4
  • ulimit -n 1024; build/bin/test_qbit --run_test=blockversion_tests
  • ulimit -n 1024; build/bin/test_qbit --run_test=cadence_tests
  • ulimit -n 1024; build/bin/test_qbit --run_test=testnet4_miner_tests
  • ulimit -n 1024; build/test/functional/test_runner.py mining_version_field.py feature_cadence_activation.py mining_basic.py
  • ulimit -n 1024; build/test/functional/test_runner.py feature_auxpow.py
  • Direct RPC smoke check: permissionless GBT returned 0x20000000, reconstructed createauxblock returned AuxPoW version 0x2f58c100, and submitauxblock returned null.

Fixes #18


Note

Medium Risk
Touches consensus-adjacent mining RPC and template version semantics; behavior change is narrow but affects how miners interpret GBT version and regtest overrides.

Overview
Permissionless getblocktemplate and regtest block assembly no longer expose block versions that signal AuxPoW or carry a non-zero chain ID. BIP9-shaped template versions are always canonicalized to chain_id=0 and auxpow=false while keeping the low deployment bits; regtest -blockversion overrides that set the AuxPoW flag get the same sanitization in the miner. AuxPoW mining stays on createauxblock / submitauxblock, which set AuxPoW versions explicitly.

Functional coverage was added for benign BIP9 -blockversion overrides (version rolling preserved) and for 0x20000100-style overrides (sanitized to a non-AuxPoW BIP9 version).

Reviewed by Cursor Bugbot for commit cddb2d0. Bugbot is set up for automated code reviews on this repo. Configure here.

@kiwidream

Copy link
Copy Markdown
Member Author

PR Review

Findings

No blocking source-level findings from this review pass.

CI note: Full Validation is currently red only because the lint job hit the known BuildKit helper metadata issue in .github/actions/configure-docker/buildkit-config.sh / ci/checks/test_configure_docker_buildkit_config.py. That issue is fixed upstream, so I am not treating it as an actionable finding against this PR’s source diff. Please rebase onto the upstream fix and rerun the required checks before merge.

Consensus Impact

Consensus-adjacent

This changes regtest/debug mining template construction and the getblocktemplate RPC response used for block construction, not block/header validity rules. src/node/miner.cpp:145 now clears AuxPoW-signalling BIP9 -blockversion overrides before ordinary permissionless templates are finalized, and src/rpc/mining.cpp:1091 canonicalizes permissionless GBT versions to chain_id=0, auxpow=false, preserving only low deployment bits. createauxblock remains separate and still explicitly sets the configured AuxPoW chain ID and flag.

Review Scope

Reviewed PR #22 at commit cddb2d00a56f6b429dcb5202d968f69ef8554266, base 0.1.x, head fix-issue-18-gbt-0.1.x, backing issue #18, full diff, PR/issue comments, review submissions, review threads, and CI jobs/logs. There are no PR comments, reviews, or unresolved threads.

Issue Fit

The PR matches #18’s requested sanitize option. The miner path clears only BIP9-shaped AuxPoW signalling via SignalsAuxpow(), preserving low versionbits. The RPC path returns MakeVersion(0, false, low_bits), so permissionless GBT no longer returns a version that requires an AuxPoW payload it does not contain. The added test covers 0x20000100 and a benign BIP9 override.

qbit-Specific Checks

Checked AuxPoW/mining version layout, chain-id clearing, AuxPoW flag clearing, version rolling mask stability, GBT response behavior, and the separate createauxblock path. PQC/P2MR, wallet, PHOTON, pruning/archive, and release-signing paths were not touched.

Validation Reviewed

Author-listed validation covers Docker lint, build, unit suites, functional suites, feature_auxpow.py, and an RPC smoke check. CI evidence checked: Core Checks passed; Full Validation platform/build/test matrix jobs inspected passed except lint; the observed lint failure is from the upstream BuildKit helper metadata issue that has since been fixed upstream. I did not run additional local validation.

Residual Risk

I did not independently reproduce the author’s manual createauxblock / submitauxblock smoke test locally. The new functional assertion checks the sanitized GBT response and version rolling mask, but does not itself build and submit a normal block from the sanitized 0x20000100 GBT response. Merge readiness still depends on rebasing onto the upstream lint fix and getting required checks green.

@djh58
djh58 self-requested a review June 26, 2026 17:35
@kiwidream
kiwidream merged commit 3b8e80b into 0.1.x Jun 26, 2026
30 of 33 checks passed
@kiwidream
kiwidream deleted the fix-issue-18-gbt-0.1.x branch June 27, 2026 18:43
djh58 pushed a commit that referenced this pull request Jul 2, 2026
* Accept legacy AuxPoW RPC payloads (#23)

* Prevent AuxPoW signalling in permissionless GBT (#22)

* wallet: defer P2MR getnewaddress keypool refill (#13)

* wallet: defer P2MR getnewaddress keypool refill

* wallet: bound internal P2MR keypool refill

* wallet: align P2MR top-up lock ordering

* wallet: schedule raw change P2MR refills

* wallet: report paused P2MR refills as failed

* wallet: log inline P2MR refill failures

* ci: fix BuildKit helper lint

* Document AuxPoW commitment order fields (#35)

* Restrict explicit wallet output types on P2MR-only chains (#25)

* Restrict explicit wallet output types

* test: run BECH32 wallet suites on unrestricted regtest

* fuzz: run wallet transaction target on unrestricted regtest

* Fix BuildKit helper lint

* Report missing wallet output managers accurately

* Allow managerless wallets with default output options

* test: add independent P2MR and CTV script vectors (#29)

* Add independent P2MR PQC witness vector tests (#30)

* test: add independent P2MR PQC witness vector

* test: verify P2MR wrong-domain vector signature

* Fix AuxPoW legacy payload disambiguation

* wallet: avoid MarkUnused P2MR full top-up (#31)

* wallet: avoid MarkUnused P2MR full top-up

* wallet: avoid MarkUnused lock inversion

* wallet: preserve P2MR recovery lookahead

* Split P2MR wallet unit tests (#52)

* Remove unused P2MR wallet test import (#58)

* Shard P2MR wallet unit tests (#60)

* Add independent CHECKDATASIGPQC vector tests (#38)

* test: add P2MR data-hash proof fixtures (#43)

* test: add independent P2MR commitment vectors (#47)

* Reject invalid raw funding outputs (#37)

* Validate witness-pruned assumevalid before wipe (#59)

* Add independent CHECKDATASIGADDPQC vector tests (#42)

* qt: recommend wallet encryption by default (#62)

* Verify libbitcoinpqc tagged subtree imports (#41)

* ci: verify libbitcoinpqc tagged subtree imports

* ci: handle peeled libbitcoinpqc tag refs

* ci: peel libbitcoinpqc tag objects before compare

* ci: pass auth to libbitcoinpqc verifier

* ci: pin libbitcoinpqc verifier inputs

* ci: verify libbitcoinpqc import tree

* Add P2MR PQC annex sighash vectors (#54)

* Add P2MR PQC annex sighash vectors

* Guard annex mutation vector test

* Add P2MR data signature support to Qt Sign/Verify (#63)

* qt: add P2MR data signature dialog

* qt: support text data in P2MR signatures

* qt: align P2MR proof verification with RPC

* test: add P2MR CHECKSIGPQC sighash vectors (#55)

* Add rawmr future-leaf coverage (#64)

* test: cover P2MR SIGHASH_SINGLE missing outputs (#57)

* test: add P2MR PQC codeseparator vectors (#56)

* Fix PQC data-hash counter accounting (#46)

* Fix PQC data-hash counter accounting

* Fix PQC data-hash leaf error priority

* Report final PQC slot failures as exhausted

* doc: add v0.1.2-testnet4 release notes

* build: bump version to v0.1.2-testnet4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants