Function evaluate_black_box

Source
pub(crate) fn evaluate_black_box<F: AcirField, Solver: BlackBoxFunctionSolver<F>>(
    op: &BlackBoxOp,
    solver: &Solver,
    memory: &mut Memory<F>,
) -> Result<(), BlackBoxResolutionError>
Expand description

Evaluates a black box function inside the VM, performing the actual native computation.

Delegates the execution to the corresponding cryptographic or arithmetic function, depending on the [BlackBoxOp] variant. Handles input conversion, writing the result to memory, and error propagation.

§Arguments

  • op: The black box operation to evaluate.
  • solver: An implementation of [BlackBoxFunctionSolver] providing external function behavior.
  • memory: The VM memory from which inputs are read and to which results are written.
  • bigint_solver: A solver used for big integer operations.

§Returns

  • Ok(()) if evaluation succeeds.
  • Err([BlackBoxResolutionError]) if an error occurs during execution or input is invalid.

§Panics

If any required memory value cannot be converted to the expected type (e.g., expect_u8) or if the [radix decomposition][BlackBoxOp::ToRadix] constraints are violated internally, such as an invalid radix range (e.g., radix of 1).