Skip to main content

ExecutableMastForest

Trait ExecutableMastForest 

Source
pub trait ExecutableMastForest {
    // Required methods
    fn get_node_by_id(&self, node_id: MastNodeId) -> Option<&MastNode>;
    fn get_digest_by_id(&self, node_id: MastNodeId) -> Option<Word>;
    fn find_procedure_root(&self, digest: Word) -> Option<MastNodeId>;
    fn advice_map(&self) -> &AdviceMap;
}
Expand description

A MAST forest that can be used as the source of nodes during program execution.

Implemented by both MastForest (a dense forest containing all nodes) and SparseMastForest (a sparse subset of a forest containing only the nodes visited during some prior execution). The latter preserves the original MastNodeIds of its source forest, which allows it to stand in for the dense forest during re-execution.

Required Methods§

Source

fn get_node_by_id(&self, node_id: MastNodeId) -> Option<&MastNode>

Returns the MastNode associated with the provided MastNodeId if present, or else None.

Source

fn get_digest_by_id(&self, node_id: MastNodeId) -> Option<Word>

Returns the digest of the node associated with the provided MastNodeId if present, or else None.

For dense forests this is equivalent to get_node_by_id(id).map(|n| n.digest()). For SparseMastForest, it additionally consults the digest-only entries — nodes that were referenced (but not entered) during execution and which were therefore stored as digest only. Use this method whenever only the digest of a referenced node is needed (e.g. when populating the hasher state of a parent’s trace row).

Source

fn find_procedure_root(&self, digest: Word) -> Option<MastNodeId>

Returns the MastNodeId of the procedure associated with a given digest, if any.

Source

fn advice_map(&self) -> &AdviceMap

Returns the advice map associated with this forest.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> ExecutableMastForest for Arc<T>

Implementors§