1
- use std:: { fs:: File , io:: Write , path:: Path , sync :: Arc } ;
1
+ use std:: { fs:: File , io:: Write , path:: Path } ;
2
2
3
3
use derive_new:: new;
4
+ use getset:: { Setters , WithSetters } ;
4
5
use openvm_instructions:: NATIVE_AS ;
5
6
use openvm_poseidon2_air:: Poseidon2Config ;
6
7
use openvm_stark_backend:: {
@@ -10,14 +11,11 @@ use openvm_stark_backend::{
10
11
} ;
11
12
use serde:: { de:: DeserializeOwned , Deserialize , Serialize } ;
12
13
13
- use super :: {
14
- segmentation_strategy:: { DefaultSegmentationStrategy , SegmentationStrategy } ,
15
- AnyEnum , VmChipComplex , PUBLIC_VALUES_AIR_ID ,
16
- } ;
14
+ use super :: { AnyEnum , VmChipComplex , PUBLIC_VALUES_AIR_ID } ;
17
15
use crate :: {
18
16
arch:: {
19
- AirInventory , AirInventoryError , Arena , ChipInventoryError , ExecutorInventory ,
20
- ExecutorInventoryError ,
17
+ execution_mode :: metered :: segment_ctx :: SegmentationLimits , AirInventory , AirInventoryError ,
18
+ Arena , ChipInventoryError , ExecutorInventory , ExecutorInventoryError ,
21
19
} ,
22
20
system:: {
23
21
memory:: { merkle:: public_values:: PUBLIC_VALUES_AS , num_memory_airs, CHUNK } ,
@@ -172,9 +170,10 @@ impl MemoryConfig {
172
170
173
171
/// System-level configuration for the virtual machine. Contains all configuration parameters that
174
172
/// are managed by the architecture, including configuration for continuations support.
175
- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
173
+ #[ derive( Debug , Clone , Serialize , Deserialize , Setters , WithSetters ) ]
176
174
pub struct SystemConfig {
177
175
/// The maximum constraint degree any chip is allowed to use.
176
+ #[ getset( set_with = "pub" ) ]
178
177
pub max_constraint_degree : usize ,
179
178
/// True if the VM is in continuation mode. In this mode, an execution could be segmented and
180
179
/// each segment is proved by a proof. Each proof commits the before and after state of the
@@ -195,15 +194,12 @@ pub struct SystemConfig {
195
194
/// Whether to collect detailed profiling metrics.
196
195
/// **Warning**: this slows down the runtime.
197
196
pub profiling : bool ,
198
- /// Segmentation strategy
197
+ /// Segmentation limits
199
198
/// This field is skipped in serde as it's only used in execution and
200
199
/// not needed after any serialize/deserialize.
201
- #[ serde( skip, default = "get_default_segmentation_strategy" ) ]
202
- pub segmentation_strategy : Arc < dyn SegmentationStrategy > ,
203
- }
204
-
205
- pub fn get_default_segmentation_strategy ( ) -> Arc < DefaultSegmentationStrategy > {
206
- Arc :: new ( DefaultSegmentationStrategy :: default ( ) )
200
+ #[ serde( skip, default = "SegmentationLimits::default" ) ]
201
+ #[ getset( set = "pub" ) ]
202
+ pub segmentation_limits : SegmentationLimits ,
207
203
}
208
204
209
205
impl SystemConfig {
@@ -212,7 +208,6 @@ impl SystemConfig {
212
208
mut memory_config : MemoryConfig ,
213
209
num_public_values : usize ,
214
210
) -> Self {
215
- let segmentation_strategy = get_default_segmentation_strategy ( ) ;
216
211
assert ! (
217
212
memory_config. clk_max_bits <= 29 ,
218
213
"Timestamp max bits must be <= 29 for LessThan to work in 31-bit field"
@@ -223,8 +218,8 @@ impl SystemConfig {
223
218
continuation_enabled : false ,
224
219
memory_config,
225
220
num_public_values,
226
- segmentation_strategy,
227
221
profiling : false ,
222
+ segmentation_limits : SegmentationLimits :: default ( ) ,
228
223
}
229
224
}
230
225
@@ -236,11 +231,6 @@ impl SystemConfig {
236
231
)
237
232
}
238
233
239
- pub fn with_max_constraint_degree ( mut self , max_constraint_degree : usize ) -> Self {
240
- self . max_constraint_degree = max_constraint_degree;
241
- self
242
- }
243
-
244
234
pub fn with_continuations ( mut self ) -> Self {
245
235
self . continuation_enabled = true ;
246
236
self
@@ -258,16 +248,10 @@ impl SystemConfig {
258
248
}
259
249
260
250
pub fn with_max_segment_len ( mut self , max_segment_len : usize ) -> Self {
261
- self . segmentation_strategy = Arc :: new (
262
- DefaultSegmentationStrategy :: new_with_max_segment_len ( max_segment_len) ,
263
- ) ;
251
+ self . segmentation_limits . max_trace_height = max_segment_len as u32 ;
264
252
self
265
253
}
266
254
267
- pub fn set_segmentation_strategy ( & mut self , strategy : Arc < dyn SegmentationStrategy > ) {
268
- self . segmentation_strategy = strategy;
269
- }
270
-
271
255
pub fn with_profiling ( mut self ) -> Self {
272
256
self . profiling = true ;
273
257
self
0 commit comments