Trait sp1_core::stark::MachineProver

source ·
pub trait MachineProver<SC: StarkGenericConfig, A: MachineAir<SC::Val>>:
    'static
    + Send
    + Sync {
    type DeviceMatrix;
    type DeviceProverData;
    type Error: Error + Send + Sync;

    // Required methods
    fn new(machine: StarkMachine<SC, A>) -> Self;
    fn machine(&self) -> &StarkMachine<SC, A>;
    fn commit(
        &self,
        record: A::Record,
        traces: Vec<(String, RowMajorMatrix<Val<SC>>)>,
    ) -> ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>;
    fn open(
        &self,
        pk: &StarkProvingKey<SC>,
        data: ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>,
        challenger: &mut SC::Challenger,
    ) -> Result<ShardProof<SC>, Self::Error>;
    fn prove(
        &self,
        pk: &StarkProvingKey<SC>,
        records: Vec<A::Record>,
        challenger: &mut SC::Challenger,
        opts: <A::Record as MachineRecord>::Config,
    ) -> Result<MachineProof<SC>, Self::Error>
       where A: for<'a> Air<DebugConstraintBuilder<'a, Val<SC>, SC::Challenge>>;

    // Provided methods
    fn setup(
        &self,
        program: &A::Program,
    ) -> (StarkProvingKey<SC>, StarkVerifyingKey<SC>) { ... }
    fn generate_traces(
        &self,
        record: &A::Record,
    ) -> Vec<(String, RowMajorMatrix<Val<SC>>)> { ... }
    fn observe(
        &self,
        challenger: &mut SC::Challenger,
        commitment: Com<SC>,
        public_values: &[SC::Val],
    ) { ... }
    fn config(&self) -> &SC { ... }
    fn num_pv_elts(&self) -> usize { ... }
    fn shard_chips<'a, 'b>(
        &'a self,
        record: &'b A::Record,
    ) -> impl Iterator<Item = &'b MachineChip<SC, A>>
       where SC: 'b,
             'a: 'b { ... }
    fn debug_constraints(
        &self,
        pk: &StarkProvingKey<SC>,
        records: Vec<A::Record>,
        challenger: &mut SC::Challenger,
    )
       where SC::Val: PrimeField32,
             A: for<'a> Air<DebugConstraintBuilder<'a, Val<SC>, SC::Challenge>> { ... }
}

Required Associated Types§

source

type DeviceMatrix

The type used to store the traces.

source

type DeviceProverData

The type used to store the polynomial commitment schemes data.

source

type Error: Error + Send + Sync

The type used for error handling.

Required Methods§

source

fn new(machine: StarkMachine<SC, A>) -> Self

Create a new prover from a given machine.

source

fn machine(&self) -> &StarkMachine<SC, A>

A reference to the machine that this prover is using.

source

fn commit( &self, record: A::Record, traces: Vec<(String, RowMajorMatrix<Val<SC>>)>, ) -> ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>

Commit to the main traces.

source

fn open( &self, pk: &StarkProvingKey<SC>, data: ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>, challenger: &mut SC::Challenger, ) -> Result<ShardProof<SC>, Self::Error>

Compute the openings of the traces.

source

fn prove( &self, pk: &StarkProvingKey<SC>, records: Vec<A::Record>, challenger: &mut SC::Challenger, opts: <A::Record as MachineRecord>::Config, ) -> Result<MachineProof<SC>, Self::Error>
where A: for<'a> Air<DebugConstraintBuilder<'a, Val<SC>, SC::Challenge>>,

Generate a proof for the given records.

Provided Methods§

source

fn setup( &self, program: &A::Program, ) -> (StarkProvingKey<SC>, StarkVerifyingKey<SC>)

Setup the preprocessed data into a proving and verifying key.

source

fn generate_traces( &self, record: &A::Record, ) -> Vec<(String, RowMajorMatrix<Val<SC>>)>

Generate the main traces.

source

fn observe( &self, challenger: &mut SC::Challenger, commitment: Com<SC>, public_values: &[SC::Val], )

Observe the main commitment and public values and update the challenger.

source

fn config(&self) -> &SC

The stark config for the machine.

source

fn num_pv_elts(&self) -> usize

The number of public values elements.

source

fn shard_chips<'a, 'b>( &'a self, record: &'b A::Record, ) -> impl Iterator<Item = &'b MachineChip<SC, A>>
where SC: 'b, 'a: 'b,

The chips that will be necessary to prove this record.

source

fn debug_constraints( &self, pk: &StarkProvingKey<SC>, records: Vec<A::Record>, challenger: &mut SC::Challenger, )
where SC::Val: PrimeField32, A: for<'a> Air<DebugConstraintBuilder<'a, Val<SC>, SC::Challenge>>,

Debug the constraints for the given inputs.

Object Safety§

This trait is not object safe.

Implementors§