Repository navigation
Bip392 - #192
Bip392#192Sosthene00 wants to merge 6 commits into
Conversation
| @@ -0,0 +1,16 @@ | |||
| [package] | |||
| name = "sp-descriptor" | |||
There was a problem hiding this comment.
Maybe rename the crate to bip392?
There was a problem hiding this comment.
or drop the "sp-", so that the name becomes spdk::descriptor, like miniscript::descriptor
There was a problem hiding this comment.
It depends if we want to release this as a separate crate, much like with silentpayments. I think the scope is pretty well contained so it's not a bad idea I think, though we may want to drop the spdk-core dependency to make it independent of spdk.
Another idea would be to make a PR to add bip392 to the miniscript crate, though maybe since the BIP is still in draft it's too early for that.
There was a problem hiding this comment.
Adding bip392 to miniscript will probably be a bit complicated, bip392 descriptors can't be 100% compliant with "normal" descriptors because they are not enough by themselved to derive a full scriptpubkey. I've changed a lot that branch yesterday I'll see if I can also get rid of the spdk-core dependency and I think what makes more sense is to release it as a standalone for now
There was a problem hiding this comment.
Adding bip392 to miniscript will probably be a bit complicated
I agree a standalone crate for bip392 should be better, I've thought about it recently, and I think one option could be to make the crate not depending directly on miniscript/bitcoin crates but rather the crate being generic over a Bitcoin trait
this make it easy to deal w/ different versions, you can supply default implem behing feature flags and the consumer is free to use different bitcoin primitives
There was a problem hiding this comment.
I already got rid of the bitcoin dependency, now it only depends on miniscript, silentpayments and libsecp.
I see what you propose here but just not sure how to actually implement it.
There was a problem hiding this comment.
here a clauded draft for the idea: https://github.com/pythcoiner/spdk/tree/bip392-backend
There was a problem hiding this comment.
I've looked into it, I'm discussing with my own clanker how to implement that in a way that is clean enough.
There was a problem hiding this comment.
I tried different approaches but couldn't find one compelling enough, especially considering I'm not sure about a lot of things in spdk nor your actual needs. I'd rather merge it as it is now, you try to adapt it for what you're doing and then we see if we need a follow up here.
| match self { | ||
| SpKeyError::Bech32(e) => write!(f, "bech32 error: {}", e), | ||
| SpKeyError::InvalidHrp(hrp) => write!(f, "invalid HRP: {}", hrp), | ||
| SpKeyError::InvalidVersion(v) => { |
There was a problem hiding this comment.
I guess you haven't run the lints yet, but should be Self here.
There was a problem hiding this comment.
Yes I rewrote extensively this PR, will push later today
1828ea7 to
0aa68c7
Compare
c96c71d to
d919b38
Compare
Secret keys should not round-trip through serde on this type, and callers already read the secret through SpClient::try_secret_spend_key.
Key-material failures are distinct KeyError variants, wrapped as scan or spend, instead of miniscript Unexpected strings.
Add a new
sp-descriptorcrate with what's needed to parse and produce drescriptors according to BIP392