Skip to main content

ProgramOracle

Trait ProgramOracle 

Source
pub trait ProgramOracle {
    // Required method
    fn dispatch(
        &self,
        program: &Program,
        inputs: &[Vec<u8>],
    ) -> Result<Vec<Vec<u8>>, String>;

    // Provided methods
    fn dispatch_borrowed(
        &self,
        program: &Program,
        inputs: &[&[u8]],
    ) -> Result<Vec<Vec<u8>>, String> { ... }
    fn dispatch_borrowed_into(
        &self,
        program: &Program,
        inputs: &[&[u8]],
        outputs: &mut Vec<Vec<u8>>,
    ) -> Result<(), String> { ... }
    fn requires_output_inputs(&self) -> bool { ... }
}
Expand description

Raw-program execution oracle for C frontend parity and conformance.

Production execution must compile the frontend output through the canonical artifact lifecycle. This seam exists only to compare frontend stage programs against independent reference or target oracles.

Required Methods§

Source

fn dispatch( &self, program: &Program, inputs: &[Vec<u8>], ) -> Result<Vec<Vec<u8>>, String>

Run program with owned inputs and return one buffer per output.

Provided Methods§

Source

fn dispatch_borrowed( &self, program: &Program, inputs: &[&[u8]], ) -> Result<Vec<Vec<u8>>, String>

Run program with borrowed input buffers.

The default stages the borrowed slices for oracles that implement only the owned path.

Source

fn dispatch_borrowed_into( &self, program: &Program, inputs: &[&[u8]], outputs: &mut Vec<Vec<u8>>, ) -> Result<(), String>

Run program with borrowed inputs and write outputs into caller-owned slots.

The default moves each returned buffer into outputs, preserving existing slot allocations where possible.

Source

fn requires_output_inputs(&self) -> bool

Whether the oracle requires declared output buffers as input values.

Target oracles allocate declared outputs themselves. The reference interpreter consumes one value per non-workgroup buffer and requires zero-initialized output buffers explicitly.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§