Function validate_witness

Source
pub fn validate_witness<F: AcirField>(
    backend: &impl BlackBoxFunctionSolver<F>,
    witness_map: &WitnessMap<F>,
    circuit: &Circuit<F>,
) -> Result<(), OpcodeResolutionError<F>>
Expand description

Checks that an already-complete witness_map satisfies every constraint imposed by circuit, returning the first violation found.

This is a debugging/checking aid that re-evaluates each opcode’s constraint against the provided witness, mirroring what a proving backend enforces: a witness that passes here is one the backend should accept, and a witness that fails here is one it should reject.

The unit of correctness is constraint satisfaction. Only opcodes that impose constraints are checked here; opcodes that impose none are intentionally skipped, because there is nothing about them for a witness to satisfy or violate. The most important example is Opcode::BrilligCall, which runs unconstrained bytecode and is ignored entirely.