Skip to content

Commit ff0509f

Browse files
committed
policy: stop using duplicate keys in unit tests
We will want to start rejecting duplicate keys in policy. Currently they are rejected in the compiler and when parsing (sane) Miniscripts and when calling `is_valid` on concrete policies, but NOT when lifting insane Miniscripts or when parsing concrete or semantic policies. Meanwhile, mixing timelocks is checked in all the above places EXCEPT when parsing concrete or semantic policies. And of course, neither is checked when directly constructing Miniscripts or policies. It's all very inconsistent. My eventual goal is to use the same set of "sane" checks everywhere. To do this, I will need to embed a set of checks into Miniscript objects, and then later do the same with Policy objects (which will need to stop being "bare recursive structs" and start having more structure, same as Miniscript).
1 parent 1b49a39 commit ff0509f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/policy/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ mod tests {
278278
#[test]
279279
fn policy_rtt_tests() {
280280
concrete_policy_rtt("pk()");
281-
concrete_policy_rtt("or(1@pk(),1@pk())");
282-
concrete_policy_rtt("or(99@pk(),1@pk())");
283-
concrete_policy_rtt("and(pk(),or(99@pk(),1@older(12960)))");
281+
concrete_policy_rtt("or(1@pk(X),1@pk(Y))");
282+
concrete_policy_rtt("or(99@pk(X),1@pk(Y))");
283+
concrete_policy_rtt("and(pk(X),or(99@pk(Y),1@older(12960)))");
284284

285285
semantic_policy_rtt("pk()");
286-
semantic_policy_rtt("or(pk(),pk())");
287-
semantic_policy_rtt("and(pk(),pk())");
286+
semantic_policy_rtt("or(pk(X),pk(Y))");
287+
semantic_policy_rtt("and(pk(X),pk(Y))");
288288

289289
//fuzzer crashes
290290
assert!(ConcretePol::from_str("thresh()").is_err());

0 commit comments

Comments
 (0)