Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

chore!: rename blackbox to black_box #72

Merged
merged 1 commit into from
Feb 3, 2023
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
2 changes: 1 addition & 1 deletion acir/src/circuit/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod blackbox_functions;
pub mod black_box_functions;
pub mod directives;
pub mod opcodes;
pub use opcodes::Opcode;
Expand Down
4 changes: 2 additions & 2 deletions acir/src/circuit/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ fn serialisation_roundtrip() {

let opcode_arith = Opcode::Arithmetic(Expression::default());

let opcode_blackbox_func = Opcode::BlackBoxFuncCall(BlackBoxFuncCall {
let opcode_black_box_func = Opcode::BlackBoxFuncCall(BlackBoxFuncCall {
name: BlackBoxFunc::AES,
inputs: vec![
FunctionInput {
Expand All @@ -356,7 +356,7 @@ fn serialisation_roundtrip() {
result: Witness(56789u32),
});

let opcodes = vec![opcode_arith, opcode_blackbox_func, opcode_directive];
let opcodes = vec![opcode_arith, opcode_black_box_func, opcode_directive];

for opcode in opcodes {
let (op, got_op) = read_write(opcode);
Expand Down
2 changes: 1 addition & 1 deletion acir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pub mod native_types;
mod serialisation;

pub use acir_field::FieldElement;
pub use circuit::blackbox_functions::BlackBoxFunc;
pub use circuit::black_box_functions::BlackBoxFunc;
4 changes: 2 additions & 2 deletions acvm/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ pub enum CompileError {
pub fn compile(
acir: Circuit,
np_language: Language,
is_blackbox_supported: IsBlackBoxSupported,
is_black_box_supported: IsBlackBoxSupported,
) -> Result<Circuit, CompileError> {
// Instantiate the optimiser.
// Currently the optimiser and reducer are one in the same
// for CSAT

// Fallback pass
let fallback = fallback::fallback(acir, is_blackbox_supported)?;
let fallback = fallback::fallback(acir, is_black_box_supported)?;

let optimiser = match &np_language {
crate::Language::R1CS => {
Expand Down
20 changes: 10 additions & 10 deletions acvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub trait PartialWitnessGenerator {
let resolution = match &opcode {
Opcode::Arithmetic(expr) => ArithmeticSolver::solve(initial_witness, expr),
Opcode::BlackBoxFuncCall(bb_func) => {
Self::solve_blackbox_function_call(initial_witness, bb_func)
Self::solve_black_box_function_call(initial_witness, bb_func)
}
Opcode::Directive(directive) => Self::solve_directives(initial_witness, directive),
};
Expand All @@ -88,7 +88,7 @@ pub trait PartialWitnessGenerator {
self.solve(initial_witness, unsolved_opcodes)
}

fn solve_blackbox_function_call(
fn solve_black_box_function_call(
initial_witness: &mut BTreeMap<Witness, FieldElement>,
func_call: &BlackBoxFuncCall,
) -> Result<(), OpcodeResolutionError>;
Expand Down Expand Up @@ -139,11 +139,11 @@ pub trait ProofSystemCompiler {
/// as this in most cases will be inefficient. For this reason, we want to throw a hard error
/// if the language and proof system does not line up.
fn np_language(&self) -> Language;
// Returns true if the backend supports the selected blackbox function
fn blackbox_function_supported(&self, opcode: &BlackBoxFunc) -> bool;
// Returns true if the backend supports the selected black box function
fn black_box_function_supported(&self, opcode: &BlackBoxFunc) -> bool;

/// Creates a Proof given the circuit description and the witness values.
/// It is important to note that the intermediate witnesses for blackbox functions will not generated
/// It is important to note that the intermediate witnesses for black box functions will not generated
/// This is the responsibility of the proof system.
///
/// See `SmartContract` regarding the removal of `num_witnesses` and `num_public_inputs`
Expand Down Expand Up @@ -190,23 +190,23 @@ pub fn hash_constraint_system(cs: &Circuit) -> [u8; 32] {
}

#[deprecated(
note = "For backwards compatibility, this method allows you to derive _sensible_ defaults for blackbox function support based on the np language. \n Backends should simply specify what they support."
note = "For backwards compatibility, this method allows you to derive _sensible_ defaults for black box function support based on the np language. \n Backends should simply specify what they support."
)]
// This is set to match the previous functionality that we had
// Where we could deduce what blackbox functions were supported
// Where we could deduce what black box functions were supported
// by knowing the np complete language
pub fn default_is_blackbox_supported(
pub fn default_is_black_box_supported(
language: Language,
) -> compiler::fallback::IsBlackBoxSupported {
// R1CS does not support any of the blackbox functions by default.
// R1CS does not support any of the black box functions by default.
// The compiler will replace those that it can -- ie range, xor, and
fn r1cs_is_supported(opcode: &BlackBoxFunc) -> bool {
match opcode {
_ => false,
}
}

// PLONK supports most of the blackbox functions by default
// PLONK supports most of the black box functions by default
// The ones which are not supported, the acvm compiler will
// attempt to transform into supported gates. If these are also not available
// then a compiler error will be emitted.
Expand Down
2 changes: 1 addition & 1 deletion acvm/src/pwg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::collections::BTreeMap;
pub mod arithmetic;
// Directives
pub mod directives;
// blackbox functions
// black box functions
pub mod hash;
pub mod logic;
pub mod range;
Expand Down