Skip to content

Commit

Permalink
use acvm branch
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray authored and TomAFrench committed Aug 22, 2023
1 parent 3218e83 commit 8e2361a
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 217 deletions.
104 changes: 79 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ url = "2.2.0"
wasm-bindgen = { version = "=0.2.86", features = ["serde-serialize"] }
wasm-bindgen-test = "0.3.33"
base64 = "0.21.2"

[patch.crates-io]
acvm-backend-barretenberg = { git = "https://github.com/noir-lang/acvm-backend-barretenberg", branch = "kw/dyn-backends" }
7 changes: 4 additions & 3 deletions crates/nargo/src/ops/codegen_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use acvm::{acir::circuit::Circuit, SmartContract};

pub fn codegen_verifier<B: SmartContract>(
backend: &B,
common_reference_string: &[u8],
circuit: &Circuit,
verification_key: &[u8],
) -> Result<String, B::Error> {
backend.eth_contract_from_vk(common_reference_string, circuit, verification_key)
// Nargo no longer handles logic related to proving/verifying with keys or the CRS.
let common_reference_string = Vec::new();
let verification_key = Vec::new();
backend.eth_contract_from_vk(&common_reference_string, circuit, &verification_key)
}
6 changes: 3 additions & 3 deletions crates/nargo/src/ops/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use acvm::ProofSystemCompiler;

pub fn prove_execution<B: ProofSystemCompiler>(
backend: &B,
common_reference_string: &[u8],
circuit: &Circuit,
solved_witness: WitnessMap,
) -> Result<Vec<u8>, B::Error> {
// TODO(#1569): update from not just accepting `false` once we get nargo to interop with dynamic backend
// Nargo no longer handles logic related to proving/verifying with keys.
// Nargo no longer handles logic related to proving/verifying with keys or the CRS.
let common_reference_string = Vec::new();
let proving_key = Vec::new();
backend.prove_with_pk(common_reference_string, circuit, solved_witness, &proving_key, false)
backend.prove_with_pk(&common_reference_string, circuit, solved_witness, &proving_key, false)
}
6 changes: 3 additions & 3 deletions crates/nargo/src/ops/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ use acvm::ProofSystemCompiler;

pub fn verify_proof<B: ProofSystemCompiler>(
backend: &B,
common_reference_string: &[u8],
circuit: &Circuit,
proof: &[u8],
public_inputs: WitnessMap,
) -> Result<bool, B::Error> {
// TODO(#1569): update from not just accepting `false` once we get nargo to interop with dynamic backend
// Nargo no longer handles logic related to proving/verifying with keys.
// Nargo no longer handles logic related to proving/verifying with keys or the CRS.
let common_reference_string = Vec::new();
let verification_key = Vec::new();
backend.verify_with_vk(
common_reference_string,
&common_reference_string,
proof,
public_inputs,
circuit,
Expand Down
33 changes: 3 additions & 30 deletions crates/nargo_cli/src/cli/codegen_verifier_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ use std::path::PathBuf;
use super::NargoConfig;
use super::{
compile_cmd::compile_package,
fs::{
common_reference_string::{
read_cached_common_reference_string, update_common_reference_string,
write_cached_common_reference_string,
},
create_named_dir,
program::read_program_from_file,
write_to_file,
},
fs::{create_named_dir, program::read_program_from_file, write_to_file},
};
use crate::errors::CliError;
use acvm::Backend;
Expand Down Expand Up @@ -90,27 +82,8 @@ fn smart_contract_for_package<B: Backend>(
}
};

let common_reference_string = read_cached_common_reference_string();
let common_reference_string = update_common_reference_string(
backend,
&common_reference_string,
&preprocessed_program.bytecode,
)
.map_err(CliError::CommonReferenceStringError)?;

let (_, verification_key) = backend
.preprocess(&common_reference_string, &preprocessed_program.bytecode)
.map_err(CliError::ProofSystemCompilerError)?;

let smart_contract_string = codegen_verifier(
backend,
&common_reference_string,
&preprocessed_program.bytecode,
&verification_key,
)
.map_err(CliError::SmartContractError)?;

write_cached_common_reference_string(&common_reference_string);
let smart_contract_string = codegen_verifier(backend, &preprocessed_program.bytecode)
.map_err(CliError::SmartContractError)?;

Ok(smart_contract_string)
}
Loading

0 comments on commit 8e2361a

Please sign in to comment.