Skip to content

Commit

Permalink
Merge branch 'master' into acvm-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Jul 25, 2023
2 parents 32d31a6 + 0444b52 commit 9c16c43
Show file tree
Hide file tree
Showing 287 changed files with 894 additions and 141 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ result
**/target
!crates/nargo_cli/tests/test_data/*/target
!crates/nargo_cli/tests/test_data/*/target/witness.tr
!crates/nargo_cli/tests/test_data_ssa_refactor/*/target
!crates/nargo_cli/tests/test_data_ssa_refactor/*/target/witness.tr
16 changes: 8 additions & 8 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ wasm-bindgen-test = "0.3.33"
base64 = "0.21.2"

[patch.crates-io]
acvm = { git = "https://github.com/noir-lang/acvm", rev = "bb4ad6364f19e7326e2b8174cfe3a631369aa073" }
acvm-backend-barretenberg = { git = "https://github.com/noir-lang/acvm-backend-barretenberg", rev = "bdf707788f9d50718a2e9b63bd7be182bbcab3cd" }
acvm = { git = "https://github.com/noir-lang/acvm", rev = "b7d70a18996d0af45ae3b9287cb7799bcdec5cbd" }
acvm-backend-barretenberg = { git = "https://github.com/noir-lang/acvm-backend-barretenberg", rev = "e4c435cb8098db5a306e7081669ead7fe333a163" }
async-lsp = { git = "https://github.com/oxalica/async-lsp", rev = "09dbcc11046f7a188a80137f8d36484d86c78c78" }
4 changes: 1 addition & 3 deletions crates/lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,14 @@ fn on_code_lens_request(
let tests = context.get_all_test_functions_in_crate_matching(&crate_id, "");

let mut lenses: Vec<CodeLens> = vec![];
for func_id in tests {
for (func_name, func_id) in tests {
let location = context.function_meta(&func_id).name.location;
let file_id = location.file;
// TODO(#1681): This file_id never be 0 because the "path" where it maps is the directory, not a file
if file_id.as_usize() != 0 {
continue;
}

let func_name = context.function_name(&func_id);

let range =
byte_span_to_range(files, file_id.as_usize(), location.span.into()).unwrap_or_default();

Expand Down
4 changes: 1 addition & 3 deletions crates/lsp/src/lib_hacky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,14 @@ pub fn on_code_lens_request(
let tests = context.get_all_test_functions_in_crate_matching(&crate_id, "");

let mut lenses: Vec<CodeLens> = vec![];
for func_id in tests {
for (func_name, func_id) in tests {
let location = context.function_meta(&func_id).name.location;
let file_id = location.file;
// TODO(#1681): This file_id never be 0 because the "path" where it maps is the directory, not a file
if file_id.as_usize() != 0 {
continue;
}

let func_name = context.function_name(&func_id);

let range =
byte_span_to_range(files, file_id.as_usize(), location.span.into()).unwrap_or_default();

Expand Down
3 changes: 2 additions & 1 deletion crates/nargo_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ color-eyre = "0.6.2"
tokio = { version = "1.0", features = ["io-std"] }

# Backends
acvm-backend-barretenberg = { version = "0.9.0", default-features = false }
acvm-backend-barretenberg = { version = "0.9.1", default-features = false }

[dev-dependencies]
tempdir = "0.3.7"
Expand All @@ -62,3 +62,4 @@ default = ["plonk_bn254"]
plonk_bn254 = ["acvm-backend-barretenberg/native"]
plonk_bn254_wasm = ["acvm-backend-barretenberg/wasm"]
flat_witness = ["acvm-backend-barretenberg/native"]

15 changes: 10 additions & 5 deletions crates/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ pub(crate) struct TestCommand {
/// If given, only tests with names containing this string will be run
test_name: Option<String>,

/// Display output of `println` statements
#[arg(long)]
show_output: bool,

#[clap(flatten)]
compile_options: CompileOptions,
}
Expand All @@ -31,13 +35,14 @@ pub(crate) fn run<B: Backend>(
) -> Result<(), CliError<B>> {
let test_name: String = args.test_name.unwrap_or_else(|| "".to_owned());

run_tests(backend, &config.program_dir, &test_name, &args.compile_options)
run_tests(backend, &config.program_dir, &test_name, args.show_output, &args.compile_options)
}

fn run_tests<B: Backend>(
backend: &B,
program_dir: &Path,
test_name: &str,
show_output: bool,
compile_options: &CompileOptions,
) -> Result<(), CliError<B>> {
let (mut context, crate_id) = resolve_root_manifest(program_dir, None)?;
Expand All @@ -61,12 +66,11 @@ fn run_tests<B: Backend>(
let writer = StandardStream::stderr(ColorChoice::Always);
let mut writer = writer.lock();

for test_function in test_functions {
let test_name = context.function_name(&test_function);
for (test_name, test_function) in test_functions {
writeln!(writer, "Testing {test_name}...").expect("Failed to write to stdout");
writer.flush().ok();

match run_test(backend, test_name, test_function, &context, compile_options) {
match run_test(backend, &test_name, test_function, &context, show_output, compile_options) {
Ok(_) => {
writer.set_color(ColorSpec::new().set_fg(Some(Color::Green))).ok();
writeln!(writer, "ok").ok();
Expand Down Expand Up @@ -94,9 +98,10 @@ fn run_test<B: Backend>(
test_name: &str,
main: FuncId,
context: &Context,
show_output: bool,
config: &CompileOptions,
) -> Result<(), CliError<B>> {
let mut program = compile_no_check(context, config, main)
let mut program = compile_no_check(context, show_output, config, main)
.map_err(|_| CliError::Generic(format!("Test '{test_name}' failed to compile")))?;
// Note: We could perform this test using the unoptimized ACIR as generated by `compile_no_check`.
program.circuit = optimize_circuit(backend, program.circuit).unwrap().0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"input","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"input":[1]},"return_type":{"kind":"field"},"return_witnesses":[2]},"bytecode":"H4sIAAAAAAAA/62PQQ6AIAwEi36opS20N78isfz/CcYEY8JV5rJ7muzuAJDg4+3HSPwHpeGcvYxFJGoOYjoxezNF0VaMjNT0ysYcJla9eUUn4aCuzn2It3Ubcf7+uG/100MmGAEAAA==","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[],"param_witnesses":{},"return_type":null,"return_witnesses":[]},"bytecode":[155,194,56,97,194,4,0],"proving_key":null,"verification_key":null}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"z","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2],"z":[3]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/9WUTW6EMAyFPfwOQwdVVdVuuuAImMAQdr1KUZn7H6FEjaUUseO5Giyh4AhenC9+eSeiD/qN0/JEfqyDPFrlsc/l25P//9OPzb5gWYewug2tYqcuy0uyaKQhwGQFLPU5bcAyza3r5qGd2fBX046T7Zuun26WLfe2/26tMbPt7DBO49CM3JmZ7/1o7n7x8NCQus9K4GMF+KA6OQVqIflpGS2VxsXqqhktWzRyMZGD4ibqIM9Jz2gCC637QscwWoark3OgFpKfltFyaVysrprRzotGISZyUNxEHeQF6RlNYKF1X+kYRjvj6uQCqIXkp2W0QhoXq6tmtMuiUYqJHBQ3UQd5SXpGE1ho3Tc6htEuuDq5BGr9F7+95xwr8dtb1xOQXxb4Iwz0xYWsOaz3Grwnfow2eiJT2BOt1llzrDbmoItrHNJVQbciXPNr7bvCn9Gfy+nRmYbxA5t52qU1EwAA","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"z","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2],"z":[3]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+1Yy27CMBAckkCBFsqjqKoqqtx6tfOA5NZfKWr4/09orDrFSQsHMouCxEooMZDxeHbtsfMG4B0/0Ss/nr2GTttrtH3brv4L53kTH/aq2oXu8bCUFEePyDEoMfoNTemCGsJBI6F923bDFxQqVpskKbZRoWP9qaJ8l6UqSXebTGc6zdKvKIvjIkuybb7LtyrXSVzofZrHewvWJ2INiFiVngNHT4mCC/7Bbcv9GfzJJlFHzNzfEXlJ6eeR9et1Uz91MxOumQxLjBEuYCamoxAHMxnhusxkRMQag28mY8iayRB8M3kBrsJMmLm/J/KS0q/LZkLU72TNtOXpE/UbEnk9EPUzG9g/xgH++sPk7PKdOPcB6rXv1sRAYExo9NPUcQpBU5ZK0kQAdwpe8UuNe8rPUW1x6rKm1Y6czdFMCk9YVwKurm4eS4xZlSxD3HwROu0Zju/QGEnwBXBfcRm3VedFTXwSTz0jYjH181B3hC7v0gga/uYWjWDhzkuMBXCYoHMcVjLP/hg2OmdvE4nvG6iFu24/xsiOUZ/ST50XtSSyxrwg5nWNTi+cVVDfkzL1WxL1u9QxhcnZ5fvk3N+OKS0xl1ZQNu4K3T6mmHGv+DkSPaawNXXjG0o9g/fSHgAA","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"z","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2],"z":[3]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/81WUW6DMAw1AdoOUPe37x4hJklJ/naVoYX7H2GwJVOIKvUjdoUllBihl+fnp+B3APiAv6jWR4T1luQiy+uQx29jiLB+hlWWBVaEWIIOS0IWhbgYN82K0aaNaMI+5m0QPo06I6HkXWs/jR4VfsnRzdZIbea7RYvGmu/RKuWttpOb3SQdauVxMU4tgURFiEUoOl6ZGlgzNJGq5pawF6/Sr5RnfVD9ToT6bVjpxRmjovFiDKTknPI9J/smrOKBJ04MNUF2Tq7j9cE70sM5mnRmwL0Anfm56r7Q92h3OR1Z03x6IuZqWzj+xPO2YnSx+E2Q7cUtyTvgm3j88huOQKhdQYVY/5gdYQOfma3UzARco4YOmMzWrxgDMP4doml72I/tA/CP7V051hiwsCfkNTAZg9rAPfDdlj/vGtOvZA8AAA==","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"z","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2],"z":[3]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/81UbQrDIAy19pOO7Qw7gvGj1X+7ysrs/Y+wjkWwUvZjRuiDkqTIM3kveGGMXdkX1fZxjPeo5kldYx3OBnCMD4wiD1BFXEpMWvtZelDwFNIt1ghtlsmCBWPNS1qlvNV2doubhQOtPKzGqRXJeH5fEBKWgIq32Tja2IgG81C3KHyMOmkiV6iK0RnICbnG/Bklzgi/9BP/YWci1cwtoa8jXV+i5P7VJ9WvI9TvwxU/nAEVzS4GAGXPcb99lDcY+cFOdAVmYsk9qY63g3+kl5cwqS/AOzC65S8190Dv0e5xOrumMd6CLnYfigkAAA==","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":32},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/81XUW6EIBAd0bpdN92/fjbpEUBE4a9XqSne/wjVLbRIbJqUN8lOYhAwb4Y3DwavRPRMX1atjwjta9IXoR/nqvD9W2hlmakUE4grKbNCXBVf6hWjSQmrM8Ka0KcDsrQch8FPvVdavcvezdbIwcyjVVYZaz56q7W3g53c7Cbp1KC9WozTS3Be/ZKEUtwnJuJrBvJBcaoGiHXn/H3HKYCaaYBYD0D+WtofKNHQBxcy5jTeNnlvQisONNEyrIkyPzmP14MxqHOOJHEQdSKc+LnWfcLnaHc43TOngvZCRccKLB7om0o0+7hinOPiN0K2gZekv03WmfO84iCrhCyz24JQCTwDE8gtNmCsIzGJrVsxLsRYHaJoO/q5Aovg9C8RyzLbJeC/G8IvN3Md4TbXhUkY6N+LjvhOy0/Gs2dxxA4AAA==","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"array","length":5,"type":{"kind":"integer","sign":"unsigned","width":8}},"visibility":"private"},{"name":"result","type":{"kind":"array","length":32,"type":{"kind":"integer","sign":"unsigned","width":8}},"visibility":"public"}],"param_witnesses":{"result":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"x":[1,2,3,4,5]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+1d+ZfPZRS+CIOQ7Pvevny/ZoaZVm32fd+XYawhhBBCCCGEEEIIIYQQQgghhBBC9G9039z5dN+X397HOZ/POZ97zj33vc7pmec+9/accma+8w8RnaR7kYszt9QU1ed2+jxO/4jT55U+RXDzOvh55J/Jq/4sn4OR3+lTnL6A0xd0+kJO/6jTF3b6Ik5f1Okfc/piTv+40xd3+hJOX9LpSzl9aacv4/Rlnb6c05d3+gpOX9HpKzl9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z1K4jcvMfRa/o+BQTwvns1LPkR1o46oK1KYnkNd5ip5xITlrvr+rd2xcnpjnRVA07gUKt3GZuS/gdxQc6jnhfEHqRbIDbVzVgNpkAXldougZF5Kz5vuHesfG5Yl5SQRF416mcBuXmfsyfkfBoV4UzpelXiE70MZVHahNLyCvqxQ940Jy1nz/VO/YuDwxr4qgaNxrFG7jMnNfw+8oONQrwvma1OtkB9q4agC16Q3kdYOiZ1xIzprvX+odG5cn5g0RFI17k8JtXGbum/gdBYd6XTjflHqL7EAbV02gNtlAXrcpesaF5Kz5/q3esXF5Yt4WQdG4dyjcxmXmvoPfUXCot4TzHal3yQ70PHeBelcRHPMvUH7OFM4CnAU5C3Ga35ptfgGtOXbza9HMbxgqxmk+9958hLT5NFbzwYbmM8LMx+2YT64wPwRufp7S/GiS+S5/8w2z5nvPzLdxmK9XldP8PZ35X17zX481lVb/AkQE+lKQnQAA","proving_key":null,"verification_key":null}
Binary file not shown.
Loading

0 comments on commit 9c16c43

Please sign in to comment.