mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
Test: Add P2SH scriptSig stack-size boundary tests #36465
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36465
Loading…
Reference in a new issue
No description provided.
Delete branch "p2sh-stack-size-boundary"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
VerifyScript runs a P2SH scriptPubKey on the stack the scriptSig leaves before handling the redeemScript. The 20-byte push in HASH160 <20> EQUAL adds one item, so a scriptSig that leaves 1,000 items fails with STACK_SIZE, while 999 items is valid.
An implementation that checks the redeemScript hash without running the scriptPubKey accepts the 1,000-item spend. No existing vector leaves the scriptSig at this boundary, so such an implementation can pass every row.
Add 999 and 1,000 item cases with P2SH and WITNESS, and the 1,000 item case with no flags, which fails the same way because the scriptPubKey always runs. Also add the same boundary during redeemScript evaluation, where the restored stack plus the redeemScript's pushes reach 1,000 and 1,001 items.
The same case is added as a feature_taproot spender in #36455, so its dump can be added to the script assets (bitcoin-core/qa-assets#297).
These were discovered by finding gaps in an alternate implementation (rbitcoin)
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Base:
7efbdb6437a840217127bd7dea0b963c67613860Head:
5a4cd70547096af6247167d8dde6145a1b548642I found no actionable issues in this static review.
Full review report
Can you please remove the LLM as co-author? See AI policy
The 3 new script_tests.json rows pass at
2ba00d5in btclib, a Python implementation I maintain, each with the expected result and error code.tACK
2ba00d5b5dI see there are existing tests for errors during redeem-script execution. Should we add these for
STACK_SIZEerrors during redeem-script execution?nit: do we need
WITNESShere and/or at line 1025? Or maybe even addSTRICTENC?thanks @ekzyis, incoporated your suggestions
ACK
1cf341ed8acc @instagibbs
could this get folded into the same section as https://github.com/bitcoin/bitcoin/pull/36455/changes
moved to that PR
ACK
5a4cd70547ACK
5a4cd70547