Skip to content

Validate reduced four-mode Binohash pinning under Core - #344

Open
adrienlacombe wants to merge 1 commit into
solving-bitcoin:mainfrom
adrienlacombe:codex/binohash-four-mode-pinning
Open

adrienlacombe wants to merge 1 commit into
solving-bitcoin:mainfrom
adrienlacombe:codex/binohash-four-mode-pinning

Conversation

@adrienlacombe

Copy link
Copy Markdown
Contributor

Question

Can the four ordered legacy sighash modes used for transaction pinning coexist in one funded spend, with later field choices preserving earlier signatures?

Change

Add a policy-compiled bare-legacy, two-input Core fixture with four cheap exact-size signature predicates. It signs in the order NONE|ANYONECANPAY, NONE, ALL|ANYONECANPAY, ALL, then compares six one-field mutations and four shortened-signature controls under pinned Core v30.3. The checked report includes complete funding and spending transactions, signature attempts, digests, byte and opcode costs, consensus/policy verdicts, and negative report mutations.

The valid 159-byte locking script enters a block in a 439-byte / 1,756-WU spend. Each field mutation fails at input 1; each shortened signature fails its size predicate. Default relay policy rejects the bare input. This is a reduced four-mode composition test with public keys and a low work factor; it does not establish the full Binohash protocol or security estimate.

Validation

  • cargo test --locked --example binohash_four_mode_pinning (1 passed)
  • cargo test --locked --test primitive_metrics binohash_four_mode (1 passed)
  • python3 tools/binohash_four_mode_pinning_regtest.py (pinned Core report passed)
  • python3 -m unittest tools/test_binohash_four_mode_pinning_regtest.py (passed, 15 negative report mutations)
  • python3 tools/kb.py validate; cargo fmt --all -- --check; git diff --check
  • Broad non-field Rust suite will run in CI.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 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-09T19:37:34.488596Z 6d38b3c PR opened
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d38b3ca52

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +168 to +170
return (len(bytes.fromhex(tx["hex"])) == tx["total_bytes"] and
decoded["txid"] == tx["txid"] and decoded["weight"] == tx["weight"] and
decoded["vsize"] == tx["vsize"] and decoded["size"] == tx["total_bytes"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Derive checked identities from raw transaction hex

consistent() accepts a transaction whenever the raw hex has the advertised byte count and separately stored decoded fields match separately stored metadata; it never derives a txid or wtxid from the hex. Consequently, changing any nibble in a valid, mutation, wrong-size, or funding transaction while preserving its length still makes report_passed() return true, although the Core verdict and transaction ID now refer to a different spend. This lets the checked report lose the transaction-to-Core comparison while retaining differentially-validated; hash or parse each raw transaction during validation.

AGENTS.md reference: AGENTS.md:L31-L32

Useful? React with 👍 / 👎.

items, zero hint items, and zero serialized witness
bytes**. All four signature items coexist at script entry. The script has 15
static non-push opcodes, including the three separators. Its opcode-level
combined main-plus-alt-stack bound is five items for this input shape; an

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the target push in the stack bound

With the four signature items live at script entry, the first OP_SIZE produces a fifth stack item and the following 71 data push produces a sixth before OP_EQUALVERIFY consumes the two size values. The advertised five-item combined bound is therefore one item too low for this input shape; report six (or measure the executed peak) so the resource result is accurate.

AGENTS.md reference: AGENTS.md:L55-L56

Useful? React with 👍 / 👎.

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