-
Notifications
You must be signed in to change notification settings - Fork 138
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
Adding taptree_of_horror example. #766
Conversation
Rebased the last commit into my PR. Looking for review/feedback. I laid out a few talking points for discussion so I can get an idea of how to get this merged in:
|
I'd rather not. It seems like you just need to add some lines to the bottom for the new example and that's it. (Also ironically, your new source files have some trailing spaces in them, so maybe these need to have a linter/formatter run on them.)
No, this doesn't seem necessary to me. I tried removing this and replacing
Yeah, I like the theme. |
382f633
to
0e30756
Compare
Fixed
I'm not sure what you mean. Can you give me a specific example.
Fixed Thanks for the feedback, fixed the issues you pointed. Let me know what else you'd like to see in this PR. |
079a1d3
to
1282d30
Compare
|
||
// define individual variables to make it easy to insert into the policy string. | ||
// Define individual variables with pattern matching in a compact format | ||
let (a0, a1, a2, a3, a4, a5, a6, a7, a8) = match &a_pks[..] { |
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.
In 1282d30
Can replace all these with one-liners, e.g.
let [a0, a1, a2, a3, a4, a5, a6, a7, a8] = a_pks[..].try_into().unwrap();
I would also drop the Define individual variables with pattern matching
comment since it's just a repetition of the code.
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.
fyi, I'm also be including the explicit type to make the compiler/linter happy
[PublicKey; KEYS_PER_PERSONA]
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.
If you think that's necessary -- though I tried it without type annotations and it seemed to work. (Maybe you need the annotations once you convert all of them; I only did one.)
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 tried it again and removed the type for the "alice"/"a" keys and got this:
cargo +1.63.0 run --example taptree_of_horror --features compiler
Compiling miniscript v12.2.0 (/Users/tzez/git/github/rust-bitcoin/rust-miniscript)
error[E0282]: type annotations needed
--> examples/taptree_of_horror/taptree_of_horror.rs:88:9
|
88 | let [a0, a1, a2, a3, a4, a5, a6, a7, a8] = a_pks[..].try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: type must be known at this point
help: consider giving this pattern a type
|
88 | let [a0, a1, a2, a3, a4, a5, a6, a7, a8]: _ = a_pks[..].try_into().unwrap();
| +++
For more information about this error, try `rustc --explain E0282`.
error: could not compile `miniscript` due to previous error
having the specific type solves this error, if you want to address it in a different way let me know.
Super cool! Done reviewing c1282d30653a3cb4e188e59d5a3dd8de909aa9477. Lots of comments but they are all super minor things. |
a1f5467
to
85963fc
Compare
@apoelstra
Thanks for the first review, I'm ready for anything else you want to change. |
89cdeca looks great to me! CI is showing a clippy lint you can address. |
utack 08cea1c |
f7d3681
to
7574b82
Compare
bc9e7e3
to
61a2265
Compare
utack 6910eb4 |
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.
ACK 6910eb4; successfully ran local tests
cc @sanket1729 do you want to review this? I'll hold off on merging til tomorrow afternoon but I think this is good to go in. |
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.
ACK 6910eb4
Cargo.toml
Outdated
@@ -32,7 +34,8 @@ actual-serde = { package = "serde", version = "1.0.103", optional = true } | |||
[dev-dependencies] | |||
serde_test = "1.0.147" | |||
bitcoin = { version = "0.32.0", features = ["base64"] } | |||
secp256k1 = {version = "0.29.0", features = ["rand-std"]} | |||
secp256k1 = { version = "0.29.0", features = ["rand-std"] } | |||
bitcoin_hashes = "0.14.0" |
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.
Interesting, do we need explicit dependency for this? Do we not have a feature for this @apoelstra . Been some times since I looked at this.
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.
Oops. I had a partial review from last week. Looks like this was resolved.
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.
Did not a careful code review. The psbt APIs are used correctly and will serve as a good reference point for future users.
Maybe, we have a good first issue to simplify this example and create a simple psbt sign/update/finalize flow for a simpler policy :) .
We need to update |
Adding taptree_of_horror example.
Adding bitcoin_hashes as dev dependency.Made some formatting consistency corrections in Cargo.toml.