Skip to content

Validate SIGHASH_SINGLE pinning-skip mutations against Core - #346

Open
adrienlacombe wants to merge 1 commit into
solving-bitcoin:mainfrom
adrienlacombe:codex/binohash-single-bug-mutation-boundary
Open

adrienlacombe wants to merge 1 commit into
solving-bitcoin:mainfrom
adrienlacombe:codex/binohash-single-bug-mutation-boundary

Conversation

@adrienlacombe

Copy link
Copy Markdown
Contributor

Question

Which field mutations can retain an embedded nine-byte legacy SIGHASH_SINGLE signature when the selected input has no corresponding output?

Change

Add a funded two-input P2SH Core fixture with nine disjoint mutations: version, locktime, either prevout, either sequence, output value, output script, and all eight together. The same embedded signature and 01 00…00 bug digest authorize all nine spends in pinned Core v30.3 blocks. Adding a second output or moving the anchor to input 0 changes the digest and fails block validation. The report guards transaction identities, input indices, signatures, Core verdicts, policy rejections, and complete costs.

This is a pinning-skip boundary: this signature cannot bind those transaction fields while its selected output is absent. It does not reproduce full Binohash pinning or a collision-security bound. All nine consensus-valid spends fail default relay policy under CONST_SCRIPTCODE.

Validation

  • cargo test --locked --example binohash_single_bug_pinning_skip (1 passed)
  • python3 tools/binohash_single_bug_pinning_skip_regtest.py (pinned Core report passed twice, byte-identical)
  • python3 -m unittest discover -s tools -p 'test_binohash_single_bug_pinning_skip_regtest.py' (3 passed)
  • python3 tools/kb.py validate; cargo fmt --all -- --check; git diff --check
  • Full 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:49:09.661976Z e950dab 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: e950dabc08

ℹ️ 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 thread knowledge/catalog.json
"validation_weight": null,
"setup_script_bytes": null,
"per_use_script_bytes": null,
"metric_keys": []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add metrics for the stable pinning-skip configuration

The catalog declares a deterministic, checked Core configuration and publishes exact script, redeemScript, scriptSig, and 688–732 WU values, but metric_keys is empty and no primitive_metrics test covers the new report. Changing the fixture can therefore leave those numbers in this record and the research README stale while normal validation passes; add report-derived metric markers/keys, reusing existing anchor markers where values are shared.

AGENTS.md reference: AGENTS.md:L79-L80

Useful? React with 👍 / 👎.

absent. This is a pinning-skip regression, not a full Binohash grind or
collision-security result. A construction requiring those fields to be bound
needs a separate authenticated predicate or an existing selected output.
[OP-011](../open-problems.md#op-011--reproduce-binohash) remains open.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update OP-011 with the signed mutation results

This result directly advances OP-011's mutation boundaries acceptance item with signed Core spends, but knowledge/open-problems.md:546-550 still mentions only the host matrix with no signed/Core verdict and :578-590 only the older one-anchor fixture. Linking OP-011 here without recording the new nine variants leaves the canonical open-problem state stale; add the partial result while retaining the remaining pinning/grinding gaps.

AGENTS.md reference: AGENTS.md:L81-L83

Useful? React with 👍 / 👎.

Comment on lines +173 to +176
tx.get("input_vouts") !=
([4 * case + 2 if case in (4, 8) else 4 * case,
4 * case + 3 if case in (2, 8) else 4 * case + 1]) or
tx.get("script_sig_bytes") != [2, 46] or

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 Validate the claimed mutations in report_passed

When mutate regresses so that version, locktime, either sequence, or either output field stays at its baseline, the generated report still passes: this loop checks row names and vouts but never records/asserts those fields, and it also accepts changed hex, weight, or decoded size. Because the checked-report unit test delegates to report_passed, such a report can remain green while the experiment and published complete-cost claims are no longer reproduced; decode/store and assert every intended field and serialization metric.

AGENTS.md reference: AGENTS.md:L77-L80

Useful? React with 👍 / 👎.


The [SINGLE pinning-skip regression](../../research/binohash-single-bug-pinning-skip/README.md)
keeps that same embedded signature valid across version, locktime, input,
sequence, and output mutations while input index 1 exceeds output count 1.

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 Describe index-equals-count as out of range

In this fixture the input index and output count are both 1, so index 1 does not “exceed” count 1. The legacy SIGHASH_SINGLE bug is reached when the index is at least the output length; describing the boundary as > can lead consumers to omit the exact equality case exercised here. Say that the index is outside the valid output range or is at least the output count, including in the generated report scope and knowledge page.

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