Add more script edge condition tests. #6112

pull davecgh wants to merge 1 commits into bitcoin:master from davecgh:test_more_script_edges changing 2 files +9 −0
  1. davecgh commented at 3:20 PM on May 6, 2015: contributor

    This pull request adds some tests to the script_valid.json and tx_invalid.json data which exercise more edge conditions that are not currently being tested.

  2. Add more script edge condition tests.
    This commit adds some tests to the script_valid.json and tx_invalid.json
    data which exercise more edge conditions that are not currently being
    tested.
    1c54757f86
  3. gavinandresen commented at 8:23 PM on May 6, 2015: contributor

    Untested ACK-- I trust Travis exercised these new tests. Should be merged quickly in my opinion, testing edge cases is a very good thing.

  4. sipa commented at 8:41 PM on May 6, 2015: member

    utACK

  5. in src/test/data/tx_invalid.json:None in 1c54757f86
      18 | @@ -19,6 +19,12 @@
      19 |  [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "DUP HASH160 0x14 0x5b6462475454710f3c22f5fdf0b40704c92f25c3 EQUALVERIFY CHECKSIGVERIFY 1 0x4c 0x47 0x3044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a01"]],
      20 |  "01000000010001000000000000000000000000000000000000000000000000000000000000000000006b4c473044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a012103ba8c8b86dea131c22ab967e6dd99bdae8eff7a1f75a2c35f1f944109e3fe5e22ffffffff010000000000000000015100000000", "P2SH"],
      21 |  
      22 | +["This is the nearly-standard transaction with CHECKSIGVERIFY 1 instead of CHECKSIG from tx_valid.json"],
      23 | +["but with the signature duplicated in the scriptPubKey with a different hashtype suffix"],
      24 | +["See FindAndDelete, which will only remove if the signature, including the hash type, matches"],
      25 | +[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "DUP HASH160 0x14 0x5b6462475454710f3c22f5fdf0b40704c92f25c3 EQUALVERIFY CHECKSIGVERIFY 1 0x47 0x3044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a81"]],
      26 | +"01000000010001000000000000000000000000000000000000000000000000000000000000000000006a473044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a012103ba8c8b86dea131c22ab967e6dd99bdae8eff7a1f75a2c35f1f944109e3fe5e22ffffffff010000000000000000015100000000", "P2SH"],
      27 | +
    


    petertodd commented at 10:02 PM on May 6, 2015:

    Nice!

    Damn that's subtle, and also a malleability source come to think of it.


    petertodd commented at 10:12 PM on May 6, 2015:

    To be exact, any bits not covered by the 0x1f == SIGHASH_SINGLE mask can be changed at will w/o invalidating the signature. Not a major issue as the signer has to allow it to happen, but it's an interesting edge case that could come up in certain protocols if you can fool someone into somehow signing the hash 0x1 - conceivable in a multisig payment channel for instance.


    petertodd commented at 10:36 PM on May 6, 2015:

    Oh, actually I see what you're doing - this isn't related to the SIGHASH_SINGLE bug like I thought. You do successfully test what you think you're testing, but not in a realistic way. More realistic would be to create a test with a CHECKSIG in the scriptSig triggering this condition - that could be an actual tx with otherwise valid hashes.

    What I thought you'd noticed was that the SIGHASH_SINGLE bug works regardless of the state of the other SIGHASH flags, something which I don't think anyone's noticed before.

  6. petertodd commented at 10:16 PM on May 6, 2015: contributor

    utACK

  7. laanwj merged this on May 7, 2015
  8. laanwj closed this on May 7, 2015

  9. laanwj referenced this in commit fec5c0ea05 on May 7, 2015
  10. dexX7 referenced this in commit 6c479da045 on Sep 29, 2015
  11. dexX7 referenced this in commit be41d84fb9 on Sep 29, 2015
  12. MarcoFalke 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: 2026-04-26 12:15 UTC

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