acvm::pwg::blackbox

Function solve

Source
pub(crate) fn solve<F: AcirField>(
    backend: &impl BlackBoxFunctionSolver<F>,
    initial_witness: &mut WitnessMap<F>,
    bb_func: &BlackBoxFuncCall<F>,
) -> Result<(), OpcodeResolutionError<F>>
Expand description

Solve a black box function call

  1. Returns an error if not all the inputs are already resolved to a value
  2. Compute the output from the inputs, using the dedicated solvers

A blackbox is a fully specified function (e.g sha256, ecdsa signature,…) which the backend can prove execution in a more efficient way than using a generic arithmetic circuit. Solving a black box function simply means to compute the output from the inputs for the specific function. Our black box solver uses the standard rust implementation for the function if it is available. However, some functions depend on the backend, such as embedded curve operations, which depend on the elliptic curve used by the proving system. This is why the ‘solve’ functions takes a blackbox solver trait. The ‘AcvmBigIntSolver’ is also a blackbox solver, but dedicated to the BigInteger blackbox functions.