Skip to content

Harden P2MR corpus and oracle conformance evidence - #127

Merged
kiwidream merged 3 commits into
p2mr-v1-conformance-suitefrom
harden-p2mr-conformance-evidence
Jul 13, 2026
Merged

kiwidream merged 3 commits into
p2mr-v1-conformance-suitefrom
harden-p2mr-conformance-evidence

Conversation

@kiwidream

@kiwidream kiwidream commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add independent exact-byte reproduction checks that mutate each authoritative P2MR corpus file and prove a refreshed manifest cannot legalize the mutation.
  • Verify the complete corpus remains LF-normalized under an equivalent Windows-style checkout.
  • Add qbit/Rust oracle agreement rows for stack underflow across OP_CHECKSIGPQC, OP_CHECKSIGADD, OP_CHECKDATASIGPQC, and OP_CHECKDATASIGADDPQC.
  • Make required CHECKSIGADD and data-signature fixtures fail closed when absent, partial, malformed, or mistyped.
  • Regenerate the 78-case manifest and synchronize the integration support matrix digest.

Addresses #122 and #123. This follow-up is stacked on #118 and retains the implementation context from #113 and #114.

Testing

  • Built locally.
  • Ran focused unit or functional tests for the changed area.
  • Ran lint or formatting checks relevant to this change.
  • Not run. Reason: Not applicable; all planned checks ran.

Checks performed:

  • test_qbit -t script_p2mr_tests (100 cases)
  • test_qbit -t descriptor_p2mr_tests (28 cases)
  • test_qbit -t key_io_p2mr_tests (21 cases)
  • cargo test --locked --offline --manifest-path contrib/testgen/p2mr_v1_oracle/Cargo.toml (35 tests)
  • contrib/devtools/check-p2mr-v1-corpus-reproducible.sh
  • python3 -m unittest ci.release.test_verify_p2mr_v1_conformance ci.release.test_validate_release_artifacts (58 tests)
  • Release-mode P2MR oracle verification bound to the exact signed HEAD (78 cases)
  • Repository Docker lint image and full lint runner
  • cargo fmt --check
  • git diff --check

Target Branch

  • This PR targets main or a maintainer-requested release branch such as 0.1.x.

Target is p2mr-v1-conformance-suite, the head branch of #118, as requested.

Risk / Review Notes

  • Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
  • No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes:

Consensus-adjacent conformance, oracle, and release evidence changes only. Production node consensus code is unchanged. Review should focus on the independence of the mutation probes, fail-closed fixture handling, exact script error agreement, and regenerated manifest digest.

Docs / Process Impact

Choose exactly one:

  • I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation.
  • No public docs update needed. Reason:

The P2MR integration support matrix and machine-readable evidence digest were synchronized with the regenerated corpus.

libbitcoinpqc Subtree Checklist (if src/libbitcoinpqc changed)

Not applicable; src/libbitcoinpqc is unchanged.

  • Source commit is reachable from an immutable release tag in Qbit-Org/qbit-libbitcoinpqc.
  • qbit imports the tagged upstream tree directly without pruning or a curated subtree branch.
  • Subtree import/update was performed with contrib/devtools/update-libbitcoinpqc-subtree.sh.
  • test/lint/libbitcoinpqc-subtree-check.sh passes locally.
  • Any default tag change in contrib/devtools/update-libbitcoinpqc-subtree.sh is intentional and matches doc/subtrees/libbitcoinpqc.md.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Note

Medium Risk
Touches consensus-adjacent script error semantics and release conformance artifacts, but production node validation is unchanged; review focus is oracle/qbit agreement and manifest independence of mutation probes.

Overview
Strengthens P2MR v1 conformance evidence without changing production consensus: new reproducibility checks, four stack-underflow corpus rows, and stricter oracle/fixture validation, with a regenerated 78-case manifest and updated integration matrix digest.

Corpus reproducibility moves from a simple byte compare in the shell script to test_p2mr_v1_reproducibility.py, which still requires exact match to src/test/data, plus mutation resistance (mutate each corpus file, refresh the manifest, assert digests track only that file and the manifest) and an LF checkout probe (clone with core.autocrlf=true so p2mr*.json stays LF-normalized).

Conformance vectors add four opcode boundary cases expecting SCRIPT_ERR_INVALID_STACK_OPERATION when OP_CHECKSIGPQC, OP_CHECKSIGADD, OP_CHECKDATASIGPQC, or OP_CHECKDATASIGADDPQC run on an empty stack—wired through the Python generator, checked-in JSON, C++ script_p2mr_tests, and the Rust P2MR v1 oracle (including new script evaluator tests).

Oracle hardening makes dataSig / dataSigAdd fixtures fail closed on partial, mistyped, or missing fields; boundary evaluation now requires complete ancillary fixtures where appropriate. Manifest case_count rises 74 → 78 (script boundary 47 → 51); p2mr-v1-support-matrix syncs to the new manifest SHA256.

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

@kiwidream
kiwidream force-pushed the harden-p2mr-conformance-evidence branch from 04e9b89 to 425c8a0 Compare July 13, 2026 18:36
@kiwidream
kiwidream force-pushed the harden-p2mr-conformance-evidence branch from 425c8a0 to c99df6a Compare July 13, 2026 18:55
@kiwidream
kiwidream merged commit 1e840c5 into p2mr-v1-conformance-suite Jul 13, 2026
1 check passed
@kiwidream kiwidream mentioned this pull request Jul 13, 2026
6 of 14 tasks
kiwidream added a commit that referenced this pull request Jul 13, 2026
* doc: define the qbit P2MR v1 consensus profile

* test: add the qbit P2MR v1 conformance corpus

* ci: gate qbit P2MR v1 conformance with an independent oracle

* release: gate qbit P2MR v1 conformance and integration signoff

* ci: execute P2MR CHECKSIGADD and release validator tests

* build: preserve P2MR corpus line endings

* test: hard-fail invalid P2MR oracle signatures

* ci: initialize P2MR target directory at runtime

* ci: test p2mr release gate in release-only profile

* test: make p2mr v1 corpus fully reproducible

* test: execute p2mr data signature opcodes

* test: type p2mr generator mutation fixtures

* release: sync p2mr support matrix digest

* test: require CHECKSIGADD boundary fixtures

* test: fix rebased P2MR conformance checks

* test: close P2MR conformance review gaps

* test: align P2MR conformance with weight v2

* Harden P2MR corpus and oracle conformance evidence (#127)

* test: prove P2MR corpus mutation resistance

* test: cover P2MR signature opcode underflow

* release: sync hardened P2MR evidence digest
kiwidream added a commit that referenced this pull request Jul 15, 2026
* doc: define the qbit P2MR v1 consensus profile

* test: add the qbit P2MR v1 conformance corpus

* ci: gate qbit P2MR v1 conformance with an independent oracle

* release: gate qbit P2MR v1 conformance and integration signoff

* ci: execute P2MR CHECKSIGADD and release validator tests

* build: preserve P2MR corpus line endings

* test: hard-fail invalid P2MR oracle signatures

* ci: initialize P2MR target directory at runtime

* ci: test p2mr release gate in release-only profile

* test: make p2mr v1 corpus fully reproducible

* test: execute p2mr data signature opcodes

* test: type p2mr generator mutation fixtures

* release: sync p2mr support matrix digest

* test: require CHECKSIGADD boundary fixtures

* test: fix rebased P2MR conformance checks

* test: close P2MR conformance review gaps

* test: align P2MR conformance with weight v2

* Harden P2MR corpus and oracle conformance evidence (#127)

* test: prove P2MR corpus mutation resistance

* test: cover P2MR signature opcode underflow

* release: sync hardened P2MR evidence digest
kiwidream added a commit that referenced this pull request Jul 15, 2026
* ci: enable validation on 1.0.0 (#73)

* Fix scanner high findings (#72)

* Resolve scanner medium findings (#74)

* Reject malformed P2MR leaf versions in Qt (#82)

* Bind builder attestations to signed-tag source (#84)

* Bind builder attestations to release source

* Fix builder workflow source environment

* Restore verified release tag after checkout

* qt: avoid wallet shutdown deadlock during model adoption (#87)

* Use aggregate work rate for assumevalid burial (#88)

* p2p: use recent chainwork for anti-DoS thresholds (#89)

* qt: bind P2MR proofs to expected signer (#85)

* Complete restricted-output fundrawtransaction edge coverage (#86)

* test: extend restricted-output raw funding coverage

* test: use documented raw funding fee option

* Prevent closing wallet progress dialogs (#97)

* qt: minimize P2MR proof exports (#95)

* Fix Qt wallet shutdown lifetime (#90)

* Fix Qt wallet shutdown lifetime

* Fix Qt shutdown CI coverage

* Test active wallet shutdown during transaction preparation

* Use portable thread in Qt shutdown test

* validation: reject height-invalid AuxPoW substitutions (#106)

* Bound qbit-qt P2MR proof parsing (#96)

* Bound Qt P2MR proof parsing

* Fix GCC range-loop warning

* qt: bind proof limit to minimal export

* rpc: default to portable P2MR proofs

* test: update PQC usage RPC expectations

* doc: qualify legacy P2MR proof compatibility

* Cache Cadence lane predecessors (#108)

* build: prohibit PQC runtime test controls in qbit (#107)

* build: prohibit PQC runtime test controls

* build: prevent PQC production mode cancellation

* ci: make PQC build policy check executable

* ci: reset cached IWYU sources before tidy setup

* docs: show qbit version and full logo in RPC sidebar (#119)

* doc: update RPC docs branding

* test: handle missing MkDocs in RPC docs suite

* Activate P2MR validation weight v2 on testnet4 at height 60,000 (#109)

* Activate P2MR validation weight v2 at height 60,000

* test: cover P2MR weight in getblockchaininfo

* validation: pre-enforce forthcoming P2MR weight rule

* doc: bound block-wide P2MR verification work

* test: cover P2MR validation-weight boundaries

* test: avoid mixed enum flag expressions

* Make resumed release draft notes deterministic (#116)

* release: make draft notes deterministic

* release: harden draft validation edge cases

* P2MR v1 conformance and release framework (#118)

* doc: define the qbit P2MR v1 consensus profile

* test: add the qbit P2MR v1 conformance corpus

* ci: gate qbit P2MR v1 conformance with an independent oracle

* release: gate qbit P2MR v1 conformance and integration signoff

* ci: execute P2MR CHECKSIGADD and release validator tests

* build: preserve P2MR corpus line endings

* test: hard-fail invalid P2MR oracle signatures

* ci: initialize P2MR target directory at runtime

* ci: test p2mr release gate in release-only profile

* test: make p2mr v1 corpus fully reproducible

* test: execute p2mr data signature opcodes

* test: type p2mr generator mutation fixtures

* release: sync p2mr support matrix digest

* test: require CHECKSIGADD boundary fixtures

* test: fix rebased P2MR conformance checks

* test: close P2MR conformance review gaps

* test: align P2MR conformance with weight v2

* Harden P2MR corpus and oracle conformance evidence (#127)

* test: prove P2MR corpus mutation resistance

* test: cover P2MR signature opcode underflow

* release: sync hardened P2MR evidence digest

* qt: preserve PQC usage after signing failures (#128)

* qt: preserve PQC usage after signing failures

* docs: align release note with PR 128

* Enforce immutable local release publication (#117)

* release: enforce immutable local publication

* release: preserve resumed draft metadata

* release: fail closed on remote verification

* release: discover resumable drafts safely

* release: re-pin immutable publication tags (#130)

* Establish mainnet 3-of-5 release-key policy (#134)

* release: establish mainnet 3-of-5 signer policy

* ci: always verify operator policy approvals

* ci: use merge queue base for policy history

* Stage v1.0.0 mainnet launch; placeholder genesis and AuxPoW chain ID (#131)

* Stage v1.0.0 mainnet launch configuration

* test: derive subversion expectation from release version

* ci: enforce staged mainnet publication posture

* release: lock staged mainnet launch difficulty

* ci: test chain ID finalization contract

* release: separate staged and final genesis targets

* ci: require live chain ID assertion

* Activate future block time v2 at testnet4 height 60,000 (#133)

* Activate future block time v2 on testnet4

* Fix future-time v2 CI regressions

* test: isolate mempool limit synthetic chain

* test: preserve legacy timestamp scenarios

* test: derive nulldummy block time from tip

* test: keep sequence-lock blocks within time limit

* ci: retrigger validation after release rebase

* test: isolate pruning timestamps from future-time v2

* docs: publish v1.0.0 mainnet guidance

* consensus: pin mainnet genesis and ASERT anchor
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.

1 participant