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§
sourcetype DeviceMatrix
type DeviceMatrix
The type used to store the traces.
sourcetype DeviceProverData
type DeviceProverData
The type used to store the polynomial commitment schemes data.
Required Methods§
sourcefn new(machine: StarkMachine<SC, A>) -> Self
fn new(machine: StarkMachine<SC, A>) -> Self
Create a new prover from a given machine.
sourcefn machine(&self) -> &StarkMachine<SC, A>
fn machine(&self) -> &StarkMachine<SC, A>
A reference to the machine that this prover is using.
sourcefn commit(
&self,
record: A::Record,
traces: Vec<(String, RowMajorMatrix<Val<SC>>)>,
) -> ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>
fn commit( &self, record: A::Record, traces: Vec<(String, RowMajorMatrix<Val<SC>>)>, ) -> ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>
Commit to the main traces.
sourcefn open(
&self,
pk: &StarkProvingKey<SC>,
data: ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>,
challenger: &mut SC::Challenger,
) -> Result<ShardProof<SC>, Self::Error>
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.
sourcefn prove(
&self,
pk: &StarkProvingKey<SC>,
records: Vec<A::Record>,
challenger: &mut SC::Challenger,
opts: <A::Record as MachineRecord>::Config,
) -> Result<MachineProof<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>
Generate a proof for the given records.
Provided Methods§
sourcefn setup(
&self,
program: &A::Program,
) -> (StarkProvingKey<SC>, StarkVerifyingKey<SC>)
fn setup( &self, program: &A::Program, ) -> (StarkProvingKey<SC>, StarkVerifyingKey<SC>)
Setup the preprocessed data into a proving and verifying key.
sourcefn generate_traces(
&self,
record: &A::Record,
) -> Vec<(String, RowMajorMatrix<Val<SC>>)>
fn generate_traces( &self, record: &A::Record, ) -> Vec<(String, RowMajorMatrix<Val<SC>>)>
Generate the main traces.
sourcefn observe(
&self,
challenger: &mut SC::Challenger,
commitment: Com<SC>,
public_values: &[SC::Val],
)
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.
sourcefn num_pv_elts(&self) -> usize
fn num_pv_elts(&self) -> usize
The number of public values elements.
sourcefn shard_chips<'a, 'b>(
&'a self,
record: &'b A::Record,
) -> impl Iterator<Item = &'b MachineChip<SC, A>>where
SC: 'b,
'a: 'b,
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.
sourcefn debug_constraints(
&self,
pk: &StarkProvingKey<SC>,
records: Vec<A::Record>,
challenger: &mut SC::Challenger,
)
fn debug_constraints( &self, pk: &StarkProvingKey<SC>, records: Vec<A::Record>, challenger: &mut SC::Challenger, )
Debug the constraints for the given inputs.
Object Safety§
This trait is not object safe.