Struct miden_processor::ProgramInputs
source · pub struct ProgramInputs { /* private fields */ }
Expand description
Input container for Miden VM programs.
Miden VM programs can receive inputs in two ways:
- The stack can be initialized to some set of values at the beginning of the program. These inputs are public and must be shared with the verifier for them to verify a proof of the correct execution of a Miden program. There is no limit to the number of elements at the top of the stack which can receive an initial value.
- The program may request nondeterministic advice inputs from the prover. These inputs are secret inputs. This means that the prover does not need to share them with the verifier. There are two types of advice inputs: (1) a single advice tape which can contain any number of elements and (2) a list of advice sets, which are used to provide nondeterministic inputs for instructions which work with Merkle trees.
TODO: add more detailed explanation.
Implementations
sourceimpl ProgramInputs
impl ProgramInputs
sourcepub fn new(
stack_init: &[u64],
advice_tape: &[u64],
advice_sets: Vec<AdviceSet, Global>
) -> Result<ProgramInputs, InputError>
pub fn new(
stack_init: &[u64],
advice_tape: &[u64],
advice_sets: Vec<AdviceSet, Global>
) -> Result<ProgramInputs, InputError>
Returns ProgramInputs instantiated with the specified initial stack values, advice tape values, and advice sets.
The initial stack values are put onto the stack in the order as if they were pushed onto
the stack one by one. The result of this is that the last value in the stack_init
slice
will end up at the top of the stack.
Errors
Returns an error if:
- The number initial stack values is greater than 16.
- Any of the initial stack values or the advice tape values are not valid field elements.
- Any of the advice sets have the same root.
sourcepub fn with_advice_map(
stack_init: &[u64],
advice_tape: &[u64],
advice_map: BTreeMap<[u8; 32], Vec<BaseElement, Global>, Global>,
advice_sets: Vec<AdviceSet, Global>
) -> Result<ProgramInputs, InputError>
pub fn with_advice_map(
stack_init: &[u64],
advice_tape: &[u64],
advice_map: BTreeMap<[u8; 32], Vec<BaseElement, Global>, Global>,
advice_sets: Vec<AdviceSet, Global>
) -> Result<ProgramInputs, InputError>
Returns ProgramInputs instantiated with the specified initial stack values, advice tape, key-value advice map, and advice sets.
The initial stack values are put onto the stack in the order as if they were pushed onto
the stack one by one. The result of this is that the last value in the stack_init
slice
will end up at the top of the stack.
Errors
Returns an error if:
- The number initial stack values is greater than 16.
- Any of the initial stack values or the advice tape values are not valid field elements.
- Any of the advice sets have the same root.
sourcepub fn from_stack_inputs(
stack_init: &[u64]
) -> Result<ProgramInputs, InputError>
pub fn from_stack_inputs(
stack_init: &[u64]
) -> Result<ProgramInputs, InputError>
Returns ProgramInputs initialized with stack inputs only.
The provided inputs are pushed onto the stack one after the other. Thus, the first
element in the stack_init
list will be the deepest in the stack.
Advice tape and advice sets for the returned inputs are blank.
Errors
Returns an error if:
- The number initial stack values is greater than 16.
- Any of the initial stack values is not valid field elements.
sourcepub fn none() -> ProgramInputs
pub fn none() -> ProgramInputs
Returns ProgramInputs with no input values.
sourcepub fn stack_init(&self) -> &[BaseElement]
pub fn stack_init(&self) -> &[BaseElement]
Returns a reference to the initial stack values.
sourcepub fn advice_tape(&self) -> &[BaseElement]
pub fn advice_tape(&self) -> &[BaseElement]
Returns a reference to the advice tape.
Trait Implementations
sourceimpl Clone for ProgramInputs
impl Clone for ProgramInputs
sourcefn clone(&self) -> ProgramInputs
fn clone(&self) -> ProgramInputs
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more