consensus: close algo-review C-H1–C-H4 and C-M1–C-M7 - #247
Merged
Conversation
rearden-grok Bot
added a commit
that referenced
this pull request
Aug 25, 2026
§11 placeholders pointed at this PR; fill the number now that it exists. Co-authored-by: Cursor <cursoragent@cursor.com>
Core GetOp fails when PUSHDATA2/4 lacks a length field; leftover bytes must not be counted as CHECKSIG. Matches C-H2. Co-authored-by: Cursor <cursoragent@cursor.com>
Charge 50 per executed nonempty CHECKSIG/CHECKSIGADD against 50 + witness serialized size. Negative remaining fails, matching Core EvalChecksigTapscript (C-H1). Co-authored-by: Cursor <cursoragent@cursor.com>
EvalScript the scriptSig (10k / 520 / 1000 limits) then IsPushOnly, so OP_1NEGATE is a valid push and oversized scriptSig is rejected (C-H3). Nested SegWit reuses the same collector. Co-authored-by: Cursor <cursoragent@cursor.com>
Off-interval headers with time > prev + 2×spacing use powLimit bits; otherwise walk back to the last non-min-diff block, matching Core GetNextWorkRequired (C-H4). Co-authored-by: Cursor <cursoragent@cursor.com>
CheckTransaction requires vout nonempty for every tx including the coinbase (C-M1). Structure and assemble both enforce it. Co-authored-by: Cursor <cursoragent@cursor.com>
Core nSubsidyHalvingInterval is 150 on regtest, 210000 elsewhere. block_subsidy now uses ChainParams (C-M2). Co-authored-by: Cursor <cursoragent@cursor.com>
Core GetSigOpCount(scriptSig) returns 0 if any opcode is > OP_16. last_script_push no longer skips those opcodes (C-M3). Co-authored-by: Cursor <cursoragent@cursor.com>
Core GetTransactionSigOpCost adds BIP141 witness sigops only when SCRIPT_VERIFY_WITNESS is on. We always added them, so a P2WPKH-shaped prevout inflated block sigop cost by 1 before the segwit height. Co-authored-by: Cursor <cursoragent@cursor.com>
Pipelined assemble_run only ran MTP/bits/pow, so a tip-ahead or multi-block confirm could skip BIP34/66/65 version floors and the 2-hour future-time cap that validate_header already enforced. Co-authored-by: Cursor <cursoragent@cursor.com>
Signet picked the first OP_RETURN containing aa21a9ed and evaluated the challenge as Base with CLEANSTACK. Core uses the last exact 38-byte 6a24aa21a9ed output and BLOCK_SCRIPT_VERIFY_FLAGS (P2SH|WITNESS|DERSIG|NULLDUMMY). Co-authored-by: Cursor <cursoragent@cursor.com>
Relaxed loads of Wave::failed could let a worker enter after the publisher observed in_wave == 0 on ARM. Pair Acquire loads with the Release store; increment-then-check was already in place. Co-authored-by: Cursor <cursoragent@cursor.com>
§11 placeholders pointed at this PR; fill the number now that it exists. Co-authored-by: Cursor <cursoragent@cursor.com>
Signet challenge now goes through verify_job_all_inputs, so EvalContext::new and eval_script_sig_pushes are test-only. Clippy -D warnings rejects the lib build and the min-diff walk's `h % interval != 0`. Co-authored-by: Cursor <cursoragent@cursor.com>
rearden-grok
Bot
force-pushed
the
consensus/algo-review
branch
from
August 25, 2026 22:16
b7c30ba to
700fc71
Compare
generate_to_script(300) hit coinbase excess value after C-M2 because mine_regtest_paying always paid 50 BTC. Use block_subsidy. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes every consensus finding in
docs/algo-review.md(C-H1–C-H4, C-M1–C-M7). Each ID is moved to §11 in the same commit as the fix.High
script_sigop_countstops on truncated PUSHDATA2/4 ([0x4d, 0xac]→ 0).50 + witness size, −50 per nonempty CHECKSIG*).eval_script+ IsPushOnly (OP_1NEGATEaccepted; >10 000-byte scriptSig rejected).Medium
voutrejected (no outputs).> OP_16.assemble_runenforces future-time + BIP34/66/65 nVersion on every block (not only headers-firstvalidate_header).BLOCK_SCRIPT_VERIFY_FLAGS(P2SH|WITNESS|DERSIG|NULLDUMMY, no CLEANSTACK).failedis Acquire/Release.Test plan
cargo test -p rbitcoin-consensus --libpins named indocs/algo-review.md§11fmt,deny,clippy,test,windows,macos,multinode,coverageMade with Cursor