Skip to content

Commit

Permalink
chore: update to acvm-backend-barretenberg 0.7.0 (#1897)
Browse files Browse the repository at this point in the history
* feat: update to `acvm-backend-barretenberg` 0.7.0

* chore: update cspell
  • Loading branch information
TomAFrench authored Jul 10, 2023
1 parent 7a85493 commit 2851827
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 26 deletions.
38 changes: 26 additions & 12 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ edition = "2021"
rust-version = "1.66"

[workspace.dependencies]
acvm = "0.16.0"
acvm = "0.17.0"
arena = { path = "crates/arena" }
fm = { path = "crates/fm" }
iter-extended = { path = "crates/iter-extended" }
Expand Down Expand Up @@ -58,4 +58,3 @@ wasm-bindgen-test = "0.3.33"

[patch.crates-io]
async-lsp = { git = "https://github.com/oxalica/async-lsp", rev = "09dbcc11046f7a188a80137f8d36484d86c78c78" }
acvm-backend-barretenberg = { git = "https://github.com/noir-lang/acvm-backend-barretenberg.git", rev = "0842911beed6c54b7efcd721372fb73431c95bbf" }
2 changes: 1 addition & 1 deletion crates/nargo_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ color-eyre = "0.6.2"
tokio = { version = "1.0", features = ["io-std"] }

# Backends
acvm-backend-barretenberg = { version = "0.6.0", default-features = false }
acvm-backend-barretenberg = { version = "0.7.0", default-features = false }

[dev-dependencies]
tempdir = "0.3.7"
Expand Down
6 changes: 5 additions & 1 deletion crates/nargo_cli/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ fn check_from_path<B: Backend>(
compile_options: &CompileOptions,
) -> Result<(), CliError<B>> {
let mut context = resolve_root_manifest(program_dir)?;
check_crate_and_report_errors(&mut context, compile_options.deny_warnings, compile_options.experimental_ssa)?;
check_crate_and_report_errors(
&mut context,
compile_options.deny_warnings,
compile_options.experimental_ssa,
)?;

// XXX: We can have a --overwrite flag to determine if you want to overwrite the Prover/Verifier.toml files
if let Some((parameters, return_type)) = compute_function_signature(&context) {
Expand Down
6 changes: 5 additions & 1 deletion crates/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ fn run_tests<B: Backend>(
compile_options: &CompileOptions,
) -> Result<(), CliError<B>> {
let mut context = resolve_root_manifest(program_dir)?;
check_crate_and_report_errors(&mut context, compile_options.deny_warnings, compile_options.experimental_ssa)?;
check_crate_and_report_errors(
&mut context,
compile_options.deny_warnings,
compile_options.experimental_ssa,
)?;

let test_functions = context.get_all_test_functions_in_crate_matching(&LOCAL_CRATE, test_name);
println!("Running {} test functions...", test_functions.len());
Expand Down
16 changes: 16 additions & 0 deletions crates/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,22 @@ pub(crate) fn black_box_op_instruction(op: BlackBoxOp) {
result
);
}
BlackBoxOp::EcdsaSecp256r1 {
hashed_msg,
public_key_x,
public_key_y,
signature,
result,
} => {
debug_println!(
" ECDSA_SECP256R1 {} {} {} {} -> {}",
hashed_msg,
public_key_x,
public_key_y,
signature,
result
);
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions crates/noirc_evaluator/src/ssa/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ impl Opcode {
| BlackBoxFunc::FixedBaseScalarMul
| BlackBoxFunc::RecursiveAggregation => BigUint::zero(),
// Verify returns zero or one
BlackBoxFunc::SchnorrVerify | BlackBoxFunc::EcdsaSecp256k1 => BigUint::one(),
BlackBoxFunc::SchnorrVerify
| BlackBoxFunc::EcdsaSecp256k1
| BlackBoxFunc::EcdsaSecp256r1 => BigUint::one(),
BlackBoxFunc::HashToField128Security => ObjectType::native_field().max_size(),
BlackBoxFunc::RANGE | BlackBoxFunc::AND | BlackBoxFunc::XOR => {
unimplemented!("ICE: these opcodes do not have Noir builtin functions")
Expand All @@ -103,9 +105,9 @@ impl Opcode {
}
BlackBoxFunc::HashToField128Security => (1, ObjectType::native_field()),
// See issue #775 on changing this to return a boolean
BlackBoxFunc::SchnorrVerify | BlackBoxFunc::EcdsaSecp256k1 => {
(1, ObjectType::native_field())
}
BlackBoxFunc::SchnorrVerify
| BlackBoxFunc::EcdsaSecp256k1
| BlackBoxFunc::EcdsaSecp256r1 => (1, ObjectType::native_field()),
BlackBoxFunc::Pedersen => (2, ObjectType::native_field()),
BlackBoxFunc::FixedBaseScalarMul => (2, ObjectType::native_field()),
BlackBoxFunc::RecursiveAggregation => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ impl GeneratedAcir {
hashed_message: inputs[128..].to_vec(),
output: outputs[0],
},
BlackBoxFunc::EcdsaSecp256r1 => 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]),
Expand Down Expand Up @@ -806,7 +816,9 @@ fn black_box_func_expected_input_size(name: BlackBoxFunc) -> Option<usize> {

// Signature verification algorithms will take in a variable
// number of inputs, since the message/hashed-message can vary in size.
BlackBoxFunc::SchnorrVerify | BlackBoxFunc::EcdsaSecp256k1 => None,
BlackBoxFunc::SchnorrVerify
| BlackBoxFunc::EcdsaSecp256k1
| BlackBoxFunc::EcdsaSecp256r1 => None,
// Inputs for fixed based scalar multiplication
// is just a scalar
BlackBoxFunc::FixedBaseScalarMul => Some(1),
Expand Down Expand Up @@ -836,7 +848,9 @@ fn black_box_expected_output_size(name: BlackBoxFunc) -> u32 {
// witness at a time.
BlackBoxFunc::RANGE => 0,
// Signature verification algorithms will return a boolean
BlackBoxFunc::SchnorrVerify | BlackBoxFunc::EcdsaSecp256k1 => 1,
BlackBoxFunc::SchnorrVerify
| BlackBoxFunc::EcdsaSecp256k1
| BlackBoxFunc::EcdsaSecp256r1 => 1,
// Output of fixed based scalar mul over the embedded curve
// will be 2 field elements representing the point.
BlackBoxFunc::FixedBaseScalarMul => 2,
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"rustc",
"rustup",
"secp256k1",
"secp256r1",
"smol",
"tempdir",
"tempfile",
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

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

0 comments on commit 2851827

Please sign in to comment.