Commit graph

239 commits

Author SHA1 Message Date
Byron Hambly
6bd5dfb3bd Merge d87a37a4ab into merged_master (Bitcoin PR bitcoin/bitcoin#24167) 2023-06-28 16:52:04 +00:00
Byron Hambly
47626b5a64 Merge 623745ca74 into merged_master (Bitcoin PR bitcoin/bitcoin#23912) 2023-06-14 15:44:11 +00:00
Byron Hambly
e4003da763 Merge b7e63306e8 into merged_master (Bitcoin PR bitcoin/bitcoin#23687) 2023-06-02 12:06:39 +00:00
James Dorfman
72a90148c8 Merge 8b1de78577 into merged_master (Bitcoin PR bitcoin/bitcoin#23413) 2023-06-01 18:51:42 +00:00
James Dorfman
84d20582c4 Merge fd1c9e26d3 into merged_master (Bitcoin PR bitcoin/bitcoin#23653) 2023-06-01 17:20:28 +00:00
Byron Hambly
1beaa601b4 Merge 5ccab7187b into merged_master (Bitcoin PR bitcoin/bitcoin#23394)
- commented out some script tests that need to be fixed
 - commented out feature_taproot.py since it needs significant updates
2023-05-26 09:14:20 +00:00
James Dorfman
ab7a42420a Merge e826b22da2 into merged_master (Bitcoin PR bitcoin/bitcoin#22275) 2023-04-10 19:25:44 +00:00
James Dorfman
400c44abcc Merge 9faa4b68db into merged_master (Bitcoin PR #22232) 2023-03-16 04:51:52 +00:00
fanquake
5e8975e269
fs: consistently use fsbridge for fopen() 2022-01-26 22:08:29 +08:00
Hennadii Stepanov
f47dda2c58
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
* 2020: fa0074e2d8
* 2019: aaaaad6ac9
2021-12-30 19:36:57 +02:00
Pieter Wuille
31ba1af74a Remove unused (and broken) functionality in SpanReader
This removes the ability to set an offset in the SpanReader constructor,
as the current code is broken. All call sites use pos=0, so it is actually
unused. If future call sites need it, SpanReader{a, b, c, d} is equivalent
to SpanReader{a, b, c.subspan(d)}.

It also removes the ability to deserialize from SpanReader directly from
the constructor. This too is unused, and can be more idiomatically
simulated using (SpanReader{a, b, c} >> x >> y >> z) instead of
SpanReader{a, b, c, x, y, z}.
2021-12-06 16:18:14 -05:00
MarcoFalke
8b1de78577
Merge bitcoin/bitcoin#23413: Replace MakeSpan helper with Span deduction guide
11daf6ceb1 More Span simplifications (Pieter Wuille)
568dd2f839 Replace MakeSpan helper with Span deduction guide (Pieter Wuille)

Pull request description:

  C++17 supports [user-defined deduction guides](https://en.cppreference.com/w/cpp/language/class_template_argument_deduction), allowing class constructors to be invoked without specifying class template arguments. Instead, the code can contain rules to infer the template arguments from the constructor argument types.

  This alleviates the need for the `MakeSpan` helper. Convert the existing MakeSpan rules into deduction rules for `Span` itself, and replace all invocations of `MakeSpan` with just `Span` ones.

ACKs for top commit:
  MarcoFalke:
    re-ACK 11daf6ceb1 Only change is removing a hunk in the tests 🌕

Tree-SHA512: 10f3e82e4338f39d9b7b407cd11aac7ebe1e9191b58e3d7f4e5e338a4636c0e126b4a1d912127c7446f57ba356c8d6544482e47f97901efea6a54fffbfd7895f
2021-12-03 10:44:37 +01:00
Pieter Wuille
2c35a93b3c Generalize/simplify VectorReader into SpanReader 2021-12-02 14:47:17 -05:00
Pieter Wuille
568dd2f839 Replace MakeSpan helper with Span deduction guide 2021-11-29 17:58:53 -05:00
Pieter Wuille
f1c33ee4ac tests: implement BIP341 test vectors 2021-11-12 12:05:00 -05:00
Andrew Poelstra
6387aaf765 Merge feee029d29 into merged_master (Elements PR ElementsProject/elements#1020)
Messy merge conflicts because this PR backported some ad-hoc stuff from
upstream while keeping a few things that upstream deleted. Hopefully
reviewing is easier than doing this in the first place, since ultimately
all I did was delete code from one side or another of the conflicts.
(Ok, I also changed some boost optional stuff to std::optional, and had
to patch up a test file for test framework changes.)

When reviewing the detailed crypto, bear in mind that taptweaks, like all
hashes are the kind of crypto that cannot be subtly wrong -- it will either
fail very hard or be correct. And we have independent implementations in
C++ and Python that cross-check each other, si it's unlikely to be the former.
2021-09-05 13:42:34 +00:00
Andrew Poelstra
7d1c77f0a1 Merge 1ba24fe9b3 into merged_master (Elements PR ElementsProject/elements#1002)
This forward-ports the new Taproot sighash but does not fix a couple
22-blocked TODOs related to the MissingDataBehavior enum. Should be fixed
in a followup commit.

One nontrivial change I had to make was feeding the genesis hash to SignTransaction
(the "global" one in script/sign.cpp) so that it could correctly compute
the sighash at signing time.
2021-09-04 22:14:42 +00:00
sanket1729
2df8e99813 Implement Streaming SHA256 opcodes
Co-authored-by: roconnor-blockstream  <roconnor@blockstream.com>
2021-08-26 20:28:01 +00:00
Pieter Wuille
d8f4b976d5 Remove default nHashTypeIn arguments to MutableTransactionSignatureCreator
These were unused except in tests, and were also overlooked when changing
SIGHASH_ALL -> SIGHASH_DEFAULT.
2021-08-20 14:29:23 -04:00
Andrew Poelstra
9ea813efb8 Merge 4a26705761 into merged_master (Bitcoin PR bitcoin/bitcoin#21902) 2021-07-09 00:08:06 +00:00
Andrew Poelstra
3850e85010 Merge 32f1f021bf into merged_master (Bitcoin PR bitcoin/bitcoin#21817) 2021-07-07 02:29:25 +00:00
sanket1729
a26f6fead6 Expose only blockchain hash twice in header 2021-07-01 17:56:44 +00:00
Andrew Poelstra
afb9e7b727 taproot: feed genesis hash and parent pegged asset to sighash function 2021-07-01 17:56:44 +00:00
Andrew Poelstra
9645faf781 Merge bd65a76b9d into merged_master (Bitcoin PR #21330) 2021-06-30 01:43:54 +00:00
MarcoFalke
fa621ededd
refactor: Pass script verify flags as uint32_t
They are cast to unsigned anyway when calling VerifyScript,
bitcoinconsensus_verify_script*, or CountWitnessSigOps.
2021-06-14 08:02:45 +02:00
MarcoFalke
fa4bbd306e
refactor: Remove useless extern keyword 2021-05-10 09:09:24 +02:00
MarcoFalke
fac30eec42
refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
Andrew Poelstra
ee5d4e3256 ci: temporarily disable qa-assets unit tests
These "pass" locally but in CI they download pre-signed transactions
from https://github.com/bitcoin-core/qa-assets/ which we need to
fork and recreate.

Essentially these files are the output of the Taproot functional
test (which passes), so I am not too worried about actual failures
here. But we should wait until after the Taproot sighash is finalized
to recreate these assets.
2021-03-26 17:33:04 +00:00
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
Pieter Wuille
3820090bd6 Make all SignatureChecker explicit about missing data
Remove the implicit MissingDataBehavior::ASSERT_FAIL in the
*TransationSignatureChecker constructors, and instead specify
it explicit in all call sites:
* Test code uses ASSERT_FAIL
* Validation uses ASSERT_FAIL (through CachingTransactionSignatureChecker)
  (including signet)
* libconsensus uses FAIL, matching the existing behavior of the
  non-amount API (and the extended required data for taproot validation
  is not available yet)
* Signing code uses FAIL
2021-03-15 17:29:39 -07: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