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

chore: move CRS files into their own directory #2558

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 10 additions & 1 deletion crates/acvm_backend_barretenberg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ impl Backend {
}

fn backend_directory(&self) -> PathBuf {
backends_directory().join(&self.name)
// If an explicit path to a backend binary has been provided then
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
if let Some(binary_path) = std::env::var_os("NARGO_BACKEND_PATH") {
PathBuf::from(binary_path).parent().unwrap().to_path_buf()
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
} else {
backends_directory().join(&self.name)
}
}

fn crs_directory(&self) -> PathBuf {
self.backend_directory().join("crs")
}

fn binary_path(&self) -> PathBuf {
Expand Down
8 changes: 4 additions & 4 deletions crates/acvm_backend_barretenberg/src/proof_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Backend {
write_to_file(serialized_circuit.as_bytes(), &circuit_path);

let binary_path = assert_binary_exists(self);
GatesCommand { crs_path: self.backend_directory(), bytecode_path: circuit_path }
GatesCommand { crs_path: self.crs_directory(), bytecode_path: circuit_path }
.run(&binary_path)
}

Expand Down Expand Up @@ -82,7 +82,7 @@ impl Backend {
// Create proof and store it in the specified path
ProveCommand {
verbose: true,
crs_path: self.backend_directory(),
crs_path: self.crs_directory(),
is_recursive,
bytecode_path,
witness_path,
Expand Down Expand Up @@ -141,7 +141,7 @@ impl Backend {
let binary_path = assert_binary_exists(self);
WriteVkCommand {
verbose: false,
crs_path: self.backend_directory(),
crs_path: self.crs_directory(),
is_recursive,
bytecode_path,
vk_path_output: vk_path.clone(),
Expand All @@ -151,7 +151,7 @@ impl Backend {
// Verify the proof
let valid_proof = VerifyCommand {
verbose: false,
crs_path: self.backend_directory(),
crs_path: self.crs_directory(),
is_recursive,
proof_path,
vk_path,
Expand Down
4 changes: 2 additions & 2 deletions crates/acvm_backend_barretenberg/src/smart_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Backend {
let binary_path = assert_binary_exists(self);
WriteVkCommand {
verbose: false,
crs_path: self.backend_directory(),
crs_path: self.crs_directory(),
is_recursive: false,
bytecode_path,
vk_path_output: vk_path.clone(),
Expand All @@ -37,7 +37,7 @@ impl Backend {
let contract_path = temp_directory_path.join("contract");
ContractCommand {
verbose: false,
crs_path: self.backend_directory(),
crs_path: self.crs_directory(),
vk_path,
contract_path: contract_path.clone(),
}
Expand Down