Skip to content

Verify unique orientations of opaque pairs - #339

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

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

Conversation

@brenorb

@brenorb brenorb commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Result

Verify that each independently supplied quartet of opaque byte strings admits exactly one matching orientation and return its canonical orientation bit. The branch uses one raw equality to eliminate the impossible orientation and explicitly checks distinctness where that first equality cannot imply it. Both caller stacks survive. The eager baseline computes both raw orientation flags and requires them to differ.

Quartets Schedule Complete leaf bytes Data witness bytes Ordinary items Hint items Combined peak Executed non-push ops
128 Branch 3,071 2,051 512 0 514 1,854
128 Eager 3,071 2,051 512 0 516 2,942
249 Branch 5,975 3,987 996 0 998 3,610
249 Eager 5,975 3,987 996 0 1,000 5,725

The alternating fixtures include exact checks of every orientation bit and terminal true. Witness bytes cover the count and lengths of the data items, all of which coexist at entry. They exclude leaf, control block, annex, and transaction. The branch preserves one caller item on each stack at width 249 and reaches exactly 1,000. Eager reaches the limit before caller items. Both schedules use zero hints and zero signature charge.

An existential match accepts an all-equal quartet and cannot establish a unique orientation. The focused tests reproduce this counterexample, enumerate all raw equality patterns over four distinct byte vectors, mutate every batch item, and test the 80/81-byte, 520/521-byte, and combined stack boundaries.

The raw multiset in #308 can match across a full list and checks multiplicities. The opaque common prefix in #312, unique mismatch in #329, and lag match count in #332 expose different relations. All four exact-head merge simulations were clean.

Evidence is locally-reproduced. Execution is unclassified. The stack-limited local tapscript profiles use a synthetic transaction and disable experimental OP_CAT.

Verification

  • cargo test --locked --lib support::unique_pair_orientation::tests
  • cargo test --locked --test primitive_metrics opaque_pair_orientation_metrics_are_current
  • python3 tools/kb.py validate
  • cargo fmt --all -- --check
  • The required full non-field suite passed on this exact published commit. All three hosted checks also passed on this head.

@brenorb
brenorb marked this pull request as ready for review November 7, 2026 20:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 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-07T20:30:03.761264Z 7757791 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 03190c0 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