Introduce script verification flags #2008

pull sipa wants to merge 1 commits into bitcoin:master from sipa:scriptflags changing 10 files +69 −63
  1. sipa commented at 10:06 pm on November 13, 2012: member

    These flags select features to be enabled/disabled during script evaluation/checking, instead of several booleans passed along. Currently these flags are defined:

    • SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
    • SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.

    No semantic changes.

  2. jgarzik commented at 0:11 am on November 14, 2012: contributor

    99% ACK

    Prefer unsigned for flags-type variables…

  3. luke-jr commented at 0:20 am on November 14, 2012: member
    Some reason not to use an enum type? :p
  4. sipa commented at 0:21 am on November 14, 2012: member
    You cannot OR enum type elements together without them degenerating to an integer type, I think.
  5. luke-jr commented at 1:39 am on November 14, 2012: member
    GCC doesn’t warn about it, at least.
  6. jgarzik commented at 2:06 am on November 14, 2012: contributor
    @sipa is correct. Storage class for enum is ‘int’, unless greater size is needed (int -> unsigned int -> long -> unsigned long -> etc., IIRC)
  7. laanwj commented at 6:29 am on November 14, 2012: member

    Indeed, you can define flags using an enum, but you can’t use the enum as parameter when you want to be able to specify multiple flags as it’s no longer an enumeration. I believe Qt has a ’typesafe flags’ type but that doesn’t help us here :) I do think defining the flag values using an enum has a nicer syntax than a list of const XXX.

    And I agree with @jgarzik that it’s better to have anything that you manipulate bitwise be unsigned. It steers clear of crazy undefined areas of C++, such as overflows flipping the sign bit.

  8. jgarzik commented at 6:50 am on November 14, 2012: contributor

    This might work, too, IIRC:

    0enum my_foo_bits {
    1    FLAG_FOO = (1U << 0),
    2    FLAG_BAR = (1U << 1),
    3};
    
  9. Diapolo commented at 7:44 am on November 14, 2012: none
    @laanwj Nice I observed the same problem with the client interface pull we are working on ^^. We should then change to unsigned int there, too, right? @luke-jr: GCC warns about OR 2 enum flags, when the function parameter is expected to be an enum ;), tried it.
  10. laanwj commented at 8:26 am on November 14, 2012: member
    Yes, it applies there too :)
  11. sipa commented at 8:48 am on November 14, 2012: member
    Updated.
  12. gavinandresen commented at 3:03 pm on November 14, 2012: contributor
    ACK
  13. laanwj commented at 6:15 am on November 15, 2012: member
    ACK
  14. Diapolo commented at 9:05 pm on November 15, 2012: none
    Comments from @jgarzik are not in, so it would be nice if @sipa could update to these last 4 suggestions before this should get merged IMO.
  15. Introduce script verification flags
    These flags select features to be enabled/disabled during script
    evaluation/checking, instead of several booleans passed along.
    Currently these flags are defined:
    * SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
    * SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
    99d0d0f356
  16. sipa commented at 10:06 pm on November 15, 2012: member
    Updated.
  17. jgarzik referenced this in commit 3b9f029def on Nov 15, 2012
  18. jgarzik merged this on Nov 15, 2012
  19. jgarzik closed this on Nov 15, 2012

  20. laudney referenced this in commit da604f52d0 on Mar 19, 2014
  21. HashUnlimited referenced this in commit a56a5f3bd0 on Mar 21, 2018
  22. KolbyML referenced this in commit 7fe89170d5 on Dec 5, 2020
  23. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-03 10:13 UTC

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