Skip to content

Conversation

glozow
Copy link
Member

@glozow glozow commented Feb 23, 2021

This is a followup to #19698.

  • There was a bug in the ExcludeIndividualFlags function which is fixed here.
  • Fixing this bug also showed that there is a test that's supposed to fail (already existing in tx_invalid.json) in tx_valid.json, so I removed it. Other than that, the tests should all pass.
  • Also implements a few suggestions I received offline: removing the OP_1s from the invalid tests (similar to 19db590), comments, and style.
  • A few other small fixes, like adding asserts, putting all the flags in mapFlagNames, better error messages

@glozow
Copy link
Member Author

glozow commented Feb 23, 2021

@MarcoFalke thanks for catching the bug - this should fix it

@glozow
Copy link
Member Author

glozow commented Feb 23, 2021

Cirrus failure is in feature_blockfilterindex_prune.py, which I'm pretty sure is unrelated, given that this is only touching the unit tests

@glozow glozow force-pushed the 2021-02-test-bug branch from c0295c4 to f5e150a Compare March 30, 2021 23:56
This exact test is also already in tx_invalid.json#L29
It will also test with no-P2SH flags, so duplicating with
different flags is not necessary.
@glozow glozow force-pushed the 2021-02-test-bug branch from f5e150a to a944a21 Compare March 31, 2021 13:32
Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

utACK a944a21

@glozow glozow force-pushed the 2021-02-test-bug branch 2 times, most recently from f61876c to 24f2951 Compare April 5, 2021 16:57
@glozow
Copy link
Member Author

glozow commented Apr 5, 2021

Updates:
Iterate through the values in mapFlagNames instead of all bits from 1 to size().
Check that all flags in STANDARD_SCRIPT_VERIFY_FLAGS are present in mapFlagNames. This would cover all relevant flags used for consensus and policy checks.

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

ACK 24f2951

A few small style suggestions inline if you retouch this.

glozow added 4 commits April 7, 2021 19:00
PR bitcoin#19168 introduced this function but it always returns an empty vector.
Add missing script verify flags to mapFlagNames.
iterate through mapFlagNames values instead of bits.

BOOST_CHECK_MESSAGE better reports which test failed exactly, whereas
BOOST_ERROR was just incrementing the error counter.
Similar to 19db590, which removed these
for the valid tests. Not removing ones that cause a false/empty stack
error because these tests should fail due to being invalid with CSV/CLTV
There is no way to iterate through all script verification flags, and
it's not guaranteed that every power of 2 is used. Just make sure that
all flags in STANDARD_SCRIPT_VERIFY_FLAGS are present in mapFlagNames;
this covers all consensus and policy flags. If mapFlagNames has more
flags than STANDARD_SCRIPT_VERIFY_FLAGS, that's okay. Nonexistent flags
will be caught by the compiler.
@glozow glozow force-pushed the 2021-02-test-bug branch from 24f2951 to b109bde Compare April 8, 2021 02:02
@glozow
Copy link
Member Author

glozow commented Apr 8, 2021

Addressed the compiler warning about unused variable and @jnewbery's comments - thanks!

@jnewbery
Copy link
Contributor

jnewbery commented Apr 8, 2021

utACK b109bde

@maflcko maflcko changed the title test / bug fix in transaction_tests test: bug fix in transaction_tests Apr 19, 2021
"01000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000065cd1d", "CHECKLOCKTIMEVERIFY"],
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKLOCKTIMEVERIFY 1"]],
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKLOCKTIMEVERIFY"]],
Copy link
Member

Choose a reason for hiding this comment

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

It might be nice to check the exact script reject reason instead of just failure

@maflcko maflcko merged commit cfec4a1 into bitcoin:master Apr 19, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 19, 2021
b109bde [test] check that mapFlagNames is up to date (glozow)
5d3ced7 [test] remove unnecessary OP_1s from invalid tests (glozow)
5aee73d [test] minor improvements / followups (glozow)
8a365df [test] fix bug in ExcludeIndividualFlags (glozow)
8cac292 [test] remove invalid test from tx_valid.json (glozow)

Pull request description:

  This is a followup to bitcoin#19698.

  - There was a bug in the `ExcludeIndividualFlags` function which is fixed here.
  - Fixing this bug also showed that there is a test that's supposed to fail (already existing in tx_invalid.json) in tx_valid.json, so I removed it. Other than that, the tests should all pass.
  - Also implements a few suggestions I received offline: removing the `OP_1`s from the invalid tests (similar to bitcoin@19db590), comments, and style.
  - A few other small fixes, like adding asserts, putting all the flags in `mapFlagNames`, better error messages

ACKs for top commit:
  jnewbery:
    utACK b109bde

Tree-SHA512: 7233a8c0f1ae1172fac8000ea6e05384ecf79074c39948d118464868505c7f02f17e96503c81bd05c07adb2087648a5d93d9899e16fdefa6b7efcb51319444a9
JeremyRubin added a commit to JeremyRubin/bitcoin that referenced this pull request Apr 23, 2021
…sus flags, we need to be up to date with that. This should get rebased and fixed
JeremyRubin added a commit to JeremyRubin/bitcoin that referenced this pull request Apr 23, 2021
…sus flags, we need to be up to date with that. This should get rebased and fixed
JeremyRubin added a commit to JeremyRubin/bitcoin that referenced this pull request Apr 23, 2021
…sus flags, we need to be up to date with that. This should get rebased and fixed
@glozow glozow deleted the 2021-02-test-bug branch January 16, 2022 11:38
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Jan 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants