-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: storage v2 (AztecProtocol/aztec-packages#5027)
## Overview Works around brillig blowup issue by altering the read and write opcodes to take in arrays of data. This is potentially just a short term fix. - Reading and writing to storage now take in arrays, code will not compile without this change, due to an ssa issue ->[ ISSUE ](AztecProtocol/aztec-packages#4979) - Tag checks on memory now just make sure the tag is LESS than uint64, rather than asserting that the memory tag is uint32, this should be fine. - We had to blow up the memory space of the avm to u64 as the entire noir compiler works with u64s. Arrays will not work unless we either - Make the avm 64 bit addressable ( probably fine ) - Make noir 32 bit addressable ( requires alot of buy in ) AztecProtocol/aztec-packages#4814 --------- Co-authored-by: sirasistant <[email protected]>
- Loading branch information
1 parent
fe8f277
commit 699f43d
Showing
18 changed files
with
433 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
7ff9b71d8d87fc93ae7dbd8ba63f5176b0cd17be | ||
fe3190ee66d5c340b6ef6a6fe53772e8e08c9463 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
cd $(dirname "$0") | ||
|
||
CMD=${1:-} | ||
|
||
if [ -n "$CMD" ]; then | ||
if [ "$CMD" = "clean" ]; then | ||
git clean -fdx | ||
exit 0 | ||
else | ||
echo "Unknown command: $CMD" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Attempt to just pull artefacts from CI and exit on success. | ||
[ -n "${USE_CACHE:-}" ] && ./bootstrap_cache.sh && exit | ||
|
||
./scripts/bootstrap_native.sh | ||
./scripts/bootstrap_packages.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
cd "$(dirname "$0")" | ||
source ../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null | ||
|
||
echo -e "\033[1mRetrieving noir packages from remote cache...\033[0m" | ||
extract_repo noir-packages /usr/src/noir/packages ./ | ||
echo -e "\033[1mRetrieving nargo from remote cache...\033[0m" | ||
extract_repo noir /usr/src/noir/target/release ./target/ | ||
|
||
remove_old_images noir-packages | ||
remove_old_images noir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
test_programs/noir_test_failure/should_fail_suite_with_one_failure/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
name = "should_fail_with_mismatch" | ||
type = "bin" | ||
authors = [""] | ||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[package] | ||
name = "acvm_cli" | ||
description = "The entrypoint for executing the ACVM" | ||
# x-release-please-start-version | ||
version = "0.40.0" | ||
# x-release-please-end | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
rust-version.workspace = true | ||
repository.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
# Rename binary from `acvm_cli` to `acvm` | ||
[[bin]] | ||
name = "acvm" | ||
path = "src/main.rs" | ||
|
||
[dependencies] | ||
thiserror.workspace = true | ||
toml.workspace = true | ||
color-eyre = "0.6.2" | ||
clap.workspace = true | ||
acvm.workspace = true | ||
nargo.workspace = true | ||
const_format.workspace = true | ||
bn254_blackbox_solver.workspace = true | ||
acir.workspace = true | ||
|
||
# Logs | ||
tracing-subscriber.workspace = true | ||
tracing-appender = "0.2.3" | ||
|
||
[dev-dependencies] | ||
rand = "0.8.5" | ||
proptest = "1.2.0" | ||
paste = "1.0.14" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
use std::io::{self, Write}; | ||
|
||
use acir::circuit::Circuit; | ||
use acir::native_types::WitnessMap; | ||
use bn254_blackbox_solver::Bn254BlackBoxSolver; | ||
use clap::Args; | ||
|
||
use crate::cli::fs::inputs::{read_bytecode_from_file, read_inputs_from_file}; | ||
use crate::cli::fs::witness::save_witness_to_dir; | ||
use crate::errors::CliError; | ||
use nargo::ops::{execute_circuit, DefaultForeignCallExecutor}; | ||
|
||
use super::fs::witness::create_output_witness_string; | ||
|
||
/// Executes a circuit to calculate its return value | ||
#[derive(Debug, Clone, Args)] | ||
pub(crate) struct ExecuteCommand { | ||
/// Write the execution witness to named file | ||
#[clap(long, short)] | ||
output_witness: Option<String>, | ||
|
||
/// The name of the toml file which contains the input witness map | ||
#[clap(long, short)] | ||
input_witness: String, | ||
|
||
/// The name of the binary file containing circuit bytecode | ||
#[clap(long, short)] | ||
bytecode: String, | ||
|
||
/// The working directory | ||
#[clap(long, short)] | ||
working_directory: String, | ||
|
||
/// Set to print output witness to stdout | ||
#[clap(long, short, action)] | ||
print: bool, | ||
} | ||
|
||
fn run_command(args: ExecuteCommand) -> Result<String, CliError> { | ||
let bytecode = read_bytecode_from_file(&args.working_directory, &args.bytecode)?; | ||
let circuit_inputs = read_inputs_from_file(&args.working_directory, &args.input_witness)?; | ||
let output_witness = execute_program_from_witness(&circuit_inputs, &bytecode, None)?; | ||
let output_witness_string = create_output_witness_string(&output_witness)?; | ||
if args.output_witness.is_some() { | ||
save_witness_to_dir( | ||
&output_witness_string, | ||
&args.working_directory, | ||
&args.output_witness.unwrap(), | ||
)?; | ||
} | ||
Ok(output_witness_string) | ||
} | ||
|
||
pub(crate) fn run(args: ExecuteCommand) -> Result<String, CliError> { | ||
let print = args.print; | ||
let output_witness_string = run_command(args)?; | ||
if print { | ||
io::stdout().write_all(output_witness_string.as_bytes()).unwrap(); | ||
} | ||
Ok(output_witness_string) | ||
} | ||
|
||
pub(crate) fn execute_program_from_witness( | ||
inputs_map: &WitnessMap, | ||
bytecode: &Vec<u8>, | ||
foreign_call_resolver_url: Option<&str>, | ||
) -> Result<WitnessMap, CliError> { | ||
let blackbox_solver = Bn254BlackBoxSolver::new(); | ||
let circuit: Circuit = Circuit::deserialize_circuit(&bytecode) | ||
.map_err(|_| CliError::CircuitDeserializationError())?; | ||
let result = execute_circuit( | ||
&circuit, | ||
inputs_map.clone(), | ||
&blackbox_solver, | ||
&mut DefaultForeignCallExecutor::new(true, foreign_call_resolver_url), | ||
) | ||
.map_err(|e| CliError::CircuitExecutionError(e)); | ||
result | ||
} |
Oops, something went wrong.