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: remove special casing for pedersen_hash black box function #3744

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 2 additions & 15 deletions tooling/nargo/src/ops/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,9 @@ pub fn compile_program(
}
};

// TODO: we say that pedersen hashing is supported by all backends for now
let is_opcode_supported_pedersen_hash = |opcode: &Opcode| -> bool {
if let Opcode::BlackBoxFuncCall(
acvm::acir::circuit::opcodes::BlackBoxFuncCall::PedersenHash { .. },
) = opcode
{
true
} else {
is_opcode_supported(opcode)
}
};

// Apply backend specific optimizations.
let optimized_program =
crate::ops::optimize_program(program, np_language, &is_opcode_supported_pedersen_hash)
.expect("Backend does not support an opcode that is in the IR");
let optimized_program = crate::ops::optimize_program(program, np_language, is_opcode_supported)
.expect("Backend does not support an opcode that is in the IR");

(context.file_manager, Ok((optimized_program, warnings)))
}
Expand Down
15 changes: 2 additions & 13 deletions tooling/nargo_cli/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::path::Path;

use acvm::acir::circuit::opcodes::BlackBoxFuncCall;
use acvm::acir::circuit::Opcode;
use acvm::Language;
use backend_interface::BackendOpcodeSupport;
Expand Down Expand Up @@ -213,19 +212,9 @@ fn compile_program(
}
};

// TODO: we say that pedersen hashing is supported by all backends for now
let is_opcode_supported_pedersen_hash = |opcode: &Opcode| -> bool {
if let Opcode::BlackBoxFuncCall(BlackBoxFuncCall::PedersenHash { .. }) = opcode {
true
} else {
is_opcode_supported(opcode)
}
};

// Apply backend specific optimizations.
let optimized_program =
nargo::ops::optimize_program(program, np_language, &is_opcode_supported_pedersen_hash)
.expect("Backend does not support an opcode that is in the IR");
let optimized_program = nargo::ops::optimize_program(program, np_language, is_opcode_supported)
.expect("Backend does not support an opcode that is in the IR");

save_program(optimized_program.clone(), package, &workspace.target_directory_path());

Expand Down
Loading