bip54: clarify sigops counting, borrow bip16 language #2036

pull instagibbs wants to merge 1 commits into bitcoin:master from instagibbs:2025-11-bip54_sum_sigops changing 1 files +8 −6
  1. instagibbs commented at 6:32 pm on November 12, 2025: member

    The main issue is the text seemed ambiguous on whether the limit applied per input, or over the total transaction summing over all inputs.

    I added some language directly ripped from bip16, and made it clearer, I hope, that each field is evaluated separately.

  2. instagibbs commented at 6:32 pm on November 12, 2025: member
  3. jonatack added the label Proposed BIP modification on Nov 12, 2025
  4. jonatack added the label Pending acceptance on Nov 12, 2025
  5. in bip-0054.md:76 in 691c3c3835
    76-preceded by a minimally-pushed number between 1 and 16 (included) accounts for 20. If the
    77-total is strictly higher than 2500, the transaction is invalid.
    78+same as for [bip-0016][BIP16 specs], evaluating the scriptSig, scriptPubKey, and P2SH redeemScript
    79+separately:
    80+
    81+1. OP_CHECKSIG and OP_CHECKSIGVERIFY count as 1 signature operation, whether or not they are evaluated.
    


    darosior commented at 7:37 pm on November 13, 2025:
    01. `CHECKSIG` and `CHECKSIGVERIFY` count as 1 signature operation, whether or not they are evaluated.
    

    (Here and below)

    In the rest of the document opcodes are referred to without the “OP_” prefix and are preformatted.


    instagibbs commented at 3:19 pm on November 14, 2025:
    done, but left OP_1/OP_16 for clarity
  6. in bip-0054.md:77 in 691c3c3835
    77-total is strictly higher than 2500, the transaction is invalid.
    78+same as for [bip-0016][BIP16 specs], evaluating the scriptSig, scriptPubKey, and P2SH redeemScript
    79+separately:
    80+
    81+1. OP_CHECKSIG and OP_CHECKSIGVERIFY count as 1 signature operation, whether or not they are evaluated.
    82+2. OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY immediately preceded by OP_1 through OP_16 are counted as 1 to 16 signature operation, whether or not they are evaluated.
    


    darosior commented at 7:38 pm on November 13, 2025:
    02. OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY immediately preceded by OP_1 through OP_16 are counted as 1 to 16 signature operations, whether or not they are evaluated.
    

    Or maybe?

    02. OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY immediately preceded by OP_1 through OP_16 are counted as 1 to 16 signature operation(s), whether or not they are evaluated.
    

    instagibbs commented at 3:19 pm on November 14, 2025:
    first suggestion taken
  7. in bip-0054.md:81 in 691c3c3835 outdated
    80+
    81+1. OP_CHECKSIG and OP_CHECKSIGVERIFY count as 1 signature operation, whether or not they are evaluated.
    82+2. OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY immediately preceded by OP_1 through OP_16 are counted as 1 to 16 signature operation, whether or not they are evaluated.
    83+3. All other OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY are counted as 20 signature operations, whether or not they are evaluated.
    84+
    85+If the total summed over all transaction inputs is strictly higher than 2500, the transaction is invalid.
    


    darosior commented at 7:43 pm on November 13, 2025:

    Could you put this sentence directly before the sentence “The accounting is the same as for …” instead of in a new paragraph by itself?

    It would read:

    It applies to all transactions in the block except the coinbase transaction. For each input in the transaction, count the number of CHECKSIG and CHECKMULTISIG in the input scriptSig and previous output’s scriptPubKey, including the P2SH redeemScript. If the total summed over all transaction inputs is strictly higher than 2500, the transaction is invalid. The accounting is the same as for bip-0016, evaluating the scriptSig, scriptPubKey, and P2SH redeemScript separately:

    1. OP_CHECKSIG and OP_CHECKSIGVERIFY count as 1 signature operation, whether or not they are evaluated.
    2. OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY immediately preceded by OP_1 through OP_16 are counted as 1 to 16 signature operation, whether or not they are evaluated.
    3. All other OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY are counted as 20 signature operations, whether or not they are evaluated.

    Which i find preferable.


    instagibbs commented at 3:19 pm on November 14, 2025:
    done
  8. darosior commented at 7:44 pm on November 13, 2025: member
    Thanks, i agree the language could be clearer and your change improves it.
  9. instagibbs force-pushed on Nov 14, 2025
  10. instagibbs force-pushed on Nov 14, 2025
  11. bip54: clarify sigops counting, borrow bip16 language 459298ab0e
  12. instagibbs force-pushed on Nov 14, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-17 16:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me