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
Merge #957: Introduce ValidationParams structure; use in Miniscript constructors
f7756f5 remove all sanity_check and ext_check methods from the library (Andrew Poelstra)
cb2fa85 miniscript: replace from_str_ext with from_str_with_validation_params (Andrew Poelstra)
93ca9fa miniscript: replace decode_ext with decode_with_validation_params (Andrew Poelstra)
e10b48f miniscript: add validate() method to Miniscript type (Andrew Poelstra)
163ba3e miniscript: add CONSENSUS and SANE consts to all contexts (Andrew Poelstra)
9320f36 miniscript: introduce ValidationParams type (Andrew Poelstra)
Pull request description:
This PR begins the process of overhauling the validation framework of this library. It introduces a `ValidationParams` struct which is a huge struct containing knobs for every single validation check that this library does. The goal is to centralize all these knobs, document them, apply them consistently, and make it possible for the user to choose any set of them.
Currently validation is spread across a variety of `sanity_check` methods, inconsistently applied in various constructors for `Miniscript` and `Descriptor`, and only configurable in some ad-hoc inconsistent ways via methods like `from_str_insane`. There is no place where these are all listed; the closest thing is the `Ctx` type parameter, which has a bunch of methods like `check_local_policy_validity` which have inscrutable names and are all implemented by calling each other in slightly-different ways.
In short, it's a mess.
As a side-effect of this PR, we introduce some new validation errors which let us eliminate two variants from the top-level `Error` mega-enum. We also delete the `ExtParams` struct, which was similar in spirit to `ValidationParams`, except that it was incomplete and all its names sucked.
This PR also introduces a soft-deprecation of the term "insane", which was used to mean "validate a bunch of rules, but not the ones that we decided are the boundary between a Miniscript that is 'sane' and not". We now use the term "consensus", i.e., "validate the consensus rules but no additional rules". Note that the new notion allows raw pkh fragments while the old one did not. I am open to reverting this change, but my feeling is that nobody will notice because nobody is pushing the boundaries of any of these validation rules. (If they were, they'd be filing a lot more bugs.)
ACKs for top commit:
Tree-SHA512: baced93e3a89aa0e6f3a0e02e4ed13ea5600d55fa345bbc60bf12eadd3aae8fe526115a4758198c6f5f54be5edf35aa8c2172411bba39d1be33ba76ced8fe376
Copy file name to clipboardExpand all lines: examples/psbt_sign_finalize.rs
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,6 @@ fn main() {
20
20
let s = "wsh(t:or_c(pk(027a3565454fe1b749bccaef22aff72843a9c3efefd7b16ac54537a0c23f0ec0de),v:thresh(1,pkh(032d672a1a91cc39d154d366cd231983661b0785c7f27bc338447565844f4a6813),a:pkh(03417129311ed34c242c012cd0a3e0b9bca0065f742d0dfb63c78083ea6a02d4d9),a:pkh(025a687659658baeabdfc415164528065be7bcaade19342241941e556557f01e28))))#7hut9ukn";
21
21
let bridge_descriptor = Descriptor::from_str(s).unwrap();
0 commit comments