aboutsummaryrefslogtreecommitdiff
path: root/zkvms/jolt/host/src/main.rs
blob: fee201fd8d8a7c463aab62c0c76d6da1ae43dd36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use zkvms_host_io::{read_args, RunType::{ Execute, Prove, Verify }};

type Input = (Vec<Vec<bool>>, u32, Vec<Vec<u32>>);

pub fn main() {
    let run_info = read_args();
    if run_info.run_type == Execute {
        panic!("Execution is not supported!");
    }

    let elf_path = std::env::var("ELF_PATH").expect("ELF PATH is missing");
    let (prove_guest, verify_guest) = guest::guest_closures(elf_path);

    match run_info.run_type {
        Execute => unreachable!(),
        Prove => {
            let (output, _) = prove_guest(run_info.input.into());
            println!("Prove output: {}", output);
        },
        Verify => {
            let (_, proof) = prove_guest(run_info.input.into());
            let is_valid = verify_guest(proof);
            println!("Verify is valid: {}", is_valid);
        },
    }
}