forked from openvm-org/openvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase64_json.rs
68 lines (63 loc) · 2.63 KB
/
base64_json.rs
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#![allow(unused_variables)]
#![allow(unused_imports)]
use clap::Parser;
use eyre::Result;
use openvm_benchmarks::utils::{bench_from_exe, build_bench_program, BenchmarkCli};
use openvm_circuit::arch::instructions::{exe::VmExe, program::DEFAULT_MAX_NUM_PUBLIC_VALUES};
use openvm_keccak256_circuit::Keccak256Rv32Config;
use openvm_keccak256_transpiler::Keccak256TranspilerExtension;
use openvm_native_circuit::NativeConfig;
use openvm_native_compiler::conversion::CompilerOptions;
use openvm_native_recursion::testing_utils::inner::build_verification_program;
use openvm_rv32im_transpiler::{
Rv32ITranspilerExtension, Rv32IoTranspilerExtension, Rv32MTranspilerExtension,
};
use openvm_sdk::{config::AppConfig, keygen::leaf_keygen, prover::AggStarkProver, StdIn};
use openvm_stark_backend::{config::Com, p3_field::AbstractField};
use openvm_stark_sdk::{
bench::run_with_metric_collection,
config::{baby_bear_poseidon2::BabyBearPoseidon2Engine, FriParameters},
engine::StarkFriEngine,
p3_baby_bear::BabyBear,
};
use openvm_transpiler::{transpiler::Transpiler, FromElf};
use tracing::info_span;
fn main() -> Result<()> {
let cli_args = BenchmarkCli::parse();
let app_log_blowup = cli_args.app_log_blowup.unwrap_or(2);
let agg_log_blowup = cli_args.agg_log_blowup.unwrap_or(2);
let elf = build_bench_program("base64_json")?;
let exe = VmExe::from_elf(
elf,
Transpiler::<BabyBear>::default()
.with_extension(Rv32ITranspilerExtension)
.with_extension(Rv32MTranspilerExtension)
.with_extension(Rv32IoTranspilerExtension)
.with_extension(Keccak256TranspilerExtension),
)?;
let app_config = AppConfig {
app_fri_params: FriParameters::standard_with_100_bits_conjectured_security(app_log_blowup)
.into(),
app_vm_config: Keccak256Rv32Config::default(),
leaf_fri_params: FriParameters::standard_with_100_bits_conjectured_security(agg_log_blowup)
.into(),
compiler_options: CompilerOptions::default(),
};
run_with_metric_collection("OUTPUT_PATH", || -> Result<()> {
info_span!("Base64 Json Program").in_scope(|| {
let data = include_str!("../../programs/base64_json/json_payload_encoded.txt");
let fe_bytes = data.to_owned().into_bytes();
bench_from_exe(
"base64_json_program",
app_config,
exe,
StdIn::from_bytes(&fe_bytes),
#[cfg(feature = "aggregation")]
true,
#[cfg(not(feature = "aggregation"))]
false,
)
})?;
Ok(())
})
}