From ec236e8b88b9f22cdb810ca33bcd8db71e93af62 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:14:42 +0000 Subject: [PATCH] fix: remove commented code --- crates/nargo_cli/tests/codegen-verifier.rs | 48 +++++++++---------- .../src/ssa/acir_gen/operations/intrinsics.rs | 35 +++----------- .../acir_gen/acir_ir/generated_acir.rs | 26 +++------- 3 files changed, 37 insertions(+), 72 deletions(-) diff --git a/crates/nargo_cli/tests/codegen-verifier.rs b/crates/nargo_cli/tests/codegen-verifier.rs index 4b4d995af3..3e4dc1dc74 100644 --- a/crates/nargo_cli/tests/codegen-verifier.rs +++ b/crates/nargo_cli/tests/codegen-verifier.rs @@ -7,27 +7,27 @@ use std::process::Command; use assert_fs::prelude::{PathAssert, PathChild}; -// #[test] -// fn simple_verifier_codegen() { -// let test_dir = assert_fs::TempDir::new().unwrap(); -// std::env::set_current_dir(&test_dir).unwrap(); - -// // Create trivial program -// let project_name = "hello_world"; -// let project_dir = test_dir.child(project_name); - -// let mut cmd = Command::cargo_bin("nargo").unwrap(); -// cmd.arg("new").arg(project_name); -// cmd.assert().success(); - -// std::env::set_current_dir(&project_dir).unwrap(); - -// // Run `nargo codegen-verifier` -// let mut cmd = Command::cargo_bin("nargo").unwrap(); -// cmd.arg("codegen-verifier"); -// cmd.assert() -// .success() -// .stdout(predicate::str::contains("Contract successfully created and located at")); - -// project_dir.child("contract").child("plonk_vk.sol").assert(predicate::path::is_file()); -// } +#[test] +fn simple_verifier_codegen() { + let test_dir = assert_fs::TempDir::new().unwrap(); + std::env::set_current_dir(&test_dir).unwrap(); + + // Create trivial program + let project_name = "hello_world"; + let project_dir = test_dir.child(project_name); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("new").arg(project_name); + cmd.assert().success(); + + std::env::set_current_dir(&project_dir).unwrap(); + + // Run `nargo codegen-verifier` + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("codegen-verifier"); + cmd.assert() + .success() + .stdout(predicate::str::contains("Contract successfully created and located at")); + + project_dir.child("contract").child("plonk_vk.sol").assert(predicate::path::is_file()); +} diff --git a/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs b/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs index 9d12e6f09c..1e003f105b 100644 --- a/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs +++ b/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs @@ -153,34 +153,13 @@ pub(crate) fn evaluate( hashed_message: resolve_array(&args[3], acir_gen, ctx, evaluator), output: outputs[0], }, - BlackBoxFunc::EcdsaSecp256r1 => { - println!("\n\n"); - - println!("\n\n"); - println!("\n\n"); - - println!("\n\n"); - println!("pubkey x: {:?}", args[0]); - println!("pubkey y: {:?}", args[1]); - println!("sig: {:?} ", args[2]); - println!("hashed message: {:?}", args[3]); - - println!("pubkey x: {:?}", ctx.try_get_node(args[0])); - println!("pubkey y: {:?}", ctx.try_get_node(args[1])); - println!("sig: {:?} ", ctx.try_get_node(args[2])); - println!("hashed message: {:?}", ctx.try_get_node(args[3])); - - let x = BlackBoxFuncCall::EcdsaSecp256r1 { - public_key_x: resolve_array(&args[0], acir_gen, ctx, evaluator), - public_key_y: resolve_array(&args[1], acir_gen, ctx, evaluator), - signature: resolve_array(&args[2], acir_gen, ctx, evaluator), - hashed_message: resolve_array(&args[3], acir_gen, ctx, evaluator), - output: outputs[0], - }; - println!("{:#?}", x); - println!("\n\n"); - x - } + BlackBoxFunc::EcdsaSecp256r1 => BlackBoxFuncCall::EcdsaSecp256r1 { + public_key_x: resolve_array(&args[0], acir_gen, ctx, evaluator), + public_key_y: resolve_array(&args[1], acir_gen, ctx, evaluator), + signature: resolve_array(&args[2], acir_gen, ctx, evaluator), + hashed_message: resolve_array(&args[3], acir_gen, ctx, evaluator), + output: outputs[0], + }, BlackBoxFunc::HashToField128Security => BlackBoxFuncCall::HashToField128Security { inputs: resolve_array(&args[0], acir_gen, ctx, evaluator), output: outputs[0], diff --git a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs b/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs index 88c6770af0..f5f953ea97 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs @@ -244,26 +244,12 @@ impl GeneratedAcir { hashed_message: inputs[128..].to_vec(), output: outputs[0], }, - BlackBoxFunc::EcdsaSecp256r1 => { - println!("r1 inputs"); - println!("{:?}", inputs); - - println!("pub x, {:?}", inputs[0..32].to_vec()); - println!("pub y, {:?}", inputs[32..64].to_vec()); - BlackBoxFuncCall::EcdsaSecp256r1 { - // 32 bytes for each public key co-ordinate - public_key_x: inputs[0..32].to_vec(), - public_key_y: inputs[32..64].to_vec(), - // (r,s) are both 32 bytes each, so signature - // takes up 64 bytes - signature: inputs[64..128].to_vec(), - hashed_message: inputs[128..].to_vec(), - output: outputs[0], - } - } - BlackBoxFunc::FixedBaseScalarMul => BlackBoxFuncCall::FixedBaseScalarMul { - input: inputs[0], - outputs: (outputs[0], outputs[1]), + BlackBoxFunc::EcdsaSecp256r1 => BlackBoxFuncCall::EcdsaSecp256r1 { + public_key_x: inputs[0..32].to_vec(), + public_key_y: inputs[32..64].to_vec(), + signature: inputs[64..128].to_vec(), + hashed_message: inputs[128..].to_vec(), + output: outputs[0], }, BlackBoxFunc::FixedBaseScalarMul => { BlackBoxFuncCall::FixedBaseScalarMul { input: inputs[0], outputs }