sp1_stark

Trait MachineProver

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

Show 13 methods // Required methods fn new(machine: StarkMachine<SC, A>) -> Self; fn machine(&self) -> &StarkMachine<SC, A>; fn setup( &self, program: &A::Program, ) -> (Self::DeviceProvingKey, StarkVerifyingKey<SC>); fn commit( &self, record: &A::Record, traces: Vec<(String, RowMajorMatrix<Val<SC>>)>, ) -> ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>; fn open( &self, pk: &Self::DeviceProvingKey, global_data: Option<ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>>, local_data: ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>, challenger: &mut SC::Challenger, global_permutation_challenges: &[SC::Challenge], ) -> Result<ShardProof<SC>, Self::Error>; fn prove( &self, pk: &Self::DeviceProvingKey, 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 generate_traces( &self, record: &A::Record, interaction_scope: InteractionScope, ) -> 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>> { ... } fn merge_shard_traces<'a, 'b>( &'a self, global_traces: &'b [Self::DeviceMatrix], global_chip_ordering: &'b HashMap<String, usize>, local_traces: &'b [Self::DeviceMatrix], local_chip_ordering: &'b HashMap<String, usize>, ) -> (HashMap<String, usize>, Vec<InteractionScope>, Vec<MergedProverDataItem<'b, Self::DeviceMatrix>>) where 'a: 'b { ... }
}
Expand description

An algorithmic & hardware independent prover implementation for any MachineAir.

Required Associated Types§

source

type DeviceMatrix: Matrix<SC::Val>

The type used to store the traces.

source

type DeviceProverData

The type used to store the polynomial commitment schemes data.

source

type DeviceProvingKey: MachineProvingKey<SC>

The type used to store the proving key.

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 setup( &self, program: &A::Program, ) -> (Self::DeviceProvingKey, StarkVerifyingKey<SC>)

Setup the preprocessed data into a proving and verifying key.

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: &Self::DeviceProvingKey, global_data: Option<ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>>, local_data: ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>, challenger: &mut SC::Challenger, global_permutation_challenges: &[SC::Challenge], ) -> Result<ShardProof<SC>, Self::Error>

Compute the openings of the traces.

source

fn prove( &self, pk: &Self::DeviceProvingKey, 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 generate_traces( &self, record: &A::Record, interaction_scope: InteractionScope, ) -> 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.

source

fn merge_shard_traces<'a, 'b>( &'a self, global_traces: &'b [Self::DeviceMatrix], global_chip_ordering: &'b HashMap<String, usize>, local_traces: &'b [Self::DeviceMatrix], local_chip_ordering: &'b HashMap<String, usize>, ) -> (HashMap<String, usize>, Vec<InteractionScope>, Vec<MergedProverDataItem<'b, Self::DeviceMatrix>>)
where 'a: 'b,

Merge the global and local chips’ sorted traces.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§