Skip to content

Pin consensus edges against Bitcoin Core - #1054

Merged
reardencode merged 5 commits into
masterfrom
consensus/core-edge-pins
Oct 17, 2026
Merged

reardencode merged 5 commits into
masterfrom
consensus/core-edge-pins

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Tests only. No production change. These pins describe behavior that is already shipped.

  • Mainnet height 32256 retarget compact 0x1d00d86a, plus the quarter-floor, 4× ceiling, and pow-limit cap.
  • Exception-block script execution (BIP16 and taproot hashes). Policy flags stay off. P2PKH fast path agrees with the interpreter on a real signature and on the 20-byte hash collision. SIGHASH_SINGLE past the last output is uint256 one. Witness v0 rejects a non-empty CHECKMULTISIG dummy with NULLDUMMY off; base script accepts it. An unknown taproot leaf succeeds past the witness stack limits.
  • An anchored milestone skips a failing P2PKH script only when this block's hash and the anchor hash are both on the header path.
  • The last witness-commitment output of at least 38 bytes wins. A coinbase witness with no commitment is missing once segwit is active. Nonce lengths 31 and 33 are bad-witness-nonce-size. Empty P2WSH and a v1 program cost 0. Coinbase scriptSig length 2 accepts and length 1 rejects. BIP68 does not apply to the coinbase.
  • Post-IBD decode: a valid regtest block payload is a block. The same payload plus one byte is NetworkMessage::Unknown.

Test plan

  • Targeted unit tests for each pin, green on the first run
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo deny check, and ./scripts/ast-grep.sh finished locally before the workspace suite was stopped
  • GitHub qc, test, windows, macos, and coverage. The local workspace test and ci-os-smoke.sh were not finished; the VM was too busy

The expected compacts are literals (mainnet 0x1d00d86a, quarter floor,
4x ceiling, pow-limit cap), not a second call to the retarget function.
…edges

Taproot hashtype 0x00 and an OP_0 P2SH redeem now run under the real
exception hashes. SIGHASH_SINGLE past the last output, the P2PKH
find-and-delete collision, witness-v0 NULLDUMMY with the flag off, and
unknown tapleaf stack limits are pinned without changing the interpreter.
Empty scriptSig on a real P2PKH output connects only when the header
path holds this block and the anchor. One height above, and a different
hash at the anchor height, still fail the script.
…IP68 coinbase skip

The last 38-byte aa21a9ed output is the commitment. A coinbase witness without one is missing. Nonce lengths 31 and 33 fail. Empty P2WSH and a v1 program cost 0. Coinbase scriptSig length 2 accepts and length 1 rejects. A version-2 coinbase with a relative lock that fails on a normal input still connects.
A valid regtest block payload decodes as a block. One extra byte is NetworkMessage::Unknown. The changelog fragment covers the consensus pins on this branch.
@reardencode
reardencode merged commit 6c933cd into master Oct 17, 2026
18 checks passed
rearden-grok Bot added a commit that referenced this pull request Oct 17, 2026
The rebase onto the witness, sigop, and BIP68 coinbase pins left
store-backed tests calling consensus paths that now live on query.
The exception-hash pin stays in consensus because the job verifier
is crate-private. Connect results match ConfirmError::Rules.
rearden-grok Bot added a commit that referenced this pull request Oct 17, 2026
The rebase onto the witness, sigop, and BIP68 coinbase pins left
store-backed tests calling consensus paths that now live on query.
The exception-hash pin stays in consensus because the job verifier
is crate-private. Connect results match ConfirmError::Rules.
rearden-grok Bot added a commit that referenced this pull request Oct 17, 2026
The rebase onto the witness, sigop, and BIP68 coinbase pins left
store-backed tests calling consensus paths that now live on query.
The exception-hash pin stays in consensus because the job verifier
is crate-private. Connect results match ConfirmError::Rules.
@rearden-grok
rearden-grok Bot deleted the consensus/core-edge-pins branch October 18, 2026 15:29
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