1use clap::Args;
2use openvm_sdk_config::SdkVmConfig;
3use openvm_stark_backend::SystemParams;
4use openvm_stark_sdk::config::{
5 app_params_with_100_bits_security, internal_params_with_100_bits_security,
6 leaf_params_with_100_bits_security, MAX_APP_LOG_STACKED_HEIGHT,
7};
8pub use openvm_stark_sdk::config::{
9 DEFAULT_APP_LOG_BLOWUP, DEFAULT_APP_L_SKIP, DEFAULT_INTERNAL_LOG_BLOWUP,
10 DEFAULT_LEAF_LOG_BLOWUP, DEFAULT_ROOT_LOG_BLOWUP,
11};
12use serde::{Deserialize, Serialize};
13
14pub const MAX_NUM_CHILDREN_LEAF: usize = 4;
20pub const MAX_NUM_CHILDREN_INTERNAL: usize = 3;
21
22fn default_system_params() -> SystemParams {
23 app_params_with_100_bits_security(MAX_APP_LOG_STACKED_HEIGHT)
24}
25
26#[derive(Clone, Debug, Serialize, Deserialize, derive_new::new)]
27pub struct AppConfig<VC> {
28 pub app_vm_config: VC,
29 #[serde(default = "default_system_params")]
30 pub system_params: SystemParams,
31}
32
33impl AppConfig<SdkVmConfig> {
34 pub fn standard(params: SystemParams) -> Self {
35 Self::new(SdkVmConfig::standard(), params)
36 }
37
38 pub fn riscv32(params: SystemParams) -> Self {
39 Self::new(SdkVmConfig::riscv32(), params)
40 }
41}
42
43#[derive(Clone, Debug, Default, Serialize, Deserialize)]
44pub struct AggregationConfig {
45 pub params: AggregationSystemParams,
46}
47
48#[derive(Clone, Debug, Serialize, Deserialize)]
49pub struct AggregationSystemParams {
50 pub leaf: SystemParams,
51 pub internal: SystemParams,
52}
53
54impl Default for AggregationSystemParams {
55 fn default() -> Self {
56 Self {
57 leaf: leaf_params_with_100_bits_security(),
58 internal: internal_params_with_100_bits_security(),
59 }
60 }
61}
62
63#[derive(Clone, Copy, Debug, Serialize, Deserialize, Args)]
64pub struct AggregationTreeConfig {
65 #[arg(
67 long,
68 default_value_t = MAX_NUM_CHILDREN_LEAF,
69 help = "Number of children per leaf verifier circuit",
70 help_heading = "Aggregation Tree Options"
71 )]
72 pub num_children_leaf: usize,
73 #[arg(
76 long,
77 default_value_t = MAX_NUM_CHILDREN_INTERNAL,
78 help = "Number of children per internal verifier circuit",
79 help_heading = "Aggregation Tree Options"
80 )]
81 pub num_children_internal: usize,
82}
83
84impl Default for AggregationTreeConfig {
85 fn default() -> Self {
86 Self {
87 num_children_leaf: MAX_NUM_CHILDREN_LEAF,
88 num_children_internal: MAX_NUM_CHILDREN_INTERNAL,
89 }
90 }
91}
92
93impl AggregationTreeConfig {
94 pub const fn deferral() -> Self {
95 Self {
96 num_children_leaf: 2,
97 num_children_internal: 2,
98 }
99 }
100}
101
102#[cfg(feature = "evm-prove")]
104#[derive(Clone, Debug, Serialize, Deserialize)]
105pub struct Halo2Config {
106 pub wrapper_k: Option<usize>,
110 pub profiling: bool,
112}