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§
sourcetype DeviceMatrix: Matrix<SC::Val>
type DeviceMatrix: Matrix<SC::Val>
The type used to store the traces.
sourcetype DeviceProverData
type DeviceProverData
The type used to store the polynomial commitment schemes data.
sourcetype DeviceProvingKey: MachineProvingKey<SC>
type DeviceProvingKey: MachineProvingKey<SC>
The type used to store the proving key.
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 setup(
&self,
program: &A::Program,
) -> (Self::DeviceProvingKey, StarkVerifyingKey<SC>)
fn setup( &self, program: &A::Program, ) -> (Self::DeviceProvingKey, StarkVerifyingKey<SC>)
Setup the preprocessed data into a proving and verifying key.
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: &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 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.
sourcefn prove(
&self,
pk: &Self::DeviceProvingKey,
records: Vec<A::Record>,
challenger: &mut SC::Challenger,
opts: <A::Record as MachineRecord>::Config,
) -> Result<MachineProof<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>
Generate a proof for the given records.
Provided Methods§
sourcefn generate_traces(
&self,
record: &A::Record,
interaction_scope: InteractionScope,
) -> Vec<(String, RowMajorMatrix<Val<SC>>)>
fn generate_traces( &self, record: &A::Record, interaction_scope: InteractionScope, ) -> 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.
sourcefn 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,
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.