Skip to content

Verify raw multisets with interleaved deletion hints - #308

Merged
RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:codex/opaque-multiset
Nov 9, 2026
Merged

RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:codex/opaque-multiset

Conversation

@brenorb

@brenorb brenorb commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Result

Verifies exact raw-byte multiset equality of two lists, including duplicate multiplicities. Each hostile deletion hint sits beside its right-hand value. Script checks the hint's canonical encoding and shrinking-pool bounds, removes the matching left item, and verifies raw-byte equality. The final match requires no hint.

Configuration Schedule Script bytes Serialized witness bytes Ordinary items Hint items Serialized hint bytes Combined peak Executed non-push ops
Width 4 Greedy 74 25 8 0 0 10 38
Width 4 Hinted 44 29 8 3 4 14 31
Width 16 Greedy 1,477 97 32 0 0 34 599
Width 16 Hinted 219 124 32 15 27 50 151
Two width-16 checks Greedy 2,953 193 64 0 0 66 1,190
Two width-16 checks Hinted 437 247 64 30 54 97 302

Both schedules check the same raw values and end with true. All payloads and hints coexist at entry. Witness bytes exclude script, control block, annex and transaction. Hint bytes include per-item length prefixes. Evidence is locally reproduced with the stack-limited local tapscript Consensus profile, and deployment is unclassified.

The nearest existing sorter operates on u4 values, and PR #266 verifies multiset equality with a packed u4 histogram. This comparison covers arbitrary raw byte items. The focused tests check all ordered input-pair combinations up to width three over three byte values, every legal reuse attempt on a duplicate-count mismatch, hostile hint encodings and caller-state preservation at exactly 1,000 items.

Verification

  • Focused multiset contract and metric tests
  • python3 tools/kb.py validate and cargo fmt --all -- --check
  • cargo test --locked -- --skip fields::

@brenorb
brenorb marked this pull request as ready for review November 6, 2026 08:17
@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-06T08:22:36.034403Z 7cb68f4 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 6fd66eb 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