Skip to content

Can trigger assertation failure in experimental compiler #656

@apoelstra

Description

@apoelstra

The following unit test

commit c4a38f269369f87e7a9c210eba15a9f54e171965
Author: Andrew Poelstra <apoelstra@wpsoftware.net>
Date:   Tue Mar 12 14:54:09 2024 +0000

    compiler: add unit test that triggers assertation in compile_private_experimental

diff --git a/src/policy/mod.rs b/src/policy/mod.rs
index 7faccbc1..d9e119f4 100644
--- a/src/policy/mod.rs
+++ b/src/policy/mod.rs
@@ -520,6 +520,18 @@ mod tests {
             assert_eq!(desc, expected_desc);
         }
 
+        {
+            let pol = Concrete::<String>::from_str(
+                "thresh(3,pk(A),pk(B),pk(C),pk(D),pk(E),pk(F),pk(G),pk(H))",
+            )
+            .unwrap();
+            pol.compile::<Tap>().unwrap();
+            pol.compile_tr_private_experimental(Some(unspendable_key.clone()))
+                .unwrap();
+            // Don't bother checking the output, which is huge; just confirm that it
+            // does not trigger an assertation failure within the compiler.
+        }
+
         {
             let pol =
                 Concrete::<String>::from_str("thresh(3,pk(A),pk(B),pk(C),pk(D),pk(E))").unwrap();

Causes an assertation failure, as

---- policy::tests::experimental_taproot_compile stdout ----
thread 'policy::tests::experimental_taproot_compile' panicked at src/policy/concrete.rs:507:25:
assertion failed: tapleaf_prob_vec.remove(&(Reverse(*prev_prob), policy.clone()))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions