rust-bitcoin / rust-bitcoin/rust-miniscript
Can trigger assertation failure in experimental compiler
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 426
- Forks
- 200
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 8
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducing unit test in src/policy/mod.rs and inspect the assertion at src/policy/concrete.rs:507. Run policy::tests::experimental_taproot_compile with the provided thresh policy, then trace compile_tr_private_experimental until the assertion is understood. Done means the test completes without an assertion failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100