Struct miden_processor::RecAdviceProvider
source · pub struct RecAdviceProvider { /* private fields */ }
Expand description
An in-memory [AdviceProvider]
implementation with support for data access recording.
The recorder can be converted into a proof which can be used to provide the non-deterministic inputs for program execution.
Implementations§
source§impl RecAdviceProvider
impl RecAdviceProvider
sourcepub fn finalize(
self
) -> (AdviceInputs, Vec<Felt>, BTreeMap<RpoDigest, Vec<Felt>>, MerkleStore)
pub fn finalize( self ) -> (AdviceInputs, Vec<Felt>, BTreeMap<RpoDigest, Vec<Felt>>, MerkleStore)
Consumes the advice provider and returns an (AdviceInputs, Vec
The AdviceInputs can be used to re-execute the program. The returned AdviceInputs instance will contain only the non-deterministic inputs which were requested during program execution.
The Vec
Trait Implementations§
source§impl AdviceProvider for RecAdviceProvider
impl AdviceProvider for RecAdviceProvider
Pass-through implementations of AdviceProvider methods.
TODO: potentially do this via a macro.
source§fn pop_stack<S: ProcessState>(
&mut self,
process: &S
) -> Result<Felt, ExecutionError>
fn pop_stack<S: ProcessState>( &mut self, process: &S ) -> Result<Felt, ExecutionError>
Pops an element from the advice stack and returns it. Read more
source§fn pop_stack_word<S: ProcessState>(
&mut self,
process: &S
) -> Result<Word, ExecutionError>
fn pop_stack_word<S: ProcessState>( &mut self, process: &S ) -> Result<Word, ExecutionError>
Pops a word (4 elements) from the advice stack and returns it. Read more
source§fn pop_stack_dword<S: ProcessState>(
&mut self,
process: &S
) -> Result<[Word; 2], ExecutionError>
fn pop_stack_dword<S: ProcessState>( &mut self, process: &S ) -> 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>
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>
) -> Result<(), ExecutionError>
fn insert_into_map( &mut self, key: Word, values: Vec<Felt> ) -> Result<(), ExecutionError>
Inserts the provided value into the advice map under the specified key. Read more
source§fn get_signature(
&self,
kind: SignatureKind,
pub_key: Word,
msg: Word
) -> Result<Vec<Felt>, ExecutionError>
fn get_signature( &self, kind: SignatureKind, pub_key: Word, msg: Word ) -> Result<Vec<Felt>, ExecutionError>
Returns a signature on a message using a public key.
source§fn get_mapped_values(&self, key: &RpoDigest) -> Option<&[Felt]>
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>
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>
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>
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>
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>
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 moresource§fn get_store_subset<I, R>(&self, roots: I) -> MerkleStore
fn get_store_subset<I, R>(&self, roots: I) -> MerkleStore
Returns a subset of this Merkle store such that the returned Merkle store contains all
nodes which are descendants of the specified roots. Read more
source§fn set_advice<S: ProcessState>(
&mut self,
process: &S,
advice_injector: &AdviceInjector
) -> Result<HostResponse, ExecutionError>
fn set_advice<S: ProcessState>( &mut self, process: &S, advice_injector: &AdviceInjector ) -> Result<HostResponse, ExecutionError>
Handles the specified advice injector request.
source§fn get_advice<S: ProcessState>(
&mut self,
process: &S,
advice_extractor: &AdviceExtractor
) -> Result<HostResponse, ExecutionError>
fn get_advice<S: ProcessState>( &mut self, process: &S, advice_extractor: &AdviceExtractor ) -> Result<HostResponse, ExecutionError>
Handles the specified advice extractor request.
source§fn insert_mem_values_into_adv_map<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn insert_mem_values_into_adv_map<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Reads words from memory at the specified range and inserts them into the advice map under
the key
KEY
located at the top of the stack. Read moresource§fn insert_hdword_into_adv_map<S: ProcessState>(
&mut self,
process: &S,
domain: Felt
) -> Result<HostResponse, ExecutionError>
fn insert_hdword_into_adv_map<S: ProcessState>( &mut self, process: &S, domain: Felt ) -> Result<HostResponse, ExecutionError>
Reads two word from the operand stack and inserts them into the advice map under the key
defined by the hash of these words. Read more
source§fn insert_hperm_into_adv_map<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn insert_hperm_into_adv_map<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Reads three words from the operand stack and inserts the top two words into the advice map
under the key defined by applying an RPO permutation to all three words. Read more
source§fn merge_merkle_nodes<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn merge_merkle_nodes<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, 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 moresource§fn copy_merkle_node_to_adv_stack<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn copy_merkle_node_to_adv_stack<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Pushes a node of the Merkle tree specified by the values on the top of the operand stack
onto the advice stack. Read more
source§fn copy_map_value_to_adv_stack<S: ProcessState>(
&mut self,
process: &S,
include_len: bool,
key_offset: usize
) -> Result<HostResponse, ExecutionError>
fn copy_map_value_to_adv_stack<S: ProcessState>( &mut self, process: &S, include_len: bool, key_offset: usize ) -> Result<HostResponse, ExecutionError>
Pushes a list of field elements onto the advice stack. The list is looked up in the advice
map using the specified word from the operand stack as the key. If
include_len
is set to
true, the number of elements in the value is also pushed onto the advice stack. Read moresource§fn push_u64_div_result<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_u64_div_result<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
source§fn push_ext2_inv_result<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_ext2_inv_result<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Given an element in a quadratic extension field on the top of the stack (i.e., a0, b1),
computes its multiplicative inverse and push the result onto the advice stack. Read more
source§fn push_ext2_intt_result<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_ext2_intt_result<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Given evaluations of a polynomial over some specified domain, interpolates the evaluations
into a polynomial in coefficient form and pushes the result into the advice stack. Read more
source§fn push_signature<S: ProcessState>(
&mut self,
process: &S,
kind: SignatureKind
) -> Result<HostResponse, ExecutionError>
fn push_signature<S: ProcessState>( &mut self, process: &S, kind: SignatureKind ) -> Result<HostResponse, ExecutionError>
Pushes values onto the advice stack which are required for verification of a DSA in Miden VM. Read more
source§fn push_leading_zeros<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_leading_zeros<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Pushes the number of the leading zeros of the top stack element onto the advice stack. Read more
source§fn push_trailing_zeros<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_trailing_zeros<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Pushes the number of the trailing zeros of the top stack element onto the advice stack. Read more
source§fn push_leading_ones<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_leading_ones<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Pushes the number of the leading ones of the top stack element onto the advice stack. Read more
source§fn push_trailing_ones<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_trailing_ones<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Pushes the number of the trailing ones of the top stack element onto the advice stack. Read more
source§fn push_ilog2<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_ilog2<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Pushes the base 2 logarithm of the top stack element, rounded down.
Inputs:
Operand stack: [n, …]
Advice stack: […] Read more
source§fn update_operand_stack_merkle_node<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn update_operand_stack_merkle_node<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Updates the node of a Merkle tree specified by the values on the top of the operand stack.
Returns the path from the updated node to the new root of the tree to the caller. Read more
source§fn get_operand_stack_merkle_path<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn get_operand_stack_merkle_path<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Extracts a Merkle path for the node specified by the values at the top of the operand stack
and returns it to the caller. Read more
source§fn push_smtpeek_result<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_smtpeek_result<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Pushes onto the advice stack the value associated with the specified key in a Sparse
Merkle Tree defined by the specified root. Read more
source§fn push_smtget_inputs<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_smtget_inputs<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Currently unimplemented
source§fn push_smtset_inputs<S: ProcessState>(
&mut self,
process: &S
) -> Result<HostResponse, ExecutionError>
fn push_smtset_inputs<S: ProcessState>( &mut self, process: &S ) -> Result<HostResponse, ExecutionError>
Currently unimplemented
source§impl Clone for RecAdviceProvider
impl Clone for RecAdviceProvider
source§fn clone(&self) -> RecAdviceProvider
fn clone(&self) -> RecAdviceProvider
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RecAdviceProvider
impl Debug for RecAdviceProvider
source§impl Default for RecAdviceProvider
impl Default for RecAdviceProvider
source§fn default() -> RecAdviceProvider
fn default() -> RecAdviceProvider
Returns the “default value” for a type. Read more
source§impl From<AdviceInputs> for RecAdviceProvider
impl From<AdviceInputs> for RecAdviceProvider
source§fn from(inputs: AdviceInputs) -> Self
fn from(inputs: AdviceInputs) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for RecAdviceProvider
impl !RefUnwindSafe for RecAdviceProvider
impl Send for RecAdviceProvider
impl !Sync for RecAdviceProvider
impl Unpin for RecAdviceProvider
impl UnwindSafe for RecAdviceProvider
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more