2024-09-25 13:29:59 +03:00

27 lines
882 B
Rust

// These two lines are necessary for the program to properly compile.
//
// Under the hood, we wrap your main function with some extra code so that it behaves properly
// inside the zkVM.
#![no_main]
sp1_zkvm::entrypoint!(main);
use alloy_sol_types::SolType;
use simple_arithmetic_test_lib::{hept, PublicValuesStruct};
pub fn main() {
// Read an input to the program.
//
// Behind the scenes, this compiles down to a custom system call which handles reading inputs
// from the prover.
let n = sp1_zkvm::io::read::<u32>();
let (a, b) = hept(n);
// Encode the public values of the program.
let bytes = PublicValuesStruct::abi_encode(&PublicValuesStruct { n, a, b });
// Commit to the public values of the program. The final proof will have a commitment to all the
// bytes that were committed to.
sp1_zkvm::io::commit_slice(&bytes);
}