diff --git a/src/execute.rs b/src/execute.rs index f4e561b0b..b561273d1 100644 --- a/src/execute.rs +++ b/src/execute.rs @@ -198,18 +198,21 @@ pub async fn run(cli: Cli) -> Result<(), Box> { let (deployment_code, yul_code) = gen_evm_verifier(¶ms, &vk, num_instance)?; deployment_code.save(deployment_code_path.as_ref().unwrap())?; - let mut f = File::create(sol_code_path.as_ref().unwrap()).unwrap(); - let _ = f.write(yul_code.as_bytes()); + if sol_code_path.is_some() { - let cmd = Command::new("python3") - .arg("fix_verifier_sol.py") - .arg(sol_code_path.as_ref().unwrap()) - .output() - .unwrap(); - let output = cmd.stdout; + let mut f = File::create(sol_code_path.as_ref().unwrap()).unwrap(); + let _ = f.write(yul_code.as_bytes()); - let mut f = File::create(sol_code_path.as_ref().unwrap()).unwrap(); - let _ = f.write(output.as_slice()); + let cmd = Command::new("python3") + .arg("fix_verifier_sol.py") + .arg(sol_code_path.as_ref().unwrap()) + .output() + .unwrap(); + let output = cmd.stdout; + + let mut f = File::create(sol_code_path.as_ref().unwrap()).unwrap(); + let _ = f.write(output.as_slice()); + } } } } diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 1f100ee86..c487b3545 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -69,15 +69,6 @@ const TESTS_EVM: [&str; 9] = [ "2l_relu_small", ]; -/// Not all models will pass VerifyEVM because their contract size exceeds the limit, so we only -/// specify a few that will -const TESTS_SOLIDITY: [&str; 4] = [ - "1l_relu", - "1l_leakyrelu", - "1l_sigmoid", - "1l_reshape", -]; - const EXAMPLES: [&str; 2] = ["mlp_4d", "conv2d_mnist"]; macro_rules! test_func_aggr { @@ -142,25 +133,6 @@ macro_rules! test_func { }; } -macro_rules! test_func_solidity { - () => { - #[cfg(test)] - mod tests_solidity { - use seq_macro::seq; - use crate::TESTS_SOLIDITY; - use test_case::test_case; - use crate::kzg_evm_prove_and_verify; - use crate::kzg_evm_aggr_prove_and_verify; - seq!(N in 0..4 { - #(#[test_case(TESTS_SOLIDITY[N])])* - fn kzg_evm_prove_and_verify_(test: &str) { - kzg_evm_prove_and_verify(test.to_string(), true); - } - }); - } - }; -} - macro_rules! test_func_evm { () => { #[cfg(test)] @@ -170,18 +142,28 @@ macro_rules! test_func_evm { use test_case::test_case; use crate::kzg_evm_prove_and_verify; use crate::kzg_evm_aggr_prove_and_verify; + + /// Not all models will pass VerifyEVM because their contract size exceeds the limit, so we only + /// specify a few that will + const TESTS_SOLIDITY: [&str; 4] = [ + "1l_relu", + "1l_leakyrelu", + "1l_sigmoid", + "1l_reshape", + ]; + seq!(N in 0..=8 { - #(#[test_case(TESTS_EVM[N])])* - fn kzg_evm_prove_and_verify_(test: &str) { - kzg_evm_prove_and_verify(test.to_string(), false); - } - // these take a particularly long time to run - #(#[test_case(TESTS_EVM[N])])* - #[ignore] - fn kzg_evm_aggr_prove_and_verify_(test: &str) { - kzg_evm_aggr_prove_and_verify(test.to_string()); - } + #(#[test_case(TESTS_EVM[N])])* + fn kzg_evm_prove_and_verify_(test: &str) { + kzg_evm_prove_and_verify(test.to_string(), TESTS_SOLIDITY.contains(&test)); + } + // these take a particularly long time to run + #(#[test_case(TESTS_EVM[N])])* + #[ignore] + fn kzg_evm_aggr_prove_and_verify_(test: &str) { + kzg_evm_aggr_prove_and_verify(test.to_string()); + } }); } @@ -229,7 +211,6 @@ test_func_aggr!(); test_func_evm!(); test_func_examples!(); test_neg_examples!(); -test_func_solidity!(); // Mock prove (fast, but does not cover some potential issues) fn neg_mock(example_name: String, counter_example: String) {