Uh oh!
There was an error while loading. Please reload this page.
Implement Taproot Sighash - #1002
Conversation
fde71a0 to
4a7685aComparesanket1729
commented
May 21, 2021
The test seems flaky |
There was a problem hiding this comment.
For reference failed logs: https://cirrus-ci.com/task/6028890096271360?logs=ci#L3628
sanket1729
commented
May 21, 2021
No diff between |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
sanket1729
left a comment
There was a problem hiding this comment.
Fixed the comments
Uh oh!
There was an error while loading. Please reload this page.
f2452a3 to
afa015dCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
40f50e8 to
f1ac1beCompareapoelstra
commented
Jun 8, 2021
I think, as long as our test suite passes, there is no need to add new |
| ss += struct.pack("<i", txTo.nVersion) | ||
| ss += struct.pack("<I", txTo.nLockTime) | ||
| if in_type != SIGHASH_ANYONECANPAY: | ||
| ss += sha256(b"".join(struct.pack("B", ((not i.assetIssuance.isNull()) >> 7) + (i.m_is_pegin >> 6)) for i in txTo.vin)) |
There was a problem hiding this comment.
These should be << rather than >> (same below)
There was a problem hiding this comment.
One more reason to write tests :)
apoelstra
commented
Jun 17, 2021
e7b4bba looks great! Just needs some more tests and we're good to go |
| return r | ||
| # serialization used in taproot sighash | ||
| def tap_sighash_serialize(self): |
There was a problem hiding this comment.
Can you rename this (and change the comment) to indicate that it is specifically for asset issuance data?
There was a problem hiding this comment.
It is inside the class CAssetIssuance, so it is implicit that it is for asset issuance?
There was a problem hiding this comment.
edited the name to taphash_asset_issuance_serialize
| # | ||
| # Test use of assetdir to locally label assets. | ||
| # Test listissuances returns a list of all issuances or specific issuances based on asset hex or asset label. | ||
| # |
There was a problem hiding this comment.
This looks great! Can you add it to test_runner.py so it gets run in CI?
sanket1729
left a comment
There was a problem hiding this comment.
Changed the function name and added test to test_runner.py
…ash_pegins_issuances.py 1c883db test: update `createrawtransaction` call in feature_taphash_pegins_issuances.py (Andrew Poelstra) Pull request description: Should describe the outputs as an array rather than as an object. (The old behavior has long been deprecated but was eliminated entirely in #900.) Fixes functional tests which were broken in master by simultaneous merge of #1002 and #900. ACKs for top commit: stevenroose: utACK 1c883db Tree-SHA512: f7963c34e7006a25ac5515e30966ef46777fa22d6125d219345731aef603e5f3179fc316134d59694af8e753f7cb48c825ad3434f2bceda0a10b8d5a52c32cd3
| { | ||
| CHashWriter ss(SER_GETHASH, 0); | ||
| for (const auto& txin : txTo.vin) { | ||
| ss << (unsigned char) ((!txin.assetIssuance.IsNull() << 7) + (txin.m_is_pegin << 6)); |
There was a problem hiding this comment.
Consider instead using (COutPoint::OUTPOINT_ISSUANCE_FLAG >> 24) and (COutPoint::OUTPOINT_PEGIN_FLAG >> 24) (you can compose the flags and shift the result if you prefer).
I believe | is prefered over + for flag composition.
| const uint8_t spend_type = (ext_flag << 1) + (have_annex ? 1 : 0); // The low bit indicates whether an annex is present. | ||
| ss << spend_type; | ||
| if (input_type == SIGHASH_ANYONECANPAY) { | ||
| ss << (unsigned char) ((!tx_to.vin[in_pos].assetIssuance.IsNull() << 7) + (tx_to.vin[in_pos].m_is_pegin << 6)); |
There was a problem hiding this comment.
We should probably abstract this flag composition into its own function as it occurs in two places.
| ss << tx_to.vin[in_pos].prevout; | ||
| ss << cache.m_spent_outputs[in_pos]; | ||
| ss << cache.m_spent_outputs[in_pos].nAsset; | ||
| ss << cache.m_spent_outputs[in_pos].nValue; |
There was a problem hiding this comment.
Maybe comment here that we are not using the nonce and maybe even why we aren't?
sanket1729
commented
Jul 26, 2021
@roconnor-blockstream Addressed in #1023 |
2612017 Address post merge feedback for Taphash (sanket1729) Pull request description: Addressing the review by @roconnor-blockstream on #1002 . ACKs for top commit: apoelstra: ACK 2612017 Tree-SHA512: 62121ba33cf1fccda75cd2402c22799ccee437ba64575e6f5561b0aa1c571b6d94f3981fb4c1260a8c2848a26e1790d770364ade2af3edb5a98be29c23d6e0a2
This introduces Taproot wallet support. I fixed all the merge conflicts and ensured that the tests pass, but this is still using the old sighash (before Russell/Sanket/I redid it) so is not actually production ready. Will be fixed when we bring Elements #1002 in.
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.
No description provided.