diff --git a/zokrates_cli/src/ops/print_proof.rs b/zokrates_cli/src/ops/print_proof.rs index cc7e5c99..a1f65e05 100644 --- a/zokrates_cli/src/ops/print_proof.rs +++ b/zokrates_cli/src/ops/print_proof.rs @@ -49,14 +49,14 @@ pub fn exec(sub_matches: &ArgMatches) -> Result<(), String> { // extract curve and scheme parameters from both let curve = proof .get("curve") - .ok_or("Field `curve` not found in proof".to_string())? + .ok_or_else(|| "Field `curve` not found in proof".to_string())? .as_str() - .ok_or("`curve` should be a string".to_string())?; + .ok_or_else(|| "`curve` should be a string".to_string())?; let scheme = proof .get("scheme") - .ok_or("Field `scheme` not found in proof".to_string())? + .ok_or_else(|| "Field `scheme` not found in proof".to_string())? .as_str() - .ok_or("`scheme` should be a string".to_string())?; + .ok_or_else(|| "`scheme` should be a string".to_string())?; let parameters: (CurveParameter, SchemeParameter) = (curve.try_into().unwrap(), scheme.try_into().unwrap()); diff --git a/zokrates_cli/src/ops/verify.rs b/zokrates_cli/src/ops/verify.rs index a980c3ed..44909317 100644 --- a/zokrates_cli/src/ops/verify.rs +++ b/zokrates_cli/src/ops/verify.rs @@ -73,24 +73,24 @@ pub fn exec(sub_matches: &ArgMatches) -> Result<(), String> { // extract curve and scheme parameters from both let proof_curve = proof .get("curve") - .ok_or("Field `curve` not found in proof".to_string())? + .ok_or_else(|| "Field `curve` not found in proof".to_string())? .as_str() - .ok_or("`curve` should be a string".to_string())?; + .ok_or_else(|| "`curve` should be a string".to_string())?; let proof_scheme = proof .get("scheme") - .ok_or("Field `scheme` not found in proof".to_string())? + .ok_or_else(|| "Field `scheme` not found in proof".to_string())? .as_str() - .ok_or("`scheme` should be a string".to_string())?; + .ok_or_else(|| "`scheme` should be a string".to_string())?; let vk_curve = vk .get("curve") - .ok_or("Field `curve` not found in verification key".to_string())? + .ok_or_else(|| "Field `curve` not found in verification key".to_string())? .as_str() - .ok_or("`curve` should be a string".to_string())?; + .ok_or_else(|| "`curve` should be a string".to_string())?; let vk_scheme = vk .get("scheme") - .ok_or("Field `scheme` not found in verification key".to_string())? + .ok_or_else(|| "Field `scheme` not found in verification key".to_string())? .as_str() - .ok_or("`scheme` should be a string".to_string())?; + .ok_or_else(|| "`scheme` should be a string".to_string())?; if proof_curve != vk_curve { return Err(format!( diff --git a/zokrates_cli/tests/integration.rs b/zokrates_cli/tests/integration.rs index 47d65abb..321f88b1 100644 --- a/zokrates_cli/tests/integration.rs +++ b/zokrates_cli/tests/integration.rs @@ -298,8 +298,6 @@ mod integration { "verify", "--backend", backend, - "--proving-scheme", - scheme, "-j", proof_path.to_str().unwrap(), "-v", @@ -387,14 +385,14 @@ mod integration { // Compile lib let g2_lib = - Contract::compile_from_src_string(&SOLIDITY_G2_ADDITION_LIB, "BN256G2", true, &[]) + Contract::compile_from_src_string(SOLIDITY_G2_ADDITION_LIB, "BN256G2", true, &[]) .unwrap(); // Deploy lib let create_result = evm .deploy(g2_lib.encode_create_contract_bytes(&[]).unwrap(), &deployer) .unwrap(); - let lib_addr = create_result.addr.clone(); + let lib_addr = create_result.addr; // Compile contract let contract = Contract::compile_from_src_string( @@ -412,7 +410,7 @@ mod integration { &deployer, ) .unwrap(); - let contract_addr = create_result.addr.clone(); + let contract_addr = create_result.addr; // convert to the solidity proof format let solidity_proof = S::Proof::from(proof.proof); @@ -448,11 +446,11 @@ mod integration { assert_eq!(&result.out, &to_be_bytes(&U256::from(1))); // modify the proof - let modified_solidity_proof = S::modify(solidity_proof.clone()); + let modified_solidity_proof = S::modify(solidity_proof); - let modified_proof_token = S::to_token(modified_solidity_proof.clone()); + let modified_proof_token = S::to_token(modified_solidity_proof); - let inputs = [modified_proof_token, input_token.clone()]; + let inputs = [modified_proof_token, input_token]; // Call verify function on contract let result = evm diff --git a/zokrates_core/src/proof_system/ark/groth16.rs b/zokrates_core/src/proof_system/ark/groth16.rs index b3b1ae74..f687b448 100644 --- a/zokrates_core/src/proof_system/ark/groth16.rs +++ b/zokrates_core/src/proof_system/ark/groth16.rs @@ -236,11 +236,8 @@ mod tests { .execute(program.clone(), &[Bls12_377Field::from(42)]) .unwrap(); - let proof = >::generate_proof( - program.into(), - witness, - keypair.pk, - ); + let proof = + >::generate_proof(program, witness, keypair.pk); let ans = >::verify(keypair.vk, proof); assert!(ans); diff --git a/zokrates_core/src/static_analysis/propagation.rs b/zokrates_core/src/static_analysis/propagation.rs index 6922d8c0..3b759799 100644 --- a/zokrates_core/src/static_analysis/propagation.rs +++ b/zokrates_core/src/static_analysis/propagation.rs @@ -1711,8 +1711,7 @@ mod tests { ) .annotate(Type::FieldElement, 1u32) .into(), - ) - .into()] + )] .into(), ) .annotate(Type::FieldElement, 1u32), @@ -1736,8 +1735,7 @@ mod tests { ) .annotate(Type::FieldElement, 1u32) .into(), - ) - .into()] + )] .into(), ) .annotate(Type::FieldElement, 1u32),