Skip to content

Commit

Permalink
Update smoke-test to latest API (#1345)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaub committed Jan 18, 2024
1 parent 1742ef8 commit a4d2b5d
Showing 1 changed file with 4 additions and 51 deletions.
55 changes: 4 additions & 51 deletions tools/smoke-test/src/main.rs
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

use methods::{GUEST_ELF, GUEST_ID};
use risc0_zkvm::{ApiClient, AssetRequest, Binary, ExecutorEnv, InnerReceipt, ProverOpts, Receipt};
use risc0_zkvm::{default_prover, ExecutorEnv};

fn main() {
let segment_limit_po2 = 16; // 64k cycles
Expand All @@ -24,55 +24,8 @@ fn main() {
.segment_limit_po2(segment_limit_po2)
.build()
.unwrap();
let binary = Binary::new_elf_inline(GUEST_ELF.into());

let client = ApiClient::from_env().unwrap();
let mut segments = Vec::new();
let session = client
.execute(&env, binary, AssetRequest::Inline, |_info, asset| {
segments.push(asset);
Ok(())
})
.unwrap();

println!("Segments: {}", segments.len());

let opts = ProverOpts::default();
let rollup = segments
.iter()
.map(|segment| {
let receipt = client
.prove_segment(opts.clone(), segment.clone(), AssetRequest::Inline)
.unwrap();
client
.lift(
opts.clone(),
receipt.try_into().unwrap(),
AssetRequest::Inline,
)
.unwrap()
})
.reduce(|left, right| {
client
.join(
opts.clone(),
left.try_into().unwrap(),
right.try_into().unwrap(),
AssetRequest::Inline,
)
.unwrap()
})
.unwrap();

// TODO: call verify on this receipt
client
.identity_p254(
opts,
rollup.clone().try_into().unwrap(),
AssetRequest::Inline,
)
.unwrap();

let final_receipt = Receipt::new(InnerReceipt::Succinct(rollup), session.journal.bytes.into());
final_receipt.verify(GUEST_ID).unwrap();
let prover = default_prover();
let receipt = prover.prove(env, GUEST_ELF).unwrap();
receipt.verify(GUEST_ID).unwrap();
}

0 comments on commit a4d2b5d

Please sign in to comment.