[TESTS] Update Transaction Tests to permit setting a flag as always on and disabling the exhaustive failure test #22870

pull JeremyRubin wants to merge 1 commits into bitcoin:master from bitcoin:update-txvalid-json changing 2 files +19 −8
  1. JeremyRubin commented at 0:03 am on September 3, 2021: contributor

    Fixes #22865. Required for #21702 tests.

    The basic issue is that that the current exclude flag doesn’t play nicely with flags like DISCOURAGE_UPGRADABLE_NOPS + SOME_OPCODE_VERIFY.

    When you have a valid TX under SOME_OPCODE_VERIFY, then the tests will try disabling that flag and it will trip over DISCOURAGE_UPGRADABLE_NOPS.

    When you exclude DISCOURAGE_UPGRADABLE_NOPS, then it gets re-included when the test checks all cominations of the excluded flags being re-enabled to show failure, but then it doesn’t fail when SOME_OPCODE_VERIFY is set.

    To address this, we add two optional fields: 1, a list of flags to always enable; 2, a bool of if to disable the one-by-one checker.

    By then testing the same vector with:

    0...'DISCOURAGE_UPGRADABLE_NOPS', 'NONE', true]
    1...'NONE', 'SOME_OPCODE_VERIFY']
    

    we get around the one flag at a time checker.

    An alternative approach, that would provide better testing coverage, would allow a more abritrary relationship checker that can be specificed by the test writer (e.g., a map of flag to implied flag) to be used during the one-by-one checker.

    We cannot simply apply these rules in FillFlags/TrimFlags because if we have a transaction that should fail normally with VERIFY_SOME_OPCODE and DISCOURAGE_UPGRADABLE_OPCODES we can’t support both cases.

    This gap arose when implementing test vectors for BIP-119. Along the way I also discovered that, e.g., CHECKSEQUENCEVERIFY’s Upgradable NOP treatment is improperly asserted as per:

    0                   // To provide for future soft-fork extensibility, if the
    1                    // operand has the disabled lock-time flag set,
    2                    // CHECKSEQUENCEVERIFY behaves as a NOP.
    3                    if ((nSequence & CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG) != 0)
    4                        break
    

    which does not assert the proper DISCOURAGE_UPGRADABLE_NOP behavior. I beleive that lack of discouragement to be mildly worrying but not a major security concern. Fixing the testing harnesses would allow us to properly implement DISCOURAGE_UPGRADABLE_NOPS for CSV and add the corresponding test cases.

  2. [TESTS] Update Transaction Tests to permit setting a flag as always on and disabling the exhaustive failure test 2877ebef6e
  3. fanquake added the label Tests on Sep 3, 2021
  4. MarcoFalke commented at 7:34 am on September 3, 2021: member
    Please use your own fork for feature branches, not the main repo
  5. MarcoFalke closed this on Sep 3, 2021

  6. MarcoFalke commented at 7:40 am on September 3, 2021: member
    @JeremyRubin You can rename the remote from origin to no_push_origin, or change the protocol to https to avoid this happening in the future by accident.
  7. JeremyRubin commented at 8:34 am on September 3, 2021: contributor
    ah crap i think the gh tool did that, wasn’t doing a manually push.
  8. laanwj deleted the branch on Sep 3, 2021
  9. DrahtBot locked this on Sep 3, 2022

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-12-22 03:12 UTC

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