Skip to content

Select a SHA-256 commitment by preimage length - #331

Merged
RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:codex/length-keyed-sha256
Nov 9, 2026
Merged

RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:codex/length-keyed-sha256

Conversation

@brenorb

@brenorb brenorb commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Verify one opaque SHA-256 opening against the digest assigned to the preimage's exact byte length. The public map covers a contiguous range, and the preimage supplies its own selector through OP_SIZE. Binary dispatch selects one block, then materializes just the selected block's digest constants.

The existing preimage-length primitive checks one fixed digest and returns a length-derived integer. #320 checks two distinct digest openings using witness-selected indices or a scan. This primitive verifies one length-selected digest with one ordinary witness item and zero hints.

Every row checks the same length and SHA-256 predicate and ends with true. Serialized data witness includes the count and item length, excluding the leaf, control block, annex and transaction. Executed non-push operations include processed control delimiters, including in inactive branches.

First length Digests Opened length Data witness bytes Leaf bytes, per-digest / block 8 / full Combined peak Executed non-push ops
16 32 31 33 1,317 / 1,112 / 1,091 5 / 10 / 34 112 / 31 / 30
0 128 79 81 5,238 / 4,407 / 4,306 5 / 10 / 130 404 / 71 / 77
0 521 519 523 21,744 / 18,070 / 17,471 5 / 10 / 523 1,589 / 227 / 273
0 521 520 524 21,744 / 18,070 / 17,471 5 / 5 / 523 1,589 / 218 / 273

At 521 digests, eight-entry blocks add 599 bytes to the full table and reduce peak from 523 to 10 on the 519-byte fixture. The full table accepts at exactly 1,000 combined items with 477 caller items and fails at 478. The blocked schedule accepts the latter case. The 519- and 520-byte fixtures are rejected by the local Policy profile's entry-item cap.

Evidence is locally reproduced and execution is unclassified. Focused tests, metric snapshots, knowledge validation, formatting, and diff checks passed. The required full non-field suite passed on this exact published commit.

@brenorb
brenorb marked this pull request as ready for review November 6, 2026 12:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T12:23:39.433063Z 6055151 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@RobinLinus
RobinLinus merged commit 2425e06 into solving-bitcoin:main Nov 9, 2026
3 checks passed
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