Struct MemAdviceProvider

Source
pub struct MemAdviceProvider { /* private fields */ }
Expand description

An in-memory [AdviceProvider] implementation which uses BTreeMaps as its backing storage.

Implementations§

Source§

impl MemAdviceProvider

Source

pub fn into_parts( self, ) -> (Vec<Felt>, BTreeMap<RpoDigest, Vec<Felt>>, MerkleStore)

Consumes the MemAdviceProvider and returns a (Vec<Felt>, SimpleAdviceMap, MerkleStore), containing the stack, map, store respectively, of the advice provider.

Trait Implementations§

Source§

impl AdviceProvider for MemAdviceProvider

Pass-through implementations of AdviceProvider methods.

TODO: potentially do this via a macro.

Source§

fn pop_stack( &mut self, process: ProcessState<'_>, ) -> Result<Felt, ExecutionError>

Pops an element from the advice stack and returns it. Read more
Source§

fn pop_stack_word( &mut self, process: ProcessState<'_>, ) -> Result<Word, ExecutionError>

Pops a word (4 elements) from the advice stack and returns it. Read more
Source§

fn pop_stack_dword( &mut self, process: ProcessState<'_>, ) -> Result<[Word; 2], ExecutionError>

Pops a double word (8 elements) from the advice stack and returns them. Read more
Source§

fn push_stack(&mut self, source: AdviceSource) -> Result<(), ExecutionError>

Pushes the value(s) specified by the source onto the advice stack. Read more
Source§

fn insert_into_map(&mut self, key: Word, values: Vec<Felt>)

Inserts the provided value into the advice map under the specified key. Read more
Source§

fn get_mapped_values(&self, key: &RpoDigest) -> Option<&[Felt]>

Returns a reference to the value(s) associated with the specified key in the advice map.
Source§

fn get_tree_node( &self, root: Word, depth: &Felt, index: &Felt, ) -> Result<Word, ExecutionError>

Returns a node at the specified depth and index in a Merkle tree with the given root. Read more
Source§

fn get_merkle_path( &self, root: Word, depth: &Felt, index: &Felt, ) -> Result<MerklePath, ExecutionError>

Returns a path to a node at the specified depth and index in a Merkle tree with the specified root. Read more
Source§

fn get_leaf_depth( &self, root: Word, tree_depth: &Felt, index: &Felt, ) -> Result<u8, ExecutionError>

Reconstructs a path from the root until a leaf or empty node and returns its depth. Read more
Source§

fn update_merkle_node( &mut self, root: Word, depth: &Felt, index: &Felt, value: Word, ) -> Result<(MerklePath, Word), ExecutionError>

Updates a node at the specified depth and index in a Merkle tree with the specified root; returns the Merkle path from the updated node to the new root, together with the new root. Read more
Source§

fn merge_roots(&mut self, lhs: Word, rhs: Word) -> Result<Word, ExecutionError>

Creates a new Merkle tree in the advice provider by combining Merkle trees with the specified roots. The root of the new tree is defined as hash(left_root, right_root). Read more
Source§

impl Clone for MemAdviceProvider

Source§

fn clone(&self) -> MemAdviceProvider

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemAdviceProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemAdviceProvider

Source§

fn default() -> MemAdviceProvider

Returns the “default value” for a type. Read more
Source§

impl From<AdviceInputs> for MemAdviceProvider

Source§

fn from(inputs: AdviceInputs) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more