CpuProver

Struct CpuProver 

Source
pub struct CpuProver<SC: StarkGenericConfig, A> { /* private fields */ }
Expand description

A prover implementation based on x86 and ARM CPUs.

Trait Implementations§

Source§

impl<SC, A> MachineProver<SC, A> for CpuProver<SC, A>

Source§

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

Prove the program for the given shard and given a commitment to the main data.

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>>,

Prove the execution record is valid.

Given a proving key pk and a matching execution record record, this function generates a STARK proof that the execution record is valid.

Source§

type DeviceMatrix = DenseMatrix<<<<SC as StarkGenericConfig>::Pcs as Pcs<<SC as StarkGenericConfig>::Challenge, <SC as StarkGenericConfig>::Challenger>>::Domain as PolynomialSpace>::Val>

The type used to store the traces.
Source§

type DeviceProverData = <<SC as StarkGenericConfig>::Pcs as Pcs<<SC as StarkGenericConfig>::Challenge, <SC as StarkGenericConfig>::Challenger>>::ProverData

The type used to store the polynomial commitment schemes data.
Source§

type DeviceProvingKey = StarkProvingKey<SC>

The type used to store the proving key.
Source§

type Error = CpuProverError

The type used for error handling.
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, named_traces: Vec<(String, RowMajorMatrix<Val<SC>>)>, ) -> ShardMainData<SC, Self::DeviceMatrix, Self::DeviceProverData>

Commit to the main traces.
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.

Auto Trait Implementations§

§

impl<SC, A> Freeze for CpuProver<SC, A>
where SC: Freeze,

§

impl<SC, A> RefUnwindSafe for CpuProver<SC, A>

§

impl<SC, A> Send for CpuProver<SC, A>
where A: Send,

§

impl<SC, A> Sync for CpuProver<SC, A>
where A: Sync,

§

impl<SC, A> Unpin for CpuProver<SC, A>
where SC: Unpin, A: Unpin, <SC as StarkGenericConfig>::Val: Unpin,

§

impl<SC, A> UnwindSafe for CpuProver<SC, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more