Open darosior opened 2 years ago
Looks like it was introduced in https://github.com/rust-bitcoin/rust-miniscript/pull/49.
As a part of the miniscript review for c++, I have been doing a line-by-line comparison with rust-miniscript. I still have opcode and stack size limits to double. Hopefully, will report back today/tomorrow
Note that the logic of calculating stack size is slightly different in both implementations, but they should result in the same output.
There are unit tests to exerce the calculation of the maximum number of elements of a satisfaction: https://github.com/rust-bitcoin/rust-miniscript/blob/a2d6fff55a6b4a81a92fe740ee4dea86746875cc/src/miniscript/mod.rs#L586-L631
However they are not executed... https://github.com/rust-bitcoin/rust-miniscript/blob/a2d6fff55a6b4a81a92fe740ee4dea86746875cc/src/miniscript/mod.rs#L570
Actually executing them makes the test fail. It looks like most vectors were taken from the C++ implem and therefore the Rust implem of the calculation is not on par with the C++ one.
A quick look at the first vector failing with the above patch suggests that this is the calculation that needs to be fixed: the vector looks right. https://github.com/rust-bitcoin/rust-miniscript/blob/a2d6fff55a6b4a81a92fe740ee4dea86746875cc/src/miniscript/mod.rs#L610