Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sync from aztec-packages #5877

Merged
merged 3 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
57f3c9bdc99103862a165bc235efdc8ef01b4e92
cf5b667c9566019853a5dc2a7f16ed024ab9182b
4 changes: 2 additions & 2 deletions acvm-repo/brillig/src/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub enum ValueOrArray {
pub enum BrilligOpcode<F> {
/// Takes the fields in addresses `lhs` and `rhs`
/// Performs the specified binary operation
/// and stores the value in the `result` address.
/// and stores the value in the `result` address.
BinaryFieldOp {
destination: MemoryAddress,
op: BinaryFieldOp,
Expand All @@ -180,7 +180,7 @@ pub enum BrilligOpcode<F> {
},
/// Takes the `bit_size` size integers in addresses `lhs` and `rhs`
/// Performs the specified binary operation
/// and stores the value in the `result` address.
/// and stores the value in the `result` address.
BinaryIntOp {
destination: MemoryAddress,
op: BinaryIntOp,
Expand Down
3 changes: 3 additions & 0 deletions compiler/noirc_driver/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ pub struct ContractFunction {

/// Names of the functions in the program. These are used for more informative debugging and benchmarking.
pub names: Vec<String>,

/// Names of the unconstrained functions in the program.
pub brillig_names: Vec<String>,
}
1 change: 1 addition & 0 deletions compiler/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ fn compile_contract_inner(
debug: function.debug,
is_unconstrained: modifiers.is_unconstrained,
names: function.names,
brillig_names: function.brillig_names,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "sha256_var_witness_const_regression"
type = "bin"
authors = [""]
compiler_version = ">=0.33.0"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
input = [0, 0]
toggle = false
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fn main(input: [u8; 2], toggle: bool) {
let size: Field = 1 + toggle as Field;
assert(!toggle);

let variable_sha = std::sha256::sha256_var(input, size as u64);
let constant_sha = std::sha256::sha256_var(input, 1);

assert_eq(variable_sha, constant_sha);
}
3 changes: 1 addition & 2 deletions test_programs/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ else
done
fi

# Clear any existing rebuild.log
rm -f "$current_dir/rebuild.log"
parallel -j7 process_dir {} "$current_dir" ::: ${dirs_to_process[@]}
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved

# Process directories in parallel
parallel -j7 process_dir {} "$current_dir" ::: ${dirs_to_process[@]}
Expand Down
46 changes: 23 additions & 23 deletions tooling/nargo_cli/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
fn watch_workspace(workspace: &Workspace, compile_options: &CompileOptions) -> notify::Result<()> {
let (tx, rx) = std::sync::mpsc::channel();

// No specific tickrate, max debounce time 1 seconds

Check warning on line 73 in tooling/nargo_cli/src/cli/compile_cmd.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (tickrate)
let mut debouncer = new_debouncer(Duration::from_secs(1), None, tx)?;

// Add a path to be watched. All files and directories at that path and
Expand Down Expand Up @@ -181,30 +181,30 @@
.map(|p| p.into())
};

let program_results: Vec<CompilationResult<()>> = binary_packages
.par_iter()
.map(|package| {
let (program, warnings) = compile_program(
file_manager,
parsed_files,
workspace,
package,
compile_options,
load_cached_program(package),
)?;

let target_width =
get_target_width(package.expression_width, compile_options.expression_width);
let program = nargo::ops::transform_program(program, target_width);
let compile_package = |package| {
let (program, warnings) = compile_program(
file_manager,
parsed_files,
workspace,
package,
compile_options,
load_cached_program(package),
)?;

let target_width =
get_target_width(package.expression_width, compile_options.expression_width);
let program = nargo::ops::transform_program(program, target_width);

save_program_to_file(&program.into(), &package.name, workspace.target_directory_path());

Ok(((), warnings))
};

save_program_to_file(
&program.clone().into(),
&package.name,
workspace.target_directory_path(),
);
Ok(((), warnings))
})
.collect();
// Configure a thread pool with a larger stack size to prevent overflowing stack in large programs.
// Default is 2MB.
let pool = rayon::ThreadPoolBuilder::new().stack_size(4 * 1024 * 1024).build().unwrap();
let program_results: Vec<CompilationResult<()>> =
pool.install(|| binary_packages.par_iter().map(compile_package).collect());

// Collate any warnings/errors which were encountered during compilation.
collect_errors(program_results).map(|(_, warnings)| ((), warnings))
Expand Down
39 changes: 22 additions & 17 deletions tooling/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,28 @@ pub(crate) fn run(args: TestCommand, config: NargoConfig) -> Result<(), CliError
None => FunctionNameMatch::Anything,
};

let test_reports: Vec<Vec<(String, TestStatus)>> = workspace
.into_iter()
.par_bridge()
.map(|package| {
run_tests::<Bn254BlackBoxSolver>(
&workspace_file_manager,
&parsed_files,
package,
pattern,
args.show_output,
args.oracle_resolver.as_deref(),
Some(workspace.root_dir.clone()),
Some(package.name.to_string()),
&args.compile_options,
)
})
.collect::<Result<_, _>>()?;
// Configure a thread pool with a larger stack size to prevent overflowing stack in large programs.
// Default is 2MB.
let pool = rayon::ThreadPoolBuilder::new().stack_size(4 * 1024 * 1024).build().unwrap();
let test_reports: Vec<Vec<(String, TestStatus)>> = pool.install(|| {
workspace
.into_iter()
.par_bridge()
.map(|package| {
run_tests::<Bn254BlackBoxSolver>(
&workspace_file_manager,
&parsed_files,
package,
pattern,
args.show_output,
args.oracle_resolver.as_deref(),
Some(workspace.root_dir.clone()),
Some(package.name.to_string()),
&args.compile_options,
)
})
.collect::<Result<_, _>>()
})?;
let test_report: Vec<(String, TestStatus)> = test_reports.into_iter().flatten().collect();

if test_report.is_empty() {
Expand Down
3 changes: 3 additions & 0 deletions tooling/noirc_artifacts/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ pub struct ContractFunctionArtifact {
deserialize_with = "ProgramDebugInfo::deserialize_compressed_base64_json"
)]
pub debug_symbols: ProgramDebugInfo,

pub brillig_names: Vec<String>,
}

impl From<ContractFunction> for ContractFunctionArtifact {
Expand All @@ -82,6 +84,7 @@ impl From<ContractFunction> for ContractFunctionArtifact {
custom_attributes: func.custom_attributes,
abi: func.abi,
bytecode: func.bytecode,
brillig_names: func.brillig_names,
debug_symbols: ProgramDebugInfo { debug_infos: func.debug },
}
}
Expand Down
Loading