Commit graph

210 commits

Author SHA1 Message Date
Andrew Poelstra
22cf380984 Merge a993a7c675 into merged_master (Elements PR #960)
Several conflicts in the C++ code related to the new `flags` parameter
to `CheckSignature` and the corresponding function being renamed upstream
to `CheckSignatureECDSA`.

Several conflicts in the test harness as Steven sorta pulled the new
upstream ECKey module into the Python code, and the actual upstream
code was slightly different. Also needed to update the feature_taproot
code to always use the non-RANGEPROOF sighash since dynafed is not
enabled in the Taproot test.

Also had to pull the `set_wif` method out of `ECKey` and inline it because
otherwise it triggers a "circular inclusion" error between script.py (which
would pull in `base58_to_bytes` from address.py) and address.py (which now
pulls in some taproot EC related stuff from script.py).

Noticed that #960 does not test the "sighash rangeproof flag set but no
witnesses" case.
2021-03-25 23:46:21 +00:00
Steven Roose
691040a63d
Add SIGHASH_RANGEPROOF support 2021-02-22 15:19:09 +00:00
Andrew Poelstra
76437996fb Merge 88776c2926 into merged_master (Bitcoin PR #20245) 2020-12-02 03:12:26 +00:00
Andrew Poelstra
5ca702b5d9 Merge 152ddb3197 into merged_master (Bitcoin PR #20180) 2020-12-01 06:29:15 +00:00
Andrew Poelstra
e765fc93ea Merge 3caee16946 into merged_master (Bitcoin PR #19953)
Taproot :D
2020-12-01 02:54:57 +00:00
Andrew Poelstra
54f2d85914 Merge 34eb236258 into merged_master (Bitcoin PR #19326) 2020-11-27 00:39:12 +00:00
Andrew Poelstra
11afdcc66a Merge 9ccaee1d5e into merged_master (Bitcoin PR #19004) 2020-11-26 01:08:51 +00:00
Andrew Poelstra
ba95deb36c Merge 19032c750c into merged_master (Bitcoin PR #18612) 2020-11-26 01:08:27 +00:00
Andrew Poelstra
fd37b7c5d6 Merge 54f812d9d2 into merged_master (Bitcoin PR #18673) 2020-11-26 01:08:23 +00:00
Andrew Poelstra
056b9bb06d Merge 46fc4d1a24 into merged_master (Bitcoin PR #17384) 2020-11-09 23:10:08 +00:00
Andrew Poelstra
6490a104e1 Merge 8f14d2002b into merged_master (Bitcoin PR #17183) 2020-11-09 21:20:43 +00:00
Andrew Poelstra
a50b652932 Merge 735d6b57e7 into merged_master (Bitcoin PR #16227) 2020-11-09 03:58:21 +00:00
Andrew Poelstra
9274da2dfc Merge 7400135b79 into merged_master (Bitcoin PR #16278) 2020-11-09 03:58:17 +00:00
Andrew Poelstra
161bcd2ae8 Merge 78295e97b8 into merged_master (Bitcoin PR #15788) 2020-10-28 16:43:03 +00:00
Andrew Poelstra
a8581ea138 Merge 6a135fbe5b into merged_master (Bitcoin PR #15638) 2020-10-28 03:16:57 +00:00
MarcoFalke
fa3967efdb
test: Replace ARRAYLEN with C++11 ranged for loop 2020-10-26 14:27:33 +01:00
MarcoFalke
fafc529053
test: Run AssetTest even if built --with-libs=no 2020-10-26 14:19:15 +01:00
Hennadii Stepanov
76bbcc414f
test: Fix -Wunused-function warning if configured --without-libs
This is a move-only change.
2020-10-18 19:06:01 +03:00
Pieter Wuille
0e2a5e448f tests: dumping and minimizing of script assets data
This adds a --dumptests flag to the feature_taproot.py test, to dump all its
generated test cases to files, in a format compatible with the
script_assets_test unit test. A fuzzer for said format is added as well, whose
primary purpose is coverage-based minimization of those dumps.
2020-10-12 17:18:47 -07:00
Pieter Wuille
4567ba034c tests: add generic qa-asset-based script verification unit test
This adds a unit test that does generic script verification tests,
with positive/negative witnesses/scriptsigs, under various flags.
The test data is large (several MB) so it's stored in the qa-assets
repo.
2020-10-12 17:18:47 -07:00
Pieter Wuille
02c4cc5c5d Make CHash256/CHash160 output to Span 2020-07-30 13:57:54 -07:00
Pieter Wuille
e549bf8a9a Make CHash256 and CHash160 consume Spans 2020-07-30 13:57:53 -07:00
Calvin Kim
c57f03ce17 refactor: Replace const char* to std::string
Some functions should be returning std::string instead of const char*.
This commit changes that.
2020-05-22 01:40:31 +09:00
Wladimir J. van der Laan
19032c750c
Merge #18612: script: Remove undocumented and unused operator+
ccccd51908 script: Remove undocumented and unused operator+ (MarcoFalke)

Pull request description:

  This operator has no documented use case and is also unused outside of test code. The test code and all other (imaginary) code that might use this operator is written more clear and concise by the existing CScript push operators for opcodes and data.

  Removing the operator is also going to protect against accidentally reintroducing bugs like this 6ff5f718b6 (diff-8458adcedc17d046942185cb709ff5c3L1135) (last time it was used).

ACKs for top commit:
  laanwj:
    ACK ccccd51908

Tree-SHA512: 43898ac77e4d9643d9f8ac6f8f65497a4f0bbb1fb5dcaecc839c3719aa36181ba77befb213e59a9f33a20a29e0173a0e9c4763b1930940b32c3d1598b3e39af9
2020-04-22 14:17:01 +02:00
MarcoFalke
fa488f131f
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
MarcoFalke
fac5c37300
scripted-diff: Sort test includes
-BEGIN VERIFY SCRIPT-
 # Mark all lines with #includes
 sed -i --regexp-extended -e 's/(#include <.*>)/\1 /g' $(git grep -l '#include' ./src/bench/ ./src/test ./src/wallet/test/)
 # Sort all marked lines
 git diff -U0 | ./contrib/devtools/clang-format-diff.py -p1 -i -v
-END VERIFY SCRIPT-
2020-04-16 13:32:36 -04:00
MarcoFalke
ccccd51908
script: Remove undocumented and unused operator+ 2020-04-15 10:01:55 -04:00
MarcoFalke
faec28252c
scripted-diff: test: Move setup_common to test library
-BEGIN VERIFY SCRIPT-
 # Move files
 for f in $(git ls-files src/test/lib/); do git mv $f src/test/util/; done
 git mv src/test/setup_common.cpp                     src/test/util/
 git mv src/test/setup_common.h                       src/test/util/
 # Replace Windows paths
 sed -i -e 's|\\setup_common|\\util\\setup_common|g' $(git grep -l '\\setup_common')
 sed -i -e 's|src\\test\\lib\\|src\\test\\util\\|g'  build_msvc/test_bitcoin/test_bitcoin.vcxproj
 # Everything else
 sed -i -e 's|/setup_common|/util/setup_common|g'    $(git grep -l 'setup_common')
 sed -i -e 's|test/lib/|test/util/|g'                $(git grep -l 'test/lib/')
 # Fix include guard
 sed -i -e 's|BITCOIN_TEST_SETUP_COMMON_H|BITCOIN_TEST_UTIL_SETUP_COMMON_H|g' ./src/test/util/setup_common.h
 sed -i -e 's|BITCOIN_TEST_LIB_|BITCOIN_TEST_UTIL_|g'                     $(git grep -l 'BITCOIN_TEST_LIB_')
-END VERIFY SCRIPT-
2019-11-06 11:56:41 -05:00
Sebastian Falbesoner
a0fc076476 refactor: test/bench: dedup Build{Crediting,Spending}Transaction()
prototypes used in src/test/script_tests.cpp:
- CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey, int nValue = 0);
- CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CScriptWitness& scriptWitness, const CTransaction& txCredit);

prototypes used in bench/verify_script.cpp:
- CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey);
- CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CMutableTransaction& txCredit);

The more generic versions from the script tests are moved into a new file pair
transaction_utils.cpp/h and the calls are adapted accordingly in the
verify_script benchmark (passing the nValue of 1 explicitely for
BuildCreditingTransaction(), passing empty scriptWitness explicitely and
converting txCredit parameter to CTransaction in BuildSpendingTransaction()).
2019-10-23 01:59:32 +02:00
Andrew Chow
37a79a4fcc Move various SigningProviders to signingprovider.{cpp,h}
Moves all of the various SigningProviders out of sign.{cpp,h} and
keystore.{cpp,h}. As such, keystore.{cpp,h} is also removed.

Includes and the Makefile are updated to reflect this. Includes were largely
changed using:
git grep -l "keystore.h" | xargs sed -i -e 's;keystore.h;script/signingprovider.h;g'
2019-07-09 16:20:18 -04:00
Andrew Chow
d9becff4e1 scripted-diff: rename CBasicKeyStore to FillableSigningProvider
-BEGIN VERIFY SCRIPT-
git grep -l "CBasicKeyStore" | xargs sed -i -e 's/CBasicKeyStore/FillableSigningProvider/g'
-END VERIFY SCRIPT-
2019-07-09 16:20:18 -04:00
practicalswift
9a841696c1 tests: Reduce compilation time and unneccessary recompiles by removing unused includes in tests 2019-06-26 20:37:48 +02:00
Steven Roose
f4889a5253
UPSTREAM MERGE BROKEN: Merge upstream commit '519b0bc5dc' into master 2019-05-17 16:17:09 +01:00
Steven Roose
7f894ae00b
UPSTREAM MERGE BROKEN: Merge commit 'f617e05c38' into master 2019-05-01 19:18:18 +01:00
Gregory Sanders
70946e7fee Replace CScriptID and CKeyID in CTxDestination with dedicated types 2019-04-29 10:15:23 -04:00
MarcoFalke
faf400077d
scripted-diff: Bump copyright headers in test, bench
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./src/bench/
./contrib/devtools/copyright_header.py update ./src/test/
-END VERIFY SCRIPT-
2019-04-11 13:34:43 -04:00
MarcoFalke
fa821904bf
scripted-diff: Rename test_bitcoin to test/setup_common
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/test_bitcoin\.(h|cpp)/setup_common.\1/g' $(git grep -l test_bitcoin)
git mv ./src/test/test_bitcoin.h   ./src/test/setup_common.h
git mv ./src/test/test_bitcoin.cpp ./src/test/setup_common.cpp
sed -i -e 's/BITCOIN_TEST_TEST_BITCOIN_H/BITCOIN_TEST_SETUP_COMMON_H/g' ./src/test/setup_common.h
-END VERIFY SCRIPT-
2019-04-11 10:12:36 -04:00
John Newbery
1acc61f874 [build] Move rpc utility methods to rpc/util
Moves the following utility methods to rpc/util and moves that unit to
libbitcoin_common so they can be accessed by all libraries.

- `RPCTypeCheck`
- `RPCTypeCheckArgument`
- `RPCTypeCheckObj`
- `AmountFromValue`
- `ParseHashV``ParseHashO`
- `ParseHexV`
- `ParseHexO`
- `HelpExampleCli`
- `HelpExampleRpc`
2019-04-09 17:53:08 -04:00
Steven Roose
cd56626647
[BROKEN] Adapt existing unit tests to CA 2019-03-20 12:05:50 +00:00
Gregory Sanders
aa375e66c1
Replace CScriptID and CKeyID in CTxDestination with dedicated type 2019-03-20 12:05:31 +00:00
Steven Roose
fb72ee8fc8 Add Elements-style witness serialization 2019-02-13 11:42:38 +00:00
Gregory Sanders
c62fab2d69 UPSTREAM MERGE BROKEN: Merge commit '3832c25f17' into merge_14225 2019-01-28 18:14:25 +00:00
practicalswift
b9dafe7d9f Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file. 2019-01-15 20:15:26 +01:00
Steven Roose
547d3a0c10 Add OP_SUBSTR_LAZY 2019-01-11 18:18:24 +00:00
Steven Roose
c27ea98605 Add OP_CHECKSIGFROMSTACK[VERIFY] 2019-01-10 12:12:16 +00:00
Steven Roose
358a1bb494 Add OP_DETERMINISTICRANDOM 2019-01-10 12:11:11 +00:00
MarcoFalke
9133227298
Merge #14935: tests: Test for expected return values when calling functions returning a success code
c84c2b8c92 tests: Test for expected return values when calling functions returning a success code (practicalswift)

Pull request description:

  Test for expected return values when calling functions returning a success code (instead of discarding the return values).

  **Note to reviewers:** The following commands can be used to verify that the only text fragments added in this PR are `BOOST_CHECK(`, `!` and `)` :

  ```
  $ git diff HEAD~1 | grep -E '^[\-][^\-]' | cut -b2- > before.txt
  $ git diff HEAD~1 | grep -E '^[\+][^\+]' | cut -b2- > after.txt
  $ cat after.txt | sed 's/BOOST_CHECK(//g' | sed 's/));/);/g' | tr -d '!' > after-sed.txt
  $ diff -u before.txt after-sed.txt
  $
  ```

Tree-SHA512: ff0863ef2046a2eda3c44e9c6b9aedfe167881f2fa58db29fef859416831233ef6502a3a11fd2322bc1a924db83df8d4a5c5879298007f2a7b085e2a7286af70
2018-12-14 14:21:23 -05:00
practicalswift
c84c2b8c92 tests: Test for expected return values when calling functions returning a success code 2018-12-13 09:37:23 +01:00
MarcoFalke
fa694f706c
test: Add tests for truncated scripts 2018-12-12 15:36:46 -05:00
lucash-dev
ed61abedb2 Removed implicit CTransaction constructor from tests 2018-12-11 19:43:35 -08:00