pub struct ApiClient { /* private fields */ }
client
or prove
) and non-target_os="zkvm"
and crate feature client
only.Expand description
A client implementation for interacting with a zkVM server.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new_sub_process<P: AsRef<Path>>(server_path: P) -> Result<Self>
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
.
Sourcepub fn new_sub_process_compat<P: AsRef<Path>>(server_path: P) -> Result<Self>
pub fn new_sub_process_compat<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
.
Additionally allows for wider version mismatches, only rejecting major differences
Sourcepub fn with_connector(connector: Box<dyn Connector>) -> Self
pub fn with_connector(connector: Box<dyn Connector>) -> Self
Sourcepub fn prove(
&self,
env: &ExecutorEnv<'_>,
opts: &ProverOpts,
binary: Asset,
) -> Result<ProveInfo>
pub fn prove( &self, env: &ExecutorEnv<'_>, opts: &ProverOpts, binary: Asset, ) -> Result<ProveInfo>
Prove the specified ELF binary.
Sourcepub fn execute<F>(
&self,
env: &ExecutorEnv<'_>,
binary: Asset,
segments_out: AssetRequest,
segment_callback: F,
) -> Result<SessionInfo>
pub fn execute<F>( &self, env: &ExecutorEnv<'_>, binary: Asset, segments_out: AssetRequest, segment_callback: F, ) -> Result<SessionInfo>
Execute the specified ELF binary.
Sourcepub fn prove_segment(
&self,
opts: &ProverOpts,
segment: Asset,
receipt_out: AssetRequest,
) -> Result<SegmentReceipt>
pub fn prove_segment( &self, opts: &ProverOpts, segment: Asset, receipt_out: AssetRequest, ) -> Result<SegmentReceipt>
Prove the specified segment.
Sourcepub fn prove_zkr<Claim>(
&self,
proof_request: ProveZkrRequest,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<Claim>>where
Claim: Digestible + Debug + Clone + Serialize,
MaybePruned<Claim>: TryFrom<MaybePruned, Error = Error>,
Available on crate feature unstable
only.
pub fn prove_zkr<Claim>(
&self,
proof_request: ProveZkrRequest,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<Claim>>where
Claim: Digestible + Debug + Clone + Serialize,
MaybePruned<Claim>: TryFrom<MaybePruned, Error = Error>,
unstable
only.Prove the specified ZKR proof request.
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Sourcepub fn prove_keccak<Claim>(
&self,
proof_request: ProveKeccakRequest,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<Claim>>where
Claim: Digestible + Debug + Clone + Serialize,
MaybePruned<Claim>: TryFrom<MaybePruned, Error = Error>,
Available on crate feature unstable
only.
pub fn prove_keccak<Claim>(
&self,
proof_request: ProveKeccakRequest,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<Claim>>where
Claim: Digestible + Debug + Clone + Serialize,
MaybePruned<Claim>: TryFrom<MaybePruned, Error = Error>,
unstable
only.Prove the specified keccak proof request.
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Sourcepub fn lift(
&self,
opts: &ProverOpts,
receipt: Asset,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<ReceiptClaim>>
pub fn lift( &self, opts: &ProverOpts, receipt: Asset, receipt_out: AssetRequest, ) -> Result<SuccinctReceipt<ReceiptClaim>>
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).
Sourcepub fn join(
&self,
opts: &ProverOpts,
left_receipt: Asset,
right_receipt: Asset,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<ReceiptClaim>>
pub fn join( &self, opts: &ProverOpts, left_receipt: Asset, right_receipt: Asset, receipt_out: AssetRequest, ) -> Result<SuccinctReceipt<ReceiptClaim>>
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.
Sourcepub fn resolve(
&self,
opts: &ProverOpts,
conditional_receipt: Asset,
assumption_receipt: Asset,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<ReceiptClaim>>
pub fn resolve( &self, opts: &ProverOpts, conditional_receipt: Asset, assumption_receipt: Asset, receipt_out: AssetRequest, ) -> Result<SuccinctReceipt<ReceiptClaim>>
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.
Sourcepub fn identity_p254(
&self,
opts: &ProverOpts,
receipt: Asset,
receipt_out: AssetRequest,
) -> Result<SuccinctReceipt<ReceiptClaim>>
pub fn identity_p254( &self, opts: &ProverOpts, receipt: Asset, receipt_out: AssetRequest, ) -> Result<SuccinctReceipt<ReceiptClaim>>
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 Poseidon over BabyBear.
Sourcepub fn compress(
&self,
opts: &ProverOpts,
receipt: Asset,
receipt_out: AssetRequest,
) -> Result<Receipt>
pub fn compress( &self, opts: &ProverOpts, receipt: Asset, receipt_out: AssetRequest, ) -> Result<Receipt>
Compress a Receipt, proving the same computation using a smaller representation.
Proving will, by default, produce a CompositeReceipt, which may contain an arbitrary number of receipts assembled into segments and assumptions. Together, these receipts collectively prove a top-level ReceiptClaim. This function can be used to compress all of the constituent receipts of a CompositeReceipt into a single SuccinctReceipt or Groth16Receipt that proves the same top-level claim.
Compression from Groth16Receipt to SuccinctReceipt is accomplished by iterative application of the recursion programs including lift, join, and resolve.
Compression from SuccinctReceipt to Groth16Receipt is accomplished by running a Groth16 recursive verifier, refered to as the “STARK-to-SNARK” operation.
NOTE: Compression to Groth16Receipt is currently only supported on x86 hosts, and requires Docker to be installed. See issue #1749 for more information.
If the receipt is already at least as compressed as the requested compression level (e.g. it is already succinct or Groth16 and a succinct receipt is required) this function is a no-op. As a result, it is idempotent.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.