zama-ai/verifiable-fhe-paper

test_ivc_blind_rot failed?

Closed this issue · 5 comments

3for commented

Hi, I set N=8 in ntt/mod.rs, all other test cases pass, except test_ivc_blind_rot. Is there anything wrong with my setting?

s_lwe: [1]
testv: Poly { coeffs: [0, 1, 2, 3, 4, 5, 6, 7] }
message: 1152921504338411520 * 6 = 6917529026030469120
[4790745810630805798, 11708274836661274918]
thread 'vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot' panicked at src/vtfhe/crypto/poly.rs:167:34:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot ... FAILED

failures:

failures:
    vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot

the release version cargo test --release vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot -- --nocapture could work ok.

3for commented

Hi, thanks @zilong-dai . Run cargo test --release vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot -- --nocapture with https://github.com/zama-ai/verifiable-fhe-paper is okay now. I'm not sure why debug mode is not ok?
And while run https://github.com/zilong-dai/verifiable-fhe-paper/tree/fix-suboverflow with either Debug or Release mode, both are failed with:

running 1 test
s_lwe: [1]

thread 'vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot' has overflowed its stack
fatal runtime error: stack overflow
error: test failed, to rerun pass `--bin vfhe_plonky2`

Hi, thanks @zilong-dai . Run cargo test --release vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot -- --nocapture with https://github.com/zama-ai/verifiable-fhe-paper is okay now. I'm not sure why debug mode is not ok? And while run https://github.com/zilong-dai/verifiable-fhe-paper/tree/fix-suboverflow with either Debug or Release mode, both are failed with:

running 1 test
s_lwe: [1]

thread 'vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot' has overflowed its stack
fatal runtime error: stack overflow
error: test failed, to rerun pass `--bin vfhe_plonky2`

The first may the rust complier omits runtime checks for performance reasons.
Ref: https://stackoverflow.com/questions/70776125/why-does-rust-perform-integer-overflow-checks-in-release

The second is that rust default stack size is about 2MB and the test use params_1024.rs may need 810241024B=8388608B. So you can run RUST_MIN_STACK=8388608 cargo test --release vtfhe::ivc_based_vpbs::tests::test_ivc_blind_rot -- --nocapture. If failed with the same error, double the RUST_MIN_STACK.
Ref: https://users.rust-lang.org/t/what-can-i-do-to-avoid-thread-main-has-overflowed-its-stack-when-working-with-large-arrays/77091

3for commented

Thanks a lot @zilong-dai