MachineProver

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 15 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 pk_from_vk( &self, program: &A::Program, vk: &StarkVerifyingKey<SC>, ) -> Self::DeviceProvingKey; fn pk_to_device(&self, pk: &StarkProvingKey<SC>) -> Self::DeviceProvingKey; fn pk_to_host(&self, pk: &Self::DeviceProvingKey) -> StarkProvingKey<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, data: ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>, challenger: &mut SC::Challenger, ) -> 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, ) -> 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>> { ... }
}
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 pk_from_vk( &self, program: &A::Program, vk: &StarkVerifyingKey<SC>, ) -> Self::DeviceProvingKey

Setup the proving key given a verifying key. This is similar to setup but faster since some computed information is already in the verifying key.

Source

fn pk_to_device(&self, pk: &StarkProvingKey<SC>) -> Self::DeviceProvingKey

Copy the proving key from the host to the device.

Source

fn pk_to_host(&self, pk: &Self::DeviceProvingKey) -> StarkProvingKey<SC>

Copy the proving key from the device to the host.

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, 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: &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, ) -> 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.

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§