zBlock-2 / summa-solvency-Turing

Apache License 2.0
0 stars 0 forks source link

Issues with Size of circuit #13

Open sachindkagrawal15 opened 8 months ago

sachindkagrawal15 commented 8 months ago

Issues with Size of circuit

I tried to experiment with size of circuit both sides (large and small) and below are the observations:

I tried some large size of circuit (K=25) and could observe signal: 15, SIGTERM: termination signal due to OOM issue.

Details below : test circuits::tests::test::test_invalid_root_hash_as_instance_with_full_prover ... FAILED test chips::range::tests::testing::test_none_overflow_16bits ... ok test chips::range::tests::testing::test_none_overflow_64bits ... ok test circuits::tests::test::test_valid_merkle_sum_tree_with_full_prover ... FAILED test chips::range::tests::testing::test_overflow_16bits ... ok test chips::range::tests::testing::test_overflow_32bits ... ok test merkle_sum_tree::tests::test::test_big_uint_conversion ... ok test merkle_sum_tree::tests::test::get_leaf_node_hash_preimage ... ok test merkle_sum_tree::tests::test::get_middle_node_hash_preimage ... ok test merkle_sum_tree::tests::test::test_sorted_mst ... ok test merkle_sum_tree::tests::test::test_tree_with_zero_element_1 ... ok test merle_sum_tree::tests::test::test_mst ... ok test merkle_sum_tree::tests::test::test_update_invalid_mst_leaf ... ok test merkle_sum_tree::tests::test::test_update_mst_leaf ... ok test merkle_sum_tree::tests::test::test_tree_with_zero_element_2 ... ok test circuits::tests::test::test_balance_not_in_range has been running for over 60 seconds test circuits::tests::test::test_invalid_entry_balance_as_witness has been running for over 60 seconds test circuits::tests::test::test_invalid_leaf_hash_as_instance has been running for over 60 seconds test circuits::tests::test::test_invalid_root_hash has been running for over 60 seconds test circuits::tests::test::test_non_binary_index has been running for over 60 seconds test circuits::tests::test::test_swapping_index has been running for over 60 seconds test circuits::tests::test::test_valid_merkle_sum_tree has been running for over 60 seconds error: test failed, to rerun pass --lib

Caused by: process didn't exit successfully: /Users/sachindagrawal/Documents/summa.protocol/summa-solvency/zk_prover/target/debug/deps/summa_solvency-0e0235d3725b2941 (signal: 15, SIGTERM: termination signal)

I tried some small sizes of circuit (K<=10) and kept on getting below error : NotEnoughRowsAvailable ---- circuits::tests::test::test_valid_merkle_sum_tree_with_full_prover stdout ---- ··Start: None Creating params ··End: None Creating params ....................................................688.812ms thread 'circuits::tests::test::test_valid_merkle_sum_tree_with_full_prover' panicked at 'vk generation should not fail: NotEnoughRowsAvailable { current_k: 9 }', src/circuits/utils.rs:75:43

---- circuits::tests::test::test_invalid_root_hash_as_instance_with_full_prover stdout ---- Start: None Creating params End: None Creating params ......................................................1.448s thread 'circuits::tests::test::test_invalid_root_hash_as_instance_with_full_prover' panicked at 'vk generation should not fail: NotEnoughRowsAvailable { current_k: 9 }', src/circuits/utils.rs:75:43

This issue can be used to plan if the limited range of size of circuit would suffice the prod readiness of application or are there some improvements needed to increase the range, etc

teddav commented 8 months ago

This is not an issue with Summa, this is related to Halo2. You have to choose K according to the number of constraints in your circuit. 25 seems to big because that would mean you have 2**25 constraints, and 10 is probably too small for the MST.

sachindkagrawal15 commented 8 months ago

As we discussed in our meeting, the idea was to stress test the summa circuit and This issue can be used to plan from design point of view , if the limited range of size of circuit would suffice the prod readiness of application or are there some improvements needed to increase the range, etc. This can be a question itself to summa team to find out more details and specifications.

Thanks and Regards, Sachin