Commit graph

98 commits

Author SHA1 Message Date
Chris Stewart
b682960a28 Adding P2SH(p2pkh) script test case
Fixing formatting

Adding test case into automatically generated test case set

Clean up commits

removing extra whitespace from eol

Removing extra whitespace on macro line
2016-05-30 08:51:37 -05:00
Gavin Andresen
e2a30bc9a9 Unit test for CScript::FindAndDelete 2016-04-19 13:22:45 -07:00
Pieter Wuille
dde46d3ae1 Merge script_valid and script_invalid tests 2016-04-05 16:11:47 +02:00
Pieter Wuille
009b503792 Get rid of expect in script_tests as it's implied by scripterror 2016-04-05 15:50:17 +02:00
Pieter Wuille
76da761351 Make script_error a mandatory 4th field for script_tests 2016-04-05 15:46:16 +02:00
Pieter Wuille
269281b7cc Fix some misconstructed tests
They claimed to be testing P2SH scripts with non-push scriptSigs, but
1) they were not enabling P2SH
2) they have push-only scriptSigs

Fix this, and add a few more related cases.
2016-04-05 14:54:37 +02:00
Pieter Wuille
c7c664191f Fix JSON pretty printing in script_tests 2016-04-05 14:54:33 +02:00
Wladimir J. van der Laan
f1ca8915bb
Merge #7517: test: script_error checking in script_invalid tests
0ecb340 test: Script_error checking in script_invalid tests (Wladimir J. van der Laan)
2317ad7 test: Re-introduce JSON pretty printing in test builder (Wladimir J. van der Laan)
b0ff857 test: Move non-generated script_invalid test to the correct place (Wladimir J. van der Laan)
2016-03-14 11:30:06 +01:00
Wladimir J. van der Laan
80d1f2e483
Merge #7184: Implement SequenceLocks functions for BIP 68
b043c4b fix sdaftuar's nits again (Alex Morcos)
a51c79b Bug fix to RPC test (Alex Morcos)
da6ad5f Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar)
c6c2f0f Implement SequenceLocks functions (Alex Morcos)
2016-02-12 17:03:46 +01:00
Wladimir J. van der Laan
0ecb3401fe test: Script_error checking in script_invalid tests
Check the returned script_error. Add expected script_error
for generated as well as custom tests.

The specific error is not part of consensus, however
it could avoid unclear reporting issues such as #6862 in the future.

Fixes #7513.
2016-02-11 17:33:28 +01:00
Wladimir J. van der Laan
2317ad7c56 test: Re-introduce JSON pretty printing in test builder 2016-02-11 17:33:28 +01:00
Alex Morcos
c6c2f0fd78 Implement SequenceLocks functions
SequenceLocks functions are used to evaluate sequence lock times or heights per BIP 68.

The majority of this code is copied from maaku in #6312
Further credit: btcdrak, sipa, NicolasDorier
2016-02-10 15:35:33 -05:00
Wladimir J. van der Laan
605c17844e
Merge pull request #7205
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke)
fa24439 Bump copyright headers to 2015 (MarcoFalke)
fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2016-01-05 14:11:40 +01:00
mb300sd
37d271d7cc Rename OP_NOP2 to OP_CHECKLOCKTIMEVERIFY. 2015-12-15 02:01:45 -05:00
MarcoFalke
fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Pieter Wuille
114b5812f6 Prevector type 2015-11-13 18:15:20 +01:00
Jonas Schnelli
9623e93473 [Univalue] add univalue over subtree
similar to secp256k1 include and compile univalue over a subtree
2015-10-01 10:49:57 +02:00
mruddy
af3208bfa6 Resolve issue 3166.
These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts.
This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa.
2015-07-30 19:56:00 -04:00
Jorge Timón
60c8bac77c Includes: Cleanup around net main and wallet
-Move from .h to .cpp: in main, net and wallet
-Remove unnecessary #include "main.h"
-Cleanup some wallet files includes
2015-07-23 21:10:26 +02:00
Jorge Timón
9dd793f499 TRIVIAL: Missing includes 2015-07-23 21:10:22 +02:00
Jonas Schnelli
9a8897f4ac Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
2015-06-04 09:16:21 +02:00
Jonas Schnelli
3df0411ad9 remove JSON Spirit UniValue wrapper 2015-06-04 09:16:06 +02:00
Jonas Schnelli
6c7bee0624 expicit set UniValue type to avoid empty values 2015-06-04 09:16:05 +02:00
Jonas Schnelli
53b4671a9d extend conversion to UniValue 2015-06-04 09:16:05 +02:00
Jeff Garzik
15982a8b69 Convert tree to using univalue. Eliminate all json_spirit uses. 2015-06-04 09:16:05 +02:00
Wladimir J. van der Laan
92fd887fd4 tests: add a BasicTestingSetup and apply to all tests
Make sure that chainparams and logging is properly initialized. Doing
this for every test may be overkill, but this initialization is so
simple that that does not matter.

This should fix the travis issues.
2015-03-12 09:45:22 +01:00
Suhas Daftuar
78c6bedb9c Add test for DER-encoding edge case
The fix to NegateSignatureS caused a test which had been failing
in IsValidSignatureEncoding to then fail in IsLowDERSignature.
Add new test so the original check remains exercised.
2015-02-10 13:25:41 -05:00
Suhas Daftuar
6f50dbd2fd Fix NegateSignatureS to not duplicate last byte of S
NegateSignatureS is called with a signature without a hashtype, so
do not save the last byte and append it after S negation.

Updates the two tests which were affected by this bug.
2015-02-10 13:23:57 -05:00
Wladimir J. van der Laan
41e6e4caba
Merge pull request #5713
bf6cdeb Increase coverage of DERSIG edge cases (Pieter Wuille)
819bcf9 Add RPC test for DERSIG BIP switchover logic (Pieter Wuille)
5a47811 BIP66 changeover logic (Pieter Wuille)
092e9fe Example unit tests from BIP66 (Pieter Wuille)
80ad135 Change IsDERSignature to BIP66 implementation (Pieter Wuille)
2015-02-03 10:34:53 +01:00
Pieter Wuille
9fddceda44 Avoid storing a reference passed to SignatureChecker constructors 2015-02-02 20:19:46 -08:00
Pieter Wuille
858809a33e Use separate SignatureChecker for CMutableTransaction 2015-02-02 20:19:12 -08:00
Pieter Wuille
092e9fe5fb Example unit tests from BIP66 2015-02-01 17:47:21 -04:00
Wladimir J. van der Laan
48e1765e27
Merge pull request #5143
da918ac Make SCRIPT_VERIFY_CLEANSTACK a standardness requirement (Pieter Wuille)
b6e03cc Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6) (Pieter Wuille)
ae4151b No semantic change: reuse stack variable in P2SH evaluation (Pieter Wuille)
2015-01-08 12:01:22 +01:00
Wladimir J. van der Laan
729ba31749
Merge pull request #5513
856e862 namespace: drop most boost namespaces and a few header cleanups (Cory Fields)
9b1ab86 namespace: drop boost::assign altogether here (Cory Fields)
a324199 namespace: remove boost namespace pollution (Cory Fields)
2015-01-06 20:32:45 +01:00
Cory Fields
856e862f4a namespace: drop most boost namespaces and a few header cleanups
A few boost::asio were left around because they're very wordy otherwise.
2015-01-02 15:12:03 -05:00
Pavel Vasin
de236f57c6 clarify obscure uses of EvalScript()
The 3rd argument of EvalScript() is the unsigned int flags, not a bool.
2014-12-30 10:01:16 +03:00
Pieter Wuille
f67a9ce0dc Use deterministically generated script tests
Now that signing is deterministic, we can require exact correspondence between the
automatically generated tests and the ones read from JSON. Do this, and update
the tests to those deterministic versions. Note that some flag changes weren't
correctly applied before.
2014-12-01 21:29:02 +01:00
Wladimir J. van der Laan
f0877f8b62
Merge pull request #5227
4cdaa95 Resize after succesful result (Pieter Wuille)
9d8604f Header define style cleanups (Pieter Wuille)
a53fd41 Deterministic signing (Pieter Wuille)
3060e36 Add the RFC6979 PRNG (Pieter Wuille)
a8f5087 Add HMAC-SHA256 (Pieter Wuille)
36fa4a7 Split up crypto/sha2 (Pieter Wuille)
2014-12-01 14:57:58 +01:00
Pieter Wuille
b6e03cc592 Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6)
Based on an earlier patch by Peter Todd, though the rules here are different
(P2SH scripts should not have a CLEANSTACK check before the P2SH evaluation).
2014-11-25 12:38:01 +01:00
Pieter Wuille
a53fd41485 Deterministic signing 2014-11-20 17:22:06 +01:00
Pieter Wuille
98b135f97f Make STRICTENC invalid pubkeys fail the script rather than the opcode.
This turns STRICTENC turn into a softforking-safe change (even though it
is not intended as a consensus rule), and as a result guarantee that using
it for mempool validation only results in consensus-valid transactions in
the mempool.
2014-11-20 15:29:26 +01:00
Cory Fields
269efa30ed build: add quick consensus lib tests
They should be hooked up in other places as well, but this is a start.
2014-11-19 22:31:10 -05:00
Pieter Wuille
4c97c64bf6 Do not use EC code in global constructors 2014-11-18 18:06:46 +01:00
Cory Fields
219a1470c4 script: check ScriptError values in script tests 2014-11-14 16:25:53 -05:00
Pieter Wuille
f4e0aefadc Do signature-s negation inside the tests
To avoid the need for libsecp256k1 to expose such functionality.
2014-11-10 05:03:24 -08:00
Pieter Wuille
698c6abb25 Add SCRIPT_VERIFY_MINIMALDATA (BIP62 rules 3 and 4)
Also use the new flag as a standard rule, and replace the IsCanonicalPush
standardness check with it (as it is more complete).
2014-10-25 03:03:20 -07:00
Pieter Wuille
d752ba86c1 Add SCRIPT_VERIFY_SIGPUSHONLY (BIP62 rule 2) 2014-10-25 03:03:16 -07:00
Cory Fields
e9ca4280f3 script: add ToByteVector() for converting anything with begin/end
This should move to a util header once their dependencies are cleaned up.
2014-10-17 13:44:14 -04:00
Cory Fields
066e2a1403 script: move CScriptID to standard.h and add a ctor for creating them from CScripts
This allows for a reversal of the current behavior.

This:
CScript foo;
CScriptID bar(foo.GetID());

Becomes:
CScript foo;
CScriptID bar(foo);

This way, CScript is no longer dependent on CScriptID or Hash();
2014-10-17 13:44:14 -04:00
Pieter Wuille
9df9cf5a9f Make SCRIPT_VERIFY_STRICTENC compatible with BIP62
* Delete canonical_tests.cpp, and move the tests to script_tests.cpp.
* Split off SCRIPT_VERIFY_DERSIG from SCRIPT_VERIFY_STRICTENC (the BIP62 part of it).
* Change signature STRICTENC/DERSIG semantics to fail the script entirely rather than the CHECKSIG result (softfork safety, and BIP62 requirement).
* Add many autogenerated tests for several odd cases.
* Mention specific BIP62 rules in the script verification flags.
2014-10-08 15:42:29 -07:00