Skip to content

Record dynamic u4 run-length decoder frontier - #352

Open
brenorb wants to merge 1 commit into
solving-bitcoin:mainfrom
brenorb:research/variable-u4-run-length
Open

brenorb wants to merge 1 commit into
solving-bitcoin:mainfrom
brenorb:research/variable-u4-run-length

Conversation

@brenorb

@brenorb brenorb commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds u4_expand_canonical_runs_dynamic(width, preserved_items), a zero-hint decoder that uses OP_DEPTH to accept every canonical run count from 1 through the configured width while reusing the existing checked expander.

  • rejects empty, odd-sized and overfull pair lists;
  • covers all width-16 run counts, per-position hostile inputs and sum mismatches, non-minimal encodings, and preserved main/alt state;
  • resolves OP-040 with a measured negative result (NR-111) and opens OP-066 for a shared-validator layout;
  • updates the catalog, primitive docs, comparison, and negative-result records.

Measured frontier

Width-16 witness (0,8),(15,8), with four data items and zero hints at entry:

Metric Dynamic dispatch In-place canonical check
Fragment script bytes 11,675 206
Serialized data-witness bytes 8 25
Fragment + data-witness bytes 11,683 231
Static non-push opcodes 9,249 144
Combined stack peak 20 20
Complete-leaf dispatched non-push opcodes 1,861 152

Dynamic dispatch is therefore byte-dominated; this PR does not claim a size win. The complete-leaf opcodes use a separate output-drop/OP_TRUE boundary, counting active non-push instructions and branch delimiters while excluding pushes and unexecuted bodies.

Evidence

  • locally-reproduced, execution unclassified.
  • Dynamic fragment SHA-256: 35a8f35f60326e78fc754a6b68c7bda669009b201135cbcdb49300e6beb1424d.
  • Focused run-length suite: 15 passed, including explicit per-position sum mismatches.
  • Focused primitive metric fixture: passed with pinned metrics.
  • python3 tools/kb.py validate: 204 records, 783 configurations.
  • All three CI checks pass on f72832788804e6b2196ca2bd7b9dedb2c271569a: locked non-field Rust tests, knowledge/Python/formatting, and pinned Bitcoin Core repository comparisons.
  • Independent static review found no actionable issues.

No new-fragment Bitcoin Core differential, relay-policy, or cryptographic security claim is made.

@brenorb
brenorb force-pushed the research/variable-u4-run-length branch from 04cdd3d to f728327 Compare November 12, 2026 17:52
@brenorb
brenorb marked this pull request as ready for review November 12, 2026 18:09
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T18:14:45.640646Z f728327 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.

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