use alloc::{sync::Arc, vec, vec::Vec};
use miden_processor::{
ProcessorState,
advice::AdviceMutation,
event::{EventError, EventHandler, EventName},
};
pub const READONLY_MIDEN_DEBUG_FRAME_START: EventName =
EventName::new("readonly::miden_debug::frame_start");
pub const READONLY_MIDEN_DEBUG_FRAME_END: EventName =
EventName::new("readonly::miden_debug::frame_end");
pub const READONLY_MIDEN_DEBUG_ASSERTION_FAILED: EventName =
EventName::new("readonly::miden_debug::assertion_failed");
pub const READONLY_MIDEN_DEBUG_UNKNOWN: EventName =
EventName::new("readonly::miden_debug::unknown");
pub const READONLY_MIDEN_DEBUG_PRINTLN: EventName =
EventName::new("readonly::miden_debug::println");
struct ReadonlyNoopHandler;
impl EventHandler for ReadonlyNoopHandler {
fn on_event(&self, _process: &ProcessorState) -> Result<Vec<AdviceMutation>, EventError> {
Ok(vec![])
}
}
pub fn readonly_noop_handlers() -> Vec<(EventName, Arc<dyn EventHandler>)> {
let handler: Arc<dyn EventHandler> = Arc::new(ReadonlyNoopHandler);
vec![
(READONLY_MIDEN_DEBUG_FRAME_START, handler.clone()),
(READONLY_MIDEN_DEBUG_FRAME_END, handler.clone()),
(READONLY_MIDEN_DEBUG_ASSERTION_FAILED, handler.clone()),
(READONLY_MIDEN_DEBUG_UNKNOWN, handler.clone()),
(READONLY_MIDEN_DEBUG_PRINTLN, handler),
]
}