base64_json/
base64_json.rs

1use clap::Parser;
2use eyre::Result;
3use openvm_benchmarks_prove::util::BenchmarkCli;
4use openvm_circuit::arch::instructions::exe::VmExe;
5use openvm_keccak256_circuit::Keccak256Rv32Config;
6use openvm_keccak256_transpiler::Keccak256TranspilerExtension;
7use openvm_rv32im_transpiler::{
8    Rv32ITranspilerExtension, Rv32IoTranspilerExtension, Rv32MTranspilerExtension,
9};
10use openvm_sdk::StdIn;
11use openvm_stark_sdk::{bench::run_with_metric_collection, p3_baby_bear::BabyBear};
12use openvm_transpiler::{transpiler::Transpiler, FromElf};
13
14fn main() -> Result<()> {
15    let args = BenchmarkCli::parse();
16
17    let elf = args.build_bench_program("base64_json")?;
18    let exe = VmExe::from_elf(
19        elf,
20        Transpiler::<BabyBear>::default()
21            .with_extension(Rv32ITranspilerExtension)
22            .with_extension(Rv32MTranspilerExtension)
23            .with_extension(Rv32IoTranspilerExtension)
24            .with_extension(Keccak256TranspilerExtension),
25    )?;
26
27    run_with_metric_collection("OUTPUT_PATH", || -> Result<()> {
28        let data = include_str!("../../../guest/base64_json/json_payload_encoded.txt");
29
30        let fe_bytes = data.to_owned().into_bytes();
31        args.bench_from_exe(
32            "base64_json",
33            Keccak256Rv32Config::default(),
34            exe,
35            StdIn::from_bytes(&fe_bytes),
36        )
37    })
38}