Struct risc0_zkvm::ApiClient

source ·
pub struct ApiClient { /* private fields */ }
Expand description

A client implementation for interacting with a zkVM server.

Implementations§

source§

impl Client

source

pub fn new() -> Result<Self>

Construct a Client that connects to r0vm in a child process.

source

pub fn new_sub_process<P: AsRef<Path>>(server_path: P) -> Result<Self>

Construct a Client that connects to a sub-process which implements the server by calling the specified server_path.

source

pub fn from_env() -> Result<Self>

Construct a Client based on environment variables.

source

pub fn with_connector(connector: Box<dyn Connector>) -> Self

Construct a Client using the specified Connector to establish a connection with the server.

source

pub fn prove( &self, env: &ExecutorEnv<'_>, opts: ProverOpts, binary: Asset ) -> Result<Receipt>

Prove the specified ELF binary.

source

pub fn execute<F>( &self, env: &ExecutorEnv<'_>, binary: Asset, segments_out: AssetRequest, segment_callback: F ) -> Result<SessionInfo>
where F: FnMut(SegmentInfo, Asset) -> Result<()>,

Execute the specified ELF binary.

source

pub fn prove_segment( &self, opts: ProverOpts, segment: Asset, receipt_out: AssetRequest ) -> Result<SegmentReceipt>

Prove the specified segment.

source

pub fn lift( &self, opts: ProverOpts, receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>

Run the lift program to transform a SegmentReceipt into a SuccinctReceipt.

The lift program verifies the rv32im circuit STARK proof inside the recursion circuit, resulting in a recursion circuit STARK proof. This recursion proof has a single constant-time verification procedure, with respect to the original segment length, and is then used as the input to all other recursion programs (e.g. join, resolve, and identity_p254).

source

pub fn join( &self, opts: ProverOpts, left_receipt: Asset, right_receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>

Run the join program to compress two SuccinctReceipts in the same session into one.

By repeated application of the join program, any number of receipts for execution spans within the same session can be compressed into a single receipt for the entire session.

source

pub fn resolve( &self, opts: ProverOpts, conditional_receipt: Asset, assumption_receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>

Run the resolve program to remove an assumption from a conditional SuccinctReceipt upon verifying a SuccinctReceipt proving the validity of the assumption.

By applying the resolve program, a conditional receipt (i.e. a receipt for an execution using the env::verify API to logically verify a receipt) can be made into an unconditional receipt.

source

pub fn identity_p254( &self, opts: ProverOpts, receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>

Prove the verification of a recursion receipt using the Poseidon254 hash function for FRI.

The identity_p254 program is used as the last step in the prover pipeline before running the Groth16 prover. In Groth16 over BN254, it is much more efficient to verify a STARK that was produced with Poseidon over the BN254 base field compared to using Posidon over BabyBear.

Trait Implementations§

source§

impl Default for Client

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl !Send for Client

§

impl !Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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

§

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