Skip to content

test(shake256): validate prefix under Core consensus - #223

Merged
RobinLinus merged 2 commits into
solving-bitcoin:mainfrom
brenorb:feat/shake256-consensus-prefix-next
Sep 28, 2026
Merged

RobinLinus merged 2 commits into
solving-bitcoin:mainfrom
brenorb:feat/shake256-consensus-prefix-next

Conversation

@brenorb

@brenorb brenorb commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

The reusable SHAKE256 prefix has independent local digest vectors and strict stack checks. This PR adds a separately scoped, deterministic complete Taproot spend against pinned Bitcoin Core v30.3, without promoting the reusable fragment's evidence.

The funded leaf consumes 32 message items, computes 32 output bytes, drops those outputs, and ends with OP_TRUE. Core acceptance establishes transaction/resource acceptance for that exact leaf; digest correctness comes from separate local FIPS 202 reference comparisons. Relay policy is unmeasured.

The complete leaf is 2,000,144 bytes (unoptimized under the compilation policy), its serialized Taproot witness is 2,000,248 bytes with 34 items, and the exact local strict execution peaks at 813 combined stack items. There are zero hint items. The reusable 32-byte and 137-byte fragment configurations remain locally-reproduced / unclassified; only the complete-leaf configuration is differentially-validated / consensus-validated.

Validation on the integrated tree includes the focused SHAKE module, named prefix metric, deterministic fixture example, shared Core harness unit tests, KB validation and formatting, plus an actual funded Core v30.3 generateblock acceptance run. The Core harness is added to the existing comparison CI job. No metric refresh or local broad/field-arithmetic suite was run.

Copy link
Copy Markdown
Contributor

Review: changes required before merge.

The Core harness is useful, but the catalog promotion is broader than the fixture it validates. tools/kb.py inherits record-level evidence and execution for configurations without overrides. Promoting the entire SHAKE prefix record therefore assigns consensus validation to the existing fragment configuration, while Core ran a distinct 2,000,144-byte complete leaf with a terminal consumer. Add a separately scoped Core configuration containing the exact leaf/witness boundary and keep the local fragment measurements at their established evidence/deployment levels. The Core fixture discards the hash output; describe this as complete-spend acceptance, retaining independent hash-output validation as separate evidence.

Evidence: inspected. Run the affected focused checks after the correction; no full-repository run is requested.

Reviewed commit: e422be46a1a319135b9b49d9a16fd5e615687112.

@brenorb
brenorb force-pushed the feat/shake256-consensus-prefix-next branch from e422be4 to bc1d201 Compare September 19, 2026 02:45
@brenorb

brenorb commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed in commit bc1d201.

  • Restored the SHAKE prefix record defaults to locally-reproduced / unclassified; the existing 32-byte and 137-byte fragment configurations retain local measurement scope.
  • Added a separately scoped complete-leaf-core-v30.3 catalog configuration with the exact 2,000,144-byte leaf, 2,000,248-byte serialized Taproot witness, 34 witness elements, pinned Core commit, and explicit differentially-validated / consensus-validated qualifiers.
  • Documented that the terminal consumer drops all 32 hash outputs and checks OP_TRUE: Core proves complete-spend acceptance, while independent reference tests provide hash-output validation.
  • Preserved the existing 137-byte rate-crossing metric configuration and added exact fixture size assertions.

Checks passed: focused SHAKE primitive metrics, all SHAKE unit tests, the consensus fixture test, knowledge-base validation, cargo fmt check, and staged-diff whitespace check.

The Core regtest itself was not rerun in this correction; the fixture and catalog preserve its exact reported boundary and scope.

Copy link
Copy Markdown
Contributor

Review of bc1d201d66f856a4e4bd4b15b696e30ce419ed53:

The separate complete-leaf configuration correctly narrows the Core evidence compared with the previous review. Two details still need attention: this PR also changes the unrelated bigint record from research-unlimited to unclassified without corresponding evidence, and its Core leaf discards the digest before OP_TRUE. Restore the unrelated bigint classification; either compare the expected digest in the funded leaf or state explicitly that this experiment validates resource/transaction acceptance while digest correctness comes from separate local vectors. Preserve the separate fragment and complete-leaf evidence when rebasing.

Current integration conflicts: knowledge/catalog.json, knowledge/comparisons/hashes.md, knowledge/open-problems.md, knowledge/primitives/shake256-prefix.md, src/hashes/shake256/README.md. These must be resolved and the integrated result validated before merging.

Validation scope: source/diff and existing CI review; no new full-repository or field-arithmetic test run was requested.

Preserve the local fragment classifications while recording the separate pinned Core complete-leaf result. Confirm the funded leaf script and Tapleaf hashes locally, retain digest correctness as independent vector evidence, and keep relay policy unclaimed.
@brenorb

brenorb commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review on 45fa5f8b19d2eeec67b8297b154d0ca45da3d494 after integrating current main (e9d5a66b6391eccee64f72cc5af590bc14ed550c).

  • Restored the unrelated bigint classification. A semantic catalog comparison against main changes only hash/shake256-prefix; existing configurations and main's 137-byte boundary tests/metrics are preserved.
  • Kept the reusable 32-byte and 137-byte fragments locally-reproduced / unclassified. Only the separately recorded complete leaf is differentially-validated / consensus-validated.
  • Preserved and made consistent the explicit limitation: the funded leaf drops all 32 digest bytes before OP_TRUE. Core establishes acceptance of that exact transaction/resource fixture; separate local FIPS 202 vectors establish digest correctness. Relay policy remains unmeasured.
  • Added a strict local check for the exact funded script: SHA256 e1072cc7b403840fc7fa9b2794afe3e73f70c498f4699f14e7514432434e9bde, 2,000,144 unoptimized script bytes, 813 combined stack items, 32 runtime data items and zero hints. The fixture test also pins the Tapleaf hash and 2,000,248-byte complete witness (34 items).
  • Strengthened the existing raw-output overflow negative test to require StackSize with the stack limit enforced. The same test predicate rejects a run with the limit disabled, so a clean-stack failure cannot masquerade as evidence of the resource boundary. The existing prefix success controls and shared Core infrastructure error tests are retained.

Integrated-tree validation: 10 focused SHAKE tests, the named prefix metric test, the deterministic fixture example test, 9 shared Core harness unit tests, KB validation, formatting and diff checks passed. An actual funded spend was accepted by pinned Core v30.3 (49faec4f87f5cd19c88db01a82e5c68b087c8227) through generateblock at height 103, with the script hash above and transaction weight 2,000,626. Final edits after that Core run were confined to test assertions, documentation/catalog scope and removal of duplicate metric entries; the fixture generator's output and harness were unchanged. No metric refresh or local broad/field-arithmetic run was performed.

@RobinLinus
RobinLinus merged commit af9e454 into solving-bitcoin:main Sep 28, 2026
3 checks passed
@brenorb
brenorb deleted the feat/shake256-consensus-prefix-next branch October 28, 2026 02:57
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