Results & Outputs
Every .run() on a request builder (except UploadRequest::run())
returns a Result<JobHandle<T>> where T is one of the result
types. The result types are thin newtypes that carry an optional
remote JobId and Deref into their underlying *Output so all
backend accessors are reachable in one step.
Overview
Every .run() returns a Result<JobHandle<T>> where T is one of the result
types below. Awaiting the handle resolves to Result<T>.
The result types are thin newtypes over the prover backend's output
types. Each wraps an optional JobId (populated on remote runs,
None on embedded runs) and Derefs to its inner *Output so all
the backend accessors are reachable through the result without an
extra step.
Result types
Every result is a thin newtype that surfaces an identifier and
Derefs into an *Output carrying the actual data.
| Result | Identifier | Deref target |
|---|---|---|
SetupResult | job_id() -> Option<&JobId> | — |
UploadResult | hash_id() -> &str | — |
ExecuteResult | job_id() -> Option<&JobId> | ExecuteOutput |
ProveResult | job_id() -> Option<&JobId> | ProveOutput |
VerifyConstraintsResult | job_id() -> Option<&JobId> | VerifyConstraintsOutput |
SetupResult and UploadResult are not re-exported by zisk_sdk,
so you cannot name them in your own code, for example in a type
annotation. Bind them with let and call job_id() or hash_id() on
the value. The other three result types are exported.
ExecuteResult also has output() -> &ExecuteOutput, which borrows
the inner output explicitly instead of going through Deref.
// Every Output-side method is reachable through the Deref:
let result = client.prove(&PROGRAM, stdin).run()?.await?;
result.save_proof("./proof.bin")?;
let proof: &Proof = result.get_proof();
let publics: PublicValues = result.get_publics(); // by value on ProveOutput
result.verify()?;
Output types
The *Output types live in zisk_prover_backend and are re-exported
at the top level of zisk_sdk. They are the direct result of a
prover run; you don't construct them — you receive them via the
Deref from the corresponding *Result.
Shared: publics access
All three output types (ProveOutput, ExecuteOutput,
VerifyConstraintsOutput) expose the same four methods for reading
the public inputs the guest committed:
| Method | Returns | Description |
|---|---|---|
get_publics() | &PublicValues (PublicValues on ProveOutput) | The public inputs/outputs of the run. ProveOutput derives them from the proof body and returns them by value. |
get_public_values::<T>() | Result<T> | Typed deserialise via serde. |
get_public_values_abi::<T>() | Result<T> | Typed deserialise via Solidity ABI rules. |
get_public_values_slice(&mut [u8]) | () | Copy raw public-input bytes into the slice. |
The sections below cover what each output type adds on top.
ProveOutput
pub struct ProveOutput { /* ... */ }
Proof access
| Method | Returns | Description |
|---|---|---|
get_proof() | &Proof | Borrow the underlying proof. |
get_proof_bytes() | Result<Vec<u8>> | A Vadcop proof's flat layout, without the seed trailer. Errors on a SNARK proof. |
get_proof_u64() | Result<Vec<u64>> | The same layout as u64 words. |
get_program_vk() | ProgramVK | The program verification key the proof commits to, by value. |
save_proof(path: impl AsRef<Path>) | Result<()> | Persist the inner Proof to path. |
Verification
| Method | Returns | Description |
|---|---|---|
verify() | Result<()> | Verify the proof under the trusted keys (see below). |
with_publics(&PublicValues) | ZiskVerifyBuilder | Begin a verify chain with overridden publics. |
with_program_vk(&ProgramVK) | ZiskVerifyBuilder | Begin a verify chain with an overridden program VK. |
The two with_* methods return a ZiskVerifyBuilder you can keep
chaining (.with_publics(...).with_program_vk(...).verify());
verify() is the all-defaults shortcut.
Verification never trusts the keys a proof carries. ProveOutput
verifies under, in order:
- The keys you passed with the methods below.
- The keys of the setup that produced the proof. Only an embedded client has them; a remote result does not.
- The release keys compiled into this ZisK version.
Method (on ProveResult) | Key |
|---|---|
with_setup_vk(Vec<u64>) | A recurser's verkey, for an aggregate. |
with_leaf_setup_vk(Vec<u64>) | A non-release setup's vadcop_final.verkey.json (vadcop_final_compressed.verkey.json for a minimal proof). |
with_plonk_vk(PlonkVkey) | A PLONK final.verkey.json. |
with_pilfflonk_vkey(String) | The JSON of a pilfflonk.vkey.json. |
Each consumes the result and returns it, so chain them before
verify():
let result = client.prove(&PROGRAM, stdin).run()?.await?;
let result = result.with_leaf_setup_vk(cluster_vk);
result.with_program_vk(&PROGRAM.vk()?).verify()?;
See Proof › verify for which key each proof kind needs.
Statistics
| Method | Returns | Description |
|---|---|---|
get_proving_time() | u64 | Total proving time in milliseconds. |
get_execution_steps() | u64 | Number of guest steps executed. |
get_execution_cost() | u64 | Aggregated execution cost (in cost units). |
get_random_seed() | Option<RandomSeed> | The host randomness seed of the proven execution. None for aggregates, and for remote runs on coordinators that predate it. A wrapped proof keeps its source's seed. |
let out = client.prove(&PROGRAM, stdin).run()?.await?;
// Save to disk
out.save_proof("./proofs/run-42.bin")?;
// Decode publics into a typed value
let digest: [u8; 32] = out.get_public_values()?;
// Verify with the publics already embedded in the proof
out.verify()?;
// Verify with an externally-held program VK
let vk = PROGRAM.vk()?;
out.with_program_vk(&vk).verify()?;
ExecuteOutput
pub struct ExecuteOutput { /* ... */ }
Carries no proof — that's the whole point of execute. Adds only a
few execution statistics on top of the shared publics surface.
Statistics
| Method | Returns | Description |
|---|---|---|
get_execution_steps() | u64 | Number of guest steps executed. |
get_execution_cost() | Option<u64> | Aggregated execution cost (in cost units). None when the run had no cost weights (standalone execution). |
get_execution_time() | u64 | Execution time in milliseconds. |
get_executor_time() | &ZiskExecutorTime | Per-phase executor timing. |
get_random_seed() | Option<RandomSeed> | The host randomness seed the run used. Pass it to .random_seed() to reproduce the run. |
get_plan() | Option<&[PlanSummaryEntry]> | Per-AIR plan summary. Some in standalone mode and for remote runs. |
VerifyConstraintsOutput
pub struct VerifyConstraintsOutput { /* ... */ }
The constraint checker's per-run summary — not a proof object. If the constraints fail the underlying job errors out instead of returning an output, so receiving one of these means the constraints passed.
Statistics
| Method | Returns | Description |
|---|---|---|
get_execution_steps() | u64 | Number of guest steps executed. |
get_execution_total_cost() | u64 | Total cost across all constraint phases. |
get_executor_time() | &ZiskExecutorTime | Per-phase executor timing. |
get_execution_cost_per_type() | &StatsCostPerType | Per-component cost breakdown. |
get_duration() | u64 | Total constraint-check duration in milliseconds. |
get_random_seed() | Option<RandomSeed> | The host randomness seed the run used. |