openvm_circuit/arch/execution_mode/
mod.rs1use crate::{arch::VmExecState, system::memory::online::GuestMemory};
2
3pub mod metered;
4pub mod metered_cost;
5mod preflight;
6mod pure;
7
8pub use metered::{ctx::MeteredCtx, segment_ctx::Segment};
9pub use metered_cost::MeteredCostCtx;
10pub use preflight::PreflightCtx;
11pub use pure::ExecutionCtx;
12
13pub trait ExecutionCtxTrait: Sized {
14 fn on_memory_operation(&mut self, address_space: u32, ptr: u32, size: u32);
15
16 fn should_suspend<F>(exec_state: &mut VmExecState<F, GuestMemory, Self>) -> bool;
17
18 fn on_terminate<F>(_exec_state: &mut VmExecState<F, GuestMemory, Self>) {}
19}
20
21pub trait MeteredExecutionCtxTrait: ExecutionCtxTrait {
22 fn on_height_change(&mut self, chip_idx: usize, height_delta: u32);
23}