rust-simplicity icon indicating copy to clipboard operation
rust-simplicity copied to clipboard

Infinite finalization loop

Open uncomputable opened this issue 2 years ago • 1 comments

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());

uncomputable avatar Oct 31 '23 10:10 uncomputable

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().

uncomputable avatar Nov 02 '23 13:11 uncomputable

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.

apoelstra avatar Jun 25 '24 15:06 apoelstra

Unfortunately the infinite loop that I am encountering is different from these.

apoelstra avatar Jun 25 '24 15:06 apoelstra