rust-simplicity
rust-simplicity copied to clipboard
Infinite finalization loop
If I try to decode the bytes of the program case (drop iden) iden from the occurs check test, the binary gets stuck at the line that does the decoding.
let program_bytes = vec![0xc1, 0x07, 0x20, 0x30];
let mut bits = simplicity::BitIter::new(program_bytes.iter().copied());
let program = simplicity::CommitNode::<simplicity::jet::Core>::decode(&mut bits).expect("decode");
/// This is never printed
println!("{}", program.cmr());
Finalizing witness nodes also leads to the loop:
let program = Arc::<WitnessNode<Core>>::case(
&Arc::<WitnessNode<Core>>::drop_(&Arc::<WitnessNode<Core>>::iden()),
&Arc::<WitnessNode<Core>>::iden(),
)
.expect("const")
.finalize()
.expect("const");
The code runs fine without .finalize().
The infinite loop in your initial case is just the expect running on a program whose input type is not unit, but is infinite. It loops forever trying to print the non-unit type in the error.
As near as I can tell, the same issue happens with your other test case.
Unfortunately the infinite loop that I am encountering is different from these.