sp1_core_executor/estimator.rs
1//! Data that may be collected during execution and used to estimate trace area.
2
3use enum_map::EnumMap;
4use range_set_blaze::RangeSetBlaze;
5
6use crate::RiscvAirId;
7
8/// Data accumulated during execution to estimate the core trace area used to prove the execution.
9#[derive(Clone, Debug, Default)]
10pub struct RecordEstimator {
11 /// Core shards, represented by the number of events per AIR.
12 pub core_records: Vec<EnumMap<RiscvAirId, u64>>,
13 /// For each precompile AIR, a list of estimated records in the form
14 /// `(<number of precompile events>, <number of local memory events>)`.
15 pub precompile_records: EnumMap<RiscvAirId, Vec<(u64, u64)>>,
16 /// Number of memory global init events for the whole program.
17 pub memory_global_init_events: u64,
18 /// Number of memory global finalize events for the whole program.
19 pub memory_global_finalize_events: u64,
20 /// Addresses touched in this shard by the main executor.
21 /// Used to calculate local memory events.
22 pub current_touched_compressed_addresses: RangeSetBlaze<u32>,
23 /// Addresses touched in this shard by the current precompile execution.
24 /// Used to calculate local memory events.
25 pub current_precompile_touched_compressed_addresses: RangeSetBlaze<u32>,
26 /// More correct number of local memory events for the current shard.
27 pub current_local_mem: usize,
28}