Skip to content

BIP 54 test vectors improvements following review in Inquisition#2122

Merged
murchandamus merged 7 commits intobitcoin:masterfrom
darosior:2603_bip54_improvements
Apr 15, 2026
Merged

BIP 54 test vectors improvements following review in Inquisition#2122
murchandamus merged 7 commits intobitcoin:masterfrom
darosior:2603_bip54_improvements

Conversation

@darosior
Copy link
Copy Markdown
Member

This addresses the feedback received on the test vectors following the merge of #2015, the review of the Bitcoin Inquisition implementation (bitcoin-inquisition/bitcoin#99), and Chris Stewart's implementation for Bitcoin-s (bitcoin-s/bitcoin-s#6170).

There are 4 categories of changes here:

  • Rewording and clarifications in the BIP text.
  • Some typo fixes and field reordering in the test vectors.
  • A change in the structure of the timestamps test vectors, to reduce the size of the file by ~80%.
  • Test case addition(s).

See commit messages for details.

…cation

The paragraph in its entirety is already unambiguous that all signature-checking operations
*present* in the Script (as opposed to *executed*) are counted. However i received feedback that the
"potentially executed" language in the first sentence of this paragraph may be confusing. This is
because it is in theory possible to have a more accurate upper bound by analyzing the possible
spending paths and use the maximum number of signature-checking operations in either to check
against the limit.

This commit rewords the first sentence to use the word "present" to be extra-clear before even
describing how the accounting is performed in later sentences.
Making sure that the coinbase is timelocked is a neat simplification in reasoning about duplicates,
but it has caused some confusions. For instance here:
https://gnusha.org/pi/bitcoindev/e758af9b-72fc-4fdd-8e07-e1126635780an@googlegroups.com/

Fix this by explicitly stating the implications.
This is a batch update to the tests vectors for the limit on legacy signature-checking operations
introduced in BIP 54, following feedack received on the Bitcoin Inquisition PR and from Chris
Stewart's implementation in Bitcoin-S.
This is part of feedback received during the Bitcoin Inquisition PR review.
This was pointed out during the Bitcoin Inquisition PR review
@murchandamus murchandamus added the BIP Update by Owner PR by Author or Deputy to modify their own BIP label Mar 13, 2026
Copy link
Copy Markdown

@ariard ariard left a comment

Choose a reason for hiding this comment

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

Ongoing review, up to 1f21139

Seen the commit message, I’m still thinking the change can be simplified by not enforcing non-finality of the nSequence field due to the order of checks in IsFinalTx(), while still ensuring uniqueness. Fair game, on me to go to write test vectors pre / post bip54 to verify the consensus logic and make the demonstration.

Comment thread bip-0054.md

A limit is set on the number of potentially executed signature operations in validating a
A limit is set on the number of signature operations present in the scripts used to validate a
transaction. It applies to all transactions in the block except the coinbase transaction[^1]. For
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: find the commit message being clear enough that it would be actually valuable to mention that the sum (or union ?) of all the non-executed spending paths is the value on which the limit is applied.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The following sentence describes exactly this, so i think that is enough for now.

Comment thread bip-0054.md
Comment thread bip-0054.md
The test vectors were initially designed to maximally simple, which led to much redundancy. That was
probably too close to one extreme on the spectrum between simplicity and efficiency.

Here we shave off 20k lines by simply representing the header chains as a tree instead of list of
lists by duplicating all common headers.
Ariard mentioned he would like to see a test case for a 64-byte transaction spending a Taproot
output with an annex. I took the opportunity to also make the output be an OP_RETURN with a 2-byte
push, as another semi-realistic transaction.
@darosior darosior force-pushed the 2603_bip54_improvements branch from bd71c54 to fa60898 Compare March 16, 2026 14:21
Copy link
Copy Markdown
Member

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown

@ariard ariard left a comment

Choose a reason for hiding this comment

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

Light Light Review up to 977300d

For ff39733 and 977300d this has been mostly grepp’ing the interesting parts, though I’ve not checked that the test coverage stay equivalent.

@murchandamus
Copy link
Copy Markdown
Member

@darosior, is this ready to be merged?

@darosior
Copy link
Copy Markdown
Member Author

@murchandamus yes.

Copy link
Copy Markdown
Member

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

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

ACK fa60898

@murchandamus murchandamus merged commit 78fcc31 into bitcoin:master Apr 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BIP Update by Owner PR by Author or Deputy to modify their own BIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants