Add script tests with actual signatures #4949

pull sipa wants to merge 2 commits into bitcoin:master from sipa:canscript changing 3 files +95 −7
  1. sipa commented at 1:28 AM on September 20, 2014: member

    Change the script_valid/script_invalid rules to use actually valid transactions, and add some simple tests with OP_CHECKSIG, and various verification flags.

  2. petertodd commented at 4:58 PM on September 20, 2014: contributor

    I was nearly going to say "why bother given we have the tx tests", but actually really what you're doing is more explicitly defining the context that the script tests run in. I'm working on OP_CHECKLOCKTIMEVERIFY, which looks like will probably need a broader notion of the context in which a script executes, but as this is purely a sane "default context" any further needs to modify the default can be handled separately without this causing any issues.

    It'd help if there was a comment saying, say, what the txid of that hypothetical coinbase transaction actually was. Heck, next time I write up a complex signature-using test I'll put the python script to create it in doc/ somewhere.

  3. sipa commented at 5:21 PM on September 20, 2014: member

    There are comments in script_valid.json and script_invalid.json, are those insufficient?

    I'm aware that this makes it closer to the tx tests, but these are more concise still, and enough to test most of the specific script weirdnesses.

  4. petertodd commented at 5:29 PM on September 20, 2014: contributor

    @sipa By putting the txid in the comment it makes it easy to figure out if you're code to make a new testcase is reproducing the coinbase tx properly; easy to imagine it being frustrating trying to figure out why it's not working. Also makes it easy to check if anything changes somehow via an unrelated change that makes the coinbase tx creation code change.

  5. petertodd commented at 5:29 PM on September 20, 2014: contributor

    Out of curiosity, how did you make those signatures?

  6. sipa commented at 5:48 PM on September 20, 2014: member

    Use BuildCreditingTransaction, and call SignSignature on it, and print out the result. I've thought about automating it, but all potential modifications for the invalid ones are pretty ugly to write as code.

  7. sipa commented at 6:03 PM on September 20, 2014: member

    I'm going to try to clean that generation code up, and include it in the tests.

  8. petertodd commented at 6:24 PM on September 20, 2014: contributor

    @sipa Cool!

  9. laanwj commented at 8:20 AM on September 22, 2014: member

    ACK, more tests is better.

  10. Use actually valid transactions for script tests 76ec867796
  11. Add actual signature tests c8589bf99e
  12. sipa force-pushed on Sep 22, 2014
  13. sipa commented at 5:36 PM on September 22, 2014: member
  14. BitcoinPullTester commented at 5:42 PM on September 22, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4949_c8589bf99e7d4b352763905e56799a03adda25a7/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  15. gmaxwell commented at 6:05 PM on September 22, 2014: contributor

    utACK.

  16. laanwj added the label Tests on Sep 23, 2014
  17. laanwj merged this on Sep 23, 2014
  18. laanwj closed this on Sep 23, 2014

  19. laanwj referenced this in commit 35ee2dac67 on Sep 23, 2014
  20. shea256 commented at 9:24 PM on June 2, 2015: contributor

    @petertodd @sipa Any idea if and when OP_CHECKLOCKTIMEVERIFY will be integrated? This would be a godsend for a project I'm working on.

  21. petertodd commented at 6:21 AM on June 3, 2015: contributor

    @shea256 Not really the right place for that question, but anyway, BIP66 needs to get adopted first: http://bitcoin.sipa.be/ver-2k.png http://bitcoin.sipa.be/ver-ever.png

    All the major pools have upgraded; what's left is <5% pools like slush.

  22. shea256 commented at 3:23 PM on June 3, 2015: contributor

    OK thank you Peter.

    I just looked through all the issues and this was the only one I saw that referenced CLTV. For the future, where should I direct my questions about this?

  23. laanwj commented at 5:57 PM on June 3, 2015: member

    The development mailing list is the place for discussion of network-wide issues

  24. shea256 commented at 6:16 PM on June 3, 2015: contributor

    Perfect, thank you. Please excuse my posting here, I will use that for the future.

  25. 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-19 09:15 UTC

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