-
Notifications
You must be signed in to change notification settings - Fork 832
Tagged hashes for taproot #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Yes, really need that option for implementing both single-use seals and RGB assets: https://github.com/rgb-org/spec/blob/v1.0/01-OpenSeals.md#pay-to-contract |
The implementation works now, but is still blocked by the upstream hashes PR. Very interesting, though! |
Codecov Report
@@ Coverage Diff @@
## master #259 +/- ##
==========================================
- Coverage 86.19% 81.82% -4.37%
==========================================
Files 39 39
Lines 7394 7026 -368
==========================================
- Hits 6373 5749 -624
- Misses 1021 1277 +256
Continue to review full report at Codecov.
|
7f72d53
to
633ce66
Compare
This is where I wish const fn's were more mature. |
Now that taproot is getting closer and we're not any closer to be able to do something like that in |
This should all work, though. The only issue I was trying to solve last week is the serde serializer and deserializer of the hex value. I can't get it to work over the generic type. I'm getting some errors. I just pushed my update: rust-bitcoin/bitcoin_hashes#42 Feel free to take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls see my comments: looks like this PR should belong to bitcoin_hashes
and not here. Also I ask for exporting the macro, which I use in other project.
|
||
use hashes::{sha256, sha256t}; | ||
|
||
/// The SHA-256 midstate value for the TapLeaf hash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm starting thinking that the whole taproot support in terms of tagged hashes should be part of bitcoin_hashes
alike other bitcoin-specific Hash160 etc. While this things are taproot-related, they have no other functionality then pure hash computation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed my mind after the second thought: #259 (comment)
Created my version on top of yours (stevenroose#1); b/c it required rebase onto master now it looks like it worth doing it as a separate PR to master... |
a2ee044
to
e7b7574
Compare
@dr-orlovsky I redid this branch a bit with some of your suggestions and also using the |
Taproot got merged: bitcoin/bitcoin#19953 Also |
So I rebased this PR and it's now mergable using the new bitcoin_hashes version. However, we might want to discuss directly putting these hashes in bitcoin_hashes instead. They are hashes after all.. Not sure if there's merit of having them here separately. I can be convinced of either option, probably. EDIT: Ok I think we should probably have it here in the bitcoin crate. |
For me it seems that everything related to transaction- or block-specific data types must reside in |
|
||
use hashes::{sha256, sha256t}; | ||
|
||
/// The SHA-256 midstate value for the TapLeaf hash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed my mind after the second thought: #259 (comment)
Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utack, but we need to fix the macros for rust 1.29 in bitcoin_hashes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reaso E1D2 n will be displayed to describe this comment to others. Learn more.
ack a56712b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd really love to see this using const fn
but for now this is what we have
ACK
bump version to 6.0.0
Currently blocked on rust-bitcoin/bitcoin_hashes#93.