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.
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
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.
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.
31c232a39b clarify that secp scalars are unsigned big endian (sanket1729)
f11fe0ad9c Update spec for rolling sha256 opcodes (sanket1729)
3055e85042 Rename taptweak (sanket1729)
a651f7ed4b More updates to spec (sanket1729)
147b9b7f6a Remove binary operations for 64 bits (sanket1729)
95f82f5080 Update spec for inputoutpoint (sanket1729)
6c4971dfbd Confirm overflow behaviour of scalars (sanket1729)
1d778dd632 Remove shifts, update output spk introspection (sanket1729)
49978abf5a Renumber opcodes; minor fixups (sanket1729)
3be79d1257 Update LE32 to read only unsigned (sanket1729)
d3cff9eea4 Update overflow behavior (sanket1729)
50733b8826 Flatten out introspection opcodes (sanket1729)
4bce8af953 Remove MULTISCALAREXPVERIFY. Sigops budget calculation is mentioned in respective opcode sections (sanket1729)
5ae2945da7 [WIP] updated spec for tapscript opcodes (sanket1729)
Pull request description:
This is an updating document for the latest specification of tapscript opcodes. This will be updated in parallel while the implementation is in progress
ACKs for top commit:
apoelstra:
ACK 31c232a39b
Tree-SHA512: 6862c9c09e340674d30d53cddc9a6adbcb67edcc00871c934a2b775f64537382ae4679a03b9a71e2a63aba0f66f181d1355051f452f7ef1a9017601fa9190127
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
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