Skip to content

Commit

Permalink
fix: remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Jul 6, 2023
1 parent fd7351d commit ec236e8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 72 deletions.
48 changes: 24 additions & 24 deletions crates/nargo_cli/tests/codegen-verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
35 changes: 7 additions & 28 deletions crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit ec236e8

Please sign in to comment.