You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
e971e77d64527d8f70bad690500ea12a51cfdf08 types: remove error path from sub-fragment parameter to threshold() (Andrew Poelstra)
d4dc2267e40f2a2253fa0bf4ef2b67b223533d3a types: make a ton of constructors const (Andrew Poelstra)
fdea7f642e77be14cbaaf8c275f4e8bca316460f types: drop `Property` trait entirely (Andrew Poelstra)
b25023db3a54b4034339bdbea315263ba867326d compiler: remove a bunch of unused error paths (Andrew Poelstra)
eb854aacc5eeab55477b8fa9e7f659ea176c6a81 compiler: stop using Property trait in CompilerExtData (Andrew Poelstra)
602fd29ba4d7e701a97888a0f41e7fffe7e54d01 types: remove all Result returns for ExtData (Andrew Poelstra)
b6c3ca859b56a9cbe0ccdee1d42d5cb2bbdd3b92 types: don't implement Property for ExtData. (Andrew Poelstra)
87294ff7d350c4e9d64956a4d85b93b78d4e2ebb types: don't implement Property for Malleability (Andrew Poelstra)
dd0978d547e45e0c61702c8c91de97df6f79494a types: don't implement Property for Correctness (Andrew Poelstra)
962038034c607c3690acc450f5dcdea39bcca94e clippy: fix a couple nits (Andrew Poelstra)
3c1c896ace7134015ede5ab8ba580c38e6dc14f6 blanket_traits: remove crate:: in a bunch of places (Andrew Poelstra)
9280609aa3500f43798f34b4f3995f335e67c21e blanket_traits: add some more bounds (Andrew Poelstra)
Pull request description:
Something of a followup to #649, which specifically removes the `type_check` method from `Property`.
Basically, this whole trait is confused. Originally it was supposed to express "a recursively defined property of a Miniscript" which could be defined by a couple constructors and then automatically computed for any Miniscript. In fact, the trait required a separate constructor for every single Miniscript fragment so nothing was "automatic" except sometimes reusing code between the different hash fragments and between `older`/`after`.
Furthermore, every implementor of this trait had slightly different requirements, meaning that there were `unreachable!()`s throughout the code, functions that were never called (e.g. `Type::from_sha256` passing through to `Correctness::from_sha256` and `Malleability::from_sha256` when all three of those types implemented the function by calling `from_hash`, which *also* was defined by `Type::from_hash` calling `Correctness::from_hash` and `Malleability::from_hash`. So much boilerplate) and many instances of methods being implemented but ignoring arguments, or (worse) being generic over `Pk`/`Ctx` and ignoring those types entirely, or returning `Result` but always returing the `Ok` variant.
So basically, there was no value in being generic over the trait and the trait wasn't even a generalization of any of the types that implemented it.
**Adding to this** having the trait prevents us from having constfns in our type checking code, which sucks because we have a lot of common fixed fragments. It also prevents us from returning different error types from different parts of the typechecker, which is my specific goal in removing the trait.
This PR has a lot of commits but most of them are mechanical and/or small.
ACKs for top commit:
sanket1729:
ACK e971e77d64527d8f70bad690500ea12a51cfdf08. Looks a lot cleaner. Thanks for these changes. It's nice that we no longer have the artificial error paths because the parent trait had the definition to encompass all possible implementations.
Tree-SHA512: 38c254caf938e5c3f84c1f0007e0bfc93180e678aef3968cb8f16ad1544722a0f7cfda2c014056446f0091b198edb12c91c0424df64f68c31f5d316fac28425c
0 commit comments