BaseHost

Trait BaseHost 

Source
pub trait BaseHost {
    // Required methods
    fn get_mast_forest(&self, node_digest: &Word) -> Option<Arc<MastForest>>;
    fn get_label_and_source_file(
        &self,
        location: &Location,
    ) -> (SourceSpan, Option<Arc<SourceFile>>);

    // Provided methods
    fn on_debug(
        &mut self,
        process: &mut ProcessState<'_>,
        options: &DebugOptions,
    ) -> Result<(), ExecutionError> { ... }
    fn on_trace(
        &mut self,
        process: &mut ProcessState<'_>,
        trace_id: u32,
    ) -> Result<(), ExecutionError> { ... }
    fn on_assert_failed(&mut self, _process: &ProcessState<'_>, _err_code: Felt) { ... }
}
Expand description

Defines the common interface between SyncHost and AsyncHost, by which the VM can interact with the host.

There are three main categories of interactions between the VM and the host:

  1. getting a library’s MAST forest,
  2. handling VM events (which can mutate the process’ advice provider), and
  3. handling debug and trace events.

Required Methods§

Source

fn get_mast_forest(&self, node_digest: &Word) -> Option<Arc<MastForest>>

Returns MAST forest corresponding to the specified digest, or None if the MAST forest for this digest could not be found in this host.

Source

fn get_label_and_source_file( &self, location: &Location, ) -> (SourceSpan, Option<Arc<SourceFile>>)

Returns the SourceSpan and optional SourceFile for the provided location.

Provided Methods§

Source

fn on_debug( &mut self, process: &mut ProcessState<'_>, options: &DebugOptions, ) -> Result<(), ExecutionError>

Handles the debug request from the VM.

Source

fn on_trace( &mut self, process: &mut ProcessState<'_>, trace_id: u32, ) -> Result<(), ExecutionError>

Handles the trace emitted from the VM.

Source

fn on_assert_failed(&mut self, _process: &ProcessState<'_>, _err_code: Felt)

Handles the failure of the assertion instruction.

Implementors§

Source§

impl<D, S> BaseHost for DefaultHost<D, S>