use std::sync::Arc; use processor::{ AdviceExtractor, AdviceProvider, ExecutionError, Host, HostResponse, MastForest, MemAdviceProvider, ProcessState, }; use vm_core::{AdviceInjector, DebugOptions}; mod advice; mod asmop; mod events; // TEST HOST // ================================================================================================ pub struct TestHost { pub adv_provider: A, pub event_handler: Vec, pub trace_handler: Vec, pub debug_handler: Vec, } impl Default for TestHost { fn default() -> Self { Self { adv_provider: MemAdviceProvider::default(), event_handler: Vec::new(), trace_handler: Vec::new(), debug_handler: Vec::new(), } } } impl Host for TestHost { fn get_advice( &mut self, process: &S, extractor: AdviceExtractor, ) -> Result { self.adv_provider.get_advice(process, &extractor) } fn set_advice( &mut self, process: &S, injector: AdviceInjector, ) -> Result { self.adv_provider.set_advice(process, &injector) } fn on_event( &mut self, _process: &S, event_id: u32, ) -> Result { self.event_handler.push(event_id); Ok(HostResponse::None) } fn on_trace( &mut self, _process: &S, trace_id: u32, ) -> Result { self.trace_handler.push(trace_id); Ok(HostResponse::None) } fn on_debug( &mut self, _process: &S, _options: &DebugOptions, ) -> Result { self.debug_handler.push(_options.to_string()); Ok(HostResponse::None) } fn get_mast_forest(&self, _node_digest: &prover::Digest) -> Option> { // Empty MAST forest store None } }