Commit graph

34507 commits

Author SHA1 Message Date
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
cf8ced903b Merge 0b8174b1fe into merged_master (Elements PR ElementsProject/elements#1023) 2021-09-05 02:42:13 +00:00
Andrew Poelstra
c3643b62a6 Merge d0095727d3 into merged_master (Elements PR pull #1024)
This updates libsecp to the latest API. This involves a sketchy (in
my view) cast of a const pointer to a const one, but (a) it is safe
given the actual usage of this pointer, and (b) I copied it directly
from Core -- see the final (20th) commit of the corresponding PR
https://github.com/bitcoin/bitcoin/pull/22448
2021-09-05 02:00:19 +00:00
Andrew Poelstra
1209d7ae1e Merge 0bc24d95a8 into merged_master (Elements PR ElementsProject/elements#1018)
This PR was a backport of PRs that have been merged as part of
this rebase. So I just made it an empty diff here.
2021-09-04 23:40:46 +00:00
Andrew Poelstra
38e599ce30 Merge aad04d0b9e into merged_master (Elements PR ElementsProject/elements#1017) 2021-09-04 22:56:59 +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
Andrew Poelstra
ff244b06d1 Merge e0532f60c7 into merged_master (Elements PR ElementsProject/elements#933) 2021-09-04 20:12:54 +00:00
Andrew Poelstra
36e5e2a7f1 Merge 9a154599fe into merged_master (Elements PR ElementsProject/elements#900)
Surprisingly easy to do. Almost all of the diff resolution was mechanically
  * replacing boost::variant with std::variant
  * replacing Optional with std::optional
     * then replacing `nullopt` with `std::nullopt`
  * updating the RPC functions for the new RPCArg::Default type
  * update the tests/ directory to make new (since 22) tests use arrays for
    createrawtransaction outputs
  * other ad-hoc changes to function parameters etc (not too many of these)

I had to "really" change the code in PrecomputePSBTData, which was introduced
in 22.0 and affected by PSET, but this function was like 8 lines long so it
was easy.

Reviewing the diff may be a bit difficult because of the mix of mechanical
changes and ad-hoc things. Probably the most straightforward thing to do
is to redo the merge, `sed -i` to fix the boost::variant and Optional stuff,
then diff the remaining conflicts against this commit.

TODO: grep for `blindpsbt` and you will see that this RPC is still referenced
in documentation and help text even though it was deleted. Need to fix this
in 0.21 in a separate PR.
2021-09-04 19:34:14 +00:00
Andrew Poelstra
feee029d29
Merge ElementsProject/elements#1020: Tapscript new opcodes
1577ed4e90 fuzz: add fuzz test for segwitv0 and tapscript script interpreters (Andrew Poelstra)
8a20fbe8a6 Add XOnlyPubKey::CreateTapTweak (Andrew Poelstra)
68961ca60e Make consensus checking of tweaks in pubkey.* Taproot-specific (Andrew Poelstra)
c3945cb39f Make XOnlyPubKey act like byte container (Pieter Wuille)
2c5c7eb87b Update tapscript leaf version (sanket1729)
937343c75c Add tests for crypto opcodes (sanket1729)
7193636d09 Add crypto opcodes (sanket1729)
3e7b8c6aed Test arithmetic opcodes (sanket1729)
4b9032209a Implement arithmetic opcodes (sanket1729)
6092d94c1d Add tests for introspection (sanket1729)
9346a8495e Implement transaction introspection opcodes (sanket1729)
97b53e0b89 Cache Input/Output ScriptPubkeys sha256 (sanket1729)
61b5152d44 Expose transaction data via BaseSignatureChecker (sanket1729)
007912eea4 Implement tests for sha256 streaming opcodes (sanket1729)
2df8e99813 Implement Streaming SHA256 opcodes (sanket1729)

Pull request description:

  Please refer to the new spec here. https://github.com/ElementsProject/elements/pull/1019

ACKs for top commit:
  apoelstra:
    ACK 1577ed4e90

Tree-SHA512: 297cfe8699982d9575a566eda2f5f4a253968552dbc9ff000440da4d6f5b175a1619d7a5074e1ddf6818e2c51f54a33142a89a63494f26ad946ca09e0cff94c5
2021-08-30 15:58:11 +00:00
Andrew Poelstra
1577ed4e90 fuzz: add fuzz test for segwitv0 and tapscript script interpreters 2021-08-27 19:31:34 +00:00
Andrew Poelstra
8a20fbe8a6 Add XOnlyPubKey::CreateTapTweak
https://github.com/bitcoin/bitcoin/pull/22051 (6/9)

Modified to use the old-style Optional rather than std::optional
2021-08-27 19:31:32 +00:00
Andrew Poelstra
68961ca60e Make consensus checking of tweaks in pubkey.* Taproot-specific
That results in a much safer interface (making the tweak commit
to the key implicitly using a fixed tag means it can't be used for
unrelated tweaking).

https://github.com/bitcoin/bitcoin/pull/22051 (5/9)
We actually preserve the "unrelated tweaking" method so we can
use it in OP_TWEAKVERIFY
2021-08-27 19:24:07 +00:00
Pieter Wuille
c3945cb39f Make XOnlyPubKey act like byte container
https://github.com/bitcoin/bitcoin/pull/22051 (1/9)
2021-08-27 19:24:07 +00:00
sanket1729
2c5c7eb87b Update tapscript leaf version 2021-08-27 19:24:07 +00:00
sanket1729
937343c75c Add tests for crypto opcodes 2021-08-27 19:24:07 +00:00
sanket1729
7193636d09 Add crypto opcodes 2021-08-27 19:24:06 +00:00
sanket1729
3e7b8c6aed Test arithmetic opcodes 2021-08-26 20:28:01 +00:00
sanket1729
4b9032209a Implement arithmetic opcodes 2021-08-26 20:28:01 +00:00
sanket1729
6092d94c1d Add tests for introspection 2021-08-26 20:28:01 +00:00
sanket1729
9346a8495e Implement transaction introspection opcodes 2021-08-26 20:28:01 +00:00
sanket1729
97b53e0b89 Cache Input/Output ScriptPubkeys sha256 2021-08-26 20:28:01 +00:00
sanket1729
61b5152d44 Expose transaction data via BaseSignatureChecker 2021-08-26 20:28:01 +00:00
sanket1729
007912eea4 Implement tests for sha256 streaming opcodes 2021-08-26 20:28:01 +00:00
sanket1729
2df8e99813 Implement Streaming SHA256 opcodes
Co-authored-by: roconnor-blockstream  <roconnor@blockstream.com>
2021-08-26 20:28:01 +00:00
Andrew Poelstra
0b8174b1fe
Merge ElementsProject/elements#1023: Address post merge feedback for Taphash
2612017031 Address post merge feedback for Taphash (sanket1729)

Pull request description:

  Addressing the review by @roconnor-blockstream on #1002 .

ACKs for top commit:
  apoelstra:
    ACK 2612017031

Tree-SHA512: 62121ba33cf1fccda75cd2402c22799ccee437ba64575e6f5561b0aa1c571b6d94f3981fb4c1260a8c2848a26e1790d770364ade2af3edb5a98be29c23d6e0a2
2021-08-17 20:05:14 +00:00
sanket1729
2612017031 Address post merge feedback for Taphash 2021-08-17 16:25:00 +00:00
Glenn Willen
d0095727d3
Merge pull request #1024 from apoelstra/2021-07--secp-update
Update libsecp-zkp to 90580edcc98350c9df9bebee58d2f9616d801849
2021-08-16 12:26:12 -07:00
Andrew Poelstra
f2e33074db Merge 0355e30db3 into merged_master (Elements PR ElementsProject/elements#949) 2021-08-04 01:22:50 +00:00
Andrew Poelstra
79a9c9e715 Merge 42af9596ce into merged_master (Bitcoin PR bitcoin/bitcoin#22499) 2021-08-03 17:20:06 +00:00
Andrew Poelstra
71045e76ea Merge 539023ab41 into merged_master (Bitcoin PR bitcoin/bitcoin#22492) 2021-08-03 16:35:52 +00:00
Andrew Poelstra
3fff335dff Merge 8ed8164e6f into merged_master (Bitcoin PR bitcoin/bitcoin#22261) 2021-08-03 15:55:27 +00:00
Andrew Poelstra
fc9e070952 Merge e4487fd5bb into merged_master (Bitcoin PR bitcoin/bitcoin#22096) 2021-08-03 15:17:22 +00:00
Andrew Poelstra
57f2094b57 Merge 5c8820b399 into merged_master (Bitcoin PR bitcoin/bitcoin#22436) 2021-08-03 14:39:45 +00:00
Andrew Poelstra
434d3e7779 Merge 201c5e4aec into merged_master (Bitcoin PR bitcoin/bitcoin#22465) 2021-08-03 14:00:26 +00:00
Andrew Poelstra
f4218e33cb Merge 4fdd0ff9ee into merged_master (Bitcoin PR bitcoin/bitcoin#22199) 2021-08-03 13:23:40 +00:00
Andrew Poelstra
7a9b6ec4bf Merge e7441a6a45 into merged_master (Bitcoin PR bitcoin/bitcoin#21711) 2021-08-03 12:46:53 +00:00
Andrew Poelstra
6484dc0d67 Merge d542603c5a into merged_master (Bitcoin PR bitcoin/bitcoin#22502) 2021-08-03 03:23:17 +00:00
Andrew Poelstra
049058f5ae Merge 624a193330 into merged_master (Bitcoin PR bitcoin/bitcoin#22497) 2021-08-03 02:46:40 +00:00
Andrew Poelstra
1a7c69b689 Merge 54e31742d2 into merged_master (Bitcoin PR bitcoin/bitcoin#22455) 2021-08-03 02:09:56 +00:00
Andrew Poelstra
d4c71593bb Merge d3474b8df2 into merged_master (Bitcoin PR bitcoin/bitcoin#22387) 2021-08-03 01:33:10 +00:00
Andrew Poelstra
b387aac530 Merge e8f85e0e86 into merged_master (Bitcoin PR bitcoin/bitcoin#22421) 2021-08-03 00:56:20 +00:00
Andrew Poelstra
bc829ae9d6 Merge 0eea1dfe80 into merged_master (Bitcoin PR bitcoin/bitcoin#22445) 2021-08-03 00:18:09 +00:00
Andrew Poelstra
42343f2fdc Merge 5341c3b1b3 into merged_master (Bitcoin PR bitcoin/bitcoin#22461) 2021-08-02 23:08:58 +00:00
Andrew Poelstra
cc0e38ccb2 Merge 4371e635d6 into merged_master (Bitcoin PR bitcoin/bitcoin#22410) 2021-08-02 22:31:31 +00:00
Andrew Poelstra
7cf6e89f12 Merge 4315dc02a1 into merged_master (Bitcoin PR bitcoin/bitcoin#20641) 2021-08-02 21:54:48 +00:00
Andrew Poelstra
6bd2a816e9 Merge b5889611c7 into merged_master (Bitcoin PR bitcoin/bitcoin#22234) 2021-08-02 21:18:02 +00:00
Andrew Poelstra
2fa422afec Merge 6baabc4d1d into merged_master (Bitcoin PR bitcoin/bitcoin#21430) 2021-08-02 20:39:15 +00:00
Andrew Poelstra
dd2645a060 Merge f8b20fd35b into merged_master (Bitcoin PR bitcoin/bitcoin#22464) 2021-08-02 20:02:26 +00:00
Andrew Poelstra
6361a13268 Merge a88fa1a555 into merged_master (Bitcoin PR bitcoin/bitcoin#22211) 2021-08-02 19:21:52 +00:00
Andrew Poelstra
0bfb3367ed Merge 853ac47705 into merged_master (Bitcoin PR bitcoin/bitcoin#22393) 2021-08-02 18:44:02 +00:00