Struct snarkvm_compiler::Stack
source · [−]pub struct Stack<N: Network> { /* private fields */ }
Implementations
sourceimpl<N: Network> Stack<N>
impl<N: Network> Stack<N>
sourcepub fn deploy<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
rng: &mut R
) -> Result<Deployment<N>>
pub fn deploy<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
rng: &mut R
) -> Result<Deployment<N>>
Deploys the given program ID, if it does not exist.
sourcepub fn verify_deployment<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
deployment: &Deployment<N>,
rng: &mut R
) -> Result<()>
pub fn verify_deployment<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
deployment: &Deployment<N>,
rng: &mut R
) -> Result<()>
Checks each function in the program on the given verifying key and certificate.
sourceimpl<N: Network> Stack<N>
impl<N: Network> Stack<N>
sourcepub fn evaluate_closure<A: Aleo<Network = N>>(
&self,
closure: &Closure<N>,
inputs: &[Value<N>],
call_stack: CallStack<N>,
caller: Address<N>,
tvk: Field<N>
) -> Result<Vec<Value<N>>>
pub fn evaluate_closure<A: Aleo<Network = N>>(
&self,
closure: &Closure<N>,
inputs: &[Value<N>],
call_stack: CallStack<N>,
caller: Address<N>,
tvk: Field<N>
) -> Result<Vec<Value<N>>>
Evaluates a program closure on the given inputs.
Errors
This method will halt if the given inputs are not the same length as the input statements.
sourcepub fn evaluate_function<A: Aleo<Network = N>>(
&self,
call_stack: CallStack<N>
) -> Result<Response<N>>
pub fn evaluate_function<A: Aleo<Network = N>>(
&self,
call_stack: CallStack<N>
) -> Result<Response<N>>
Evaluates a program function on the given inputs.
Errors
This method will halt if the given inputs are not the same length as the input statements.
sourceimpl<N: Network> Stack<N>
impl<N: Network> Stack<N>
sourcepub fn execute_closure<A: Aleo<Network = N>>(
&self,
closure: &Closure<N>,
inputs: &[Value<A>],
call_stack: CallStack<N>,
caller: Address<A>,
tvk: Field<A>
) -> Result<Vec<Value<A>>>
pub fn execute_closure<A: Aleo<Network = N>>(
&self,
closure: &Closure<N>,
inputs: &[Value<A>],
call_stack: CallStack<N>,
caller: Address<A>,
tvk: Field<A>
) -> Result<Vec<Value<A>>>
Executes a program closure on the given inputs.
Errors
This method will halt if the given inputs are not the same length as the input statements.
sourcepub fn execute_function<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
call_stack: CallStack<N>,
rng: &mut R
) -> Result<Response<N>>
pub fn execute_function<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
call_stack: CallStack<N>,
rng: &mut R
) -> Result<Response<N>>
Executes a program function on the given inputs.
Note: To execute a transition, do not call this method. Instead, call Process::execute
.
Errors
This method will halt if the given inputs are not the same length as the input statements.
sourceimpl<N: Network> Stack<N>
impl<N: Network> Stack<N>
sourcepub fn matches_value_type(
&self,
value: &Value<N>,
value_type: &ValueType<N>
) -> Result<()>
pub fn matches_value_type(
&self,
value: &Value<N>,
value_type: &ValueType<N>
) -> Result<()>
Checks that the given value matches the layout of the value type.
sourcepub fn matches_register_type(
&self,
stack_value: &Value<N>,
register_type: &RegisterType<N>
) -> Result<()>
pub fn matches_register_type(
&self,
stack_value: &Value<N>,
register_type: &RegisterType<N>
) -> Result<()>
Checks that the given stack value matches the layout of the register type.
sourcepub fn matches_external_record(
&self,
record: &Record<N, Plaintext<N>>,
locator: &Locator<N>
) -> Result<()>
pub fn matches_external_record(
&self,
record: &Record<N, Plaintext<N>>,
locator: &Locator<N>
) -> Result<()>
Checks that the given record matches the layout of the external record type.
sourcepub fn matches_record(
&self,
record: &Record<N, Plaintext<N>>,
record_name: &Identifier<N>
) -> Result<()>
pub fn matches_record(
&self,
record: &Record<N, Plaintext<N>>,
record_name: &Identifier<N>
) -> Result<()>
Checks that the given record matches the layout of the record type.
sourcepub fn matches_plaintext(
&self,
plaintext: &Plaintext<N>,
plaintext_type: &PlaintextType<N>
) -> Result<()>
pub fn matches_plaintext(
&self,
plaintext: &Plaintext<N>,
plaintext_type: &PlaintextType<N>
) -> Result<()>
Checks that the given plaintext matches the layout of the plaintext type.
sourceimpl<N: Network> Stack<N>
impl<N: Network> Stack<N>
sourcepub fn sample_value<R: Rng + CryptoRng>(
&self,
burner_address: &Address<N>,
value_type: &ValueType<N>,
rng: &mut R
) -> Result<Value<N>>
pub fn sample_value<R: Rng + CryptoRng>(
&self,
burner_address: &Address<N>,
value_type: &ValueType<N>,
rng: &mut R
) -> Result<Value<N>>
Returns a value for the given value type.
sourceimpl<N: Network> Stack<N>
impl<N: Network> Stack<N>
sourcepub fn synthesize_key<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
function_name: &Identifier<N>,
rng: &mut R
) -> Result<()>
pub fn synthesize_key<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
function_name: &Identifier<N>,
rng: &mut R
) -> Result<()>
Synthesizes the proving key and verifying key for the given function name.
sourcepub fn synthesize_from_assignment(
&self,
function_name: &Identifier<N>,
assignment: &Assignment<N::Field>
) -> Result<()>
pub fn synthesize_from_assignment(
&self,
function_name: &Identifier<N>,
assignment: &Assignment<N::Field>
) -> Result<()>
Synthesizes and stores the (proving_key, verifying_key)
for the given function name and assignment.
sourceimpl<N: Network> Stack<N>
impl<N: Network> Stack<N>
sourcepub fn new(process: &Process<N>, program: &Program<N>) -> Result<Self>
pub fn new(process: &Process<N>, program: &Program<N>) -> Result<Self>
Initializes a new stack, if it does not already exist, given the process and the program.
sourcepub const fn program_id(&self) -> &ProgramID<N>
pub const fn program_id(&self) -> &ProgramID<N>
Returns the program ID.
sourcepub fn contains_external_record(&self, locator: &Locator<N>) -> bool
pub fn contains_external_record(&self, locator: &Locator<N>) -> bool
Returns true
if the stack contains the external record.
sourcepub fn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<&Stack<N>>
pub fn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<&Stack<N>>
Returns the external stack for the given program ID.
sourcepub fn get_external_program(
&self,
program_id: &ProgramID<N>
) -> Result<&Program<N>>
pub fn get_external_program(
&self,
program_id: &ProgramID<N>
) -> Result<&Program<N>>
Returns the external program for the given program ID.
sourcepub fn get_external_record(&self, locator: &Locator<N>) -> Result<RecordType<N>>
pub fn get_external_record(&self, locator: &Locator<N>) -> Result<RecordType<N>>
Returns true
if the stack contains the external record.
sourcepub fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>
pub fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>
Returns the function with the given function name.
sourcepub fn get_number_of_calls(&self, function_name: &Identifier<N>) -> Result<usize>
pub fn get_number_of_calls(&self, function_name: &Identifier<N>) -> Result<usize>
Returns the expected number of calls for the given function name.
sourcepub fn get_register_types(
&self,
name: &Identifier<N>
) -> Result<&RegisterTypes<N>>
pub fn get_register_types(
&self,
name: &Identifier<N>
) -> Result<&RegisterTypes<N>>
Returns the register types for the given closure or function name.
sourcepub fn get_finalize_types(
&self,
name: &Identifier<N>
) -> Result<&FinalizeTypes<N>>
pub fn get_finalize_types(
&self,
name: &Identifier<N>
) -> Result<&FinalizeTypes<N>>
Returns the register types for the given finalize name.
sourcepub fn contains_proving_key(&self, function_name: &Identifier<N>) -> bool
pub fn contains_proving_key(&self, function_name: &Identifier<N>) -> bool
Returns true
if the proving key for the given function name exists.
sourcepub fn contains_verifying_key(&self, function_name: &Identifier<N>) -> bool
pub fn contains_verifying_key(&self, function_name: &Identifier<N>) -> bool
Returns true
if the verifying key for the given function name exists.
sourcepub fn get_proving_key(
&self,
function_name: &Identifier<N>
) -> Result<ProvingKey<N>>
pub fn get_proving_key(
&self,
function_name: &Identifier<N>
) -> Result<ProvingKey<N>>
Returns the proving key for the given function name.
sourcepub fn get_verifying_key(
&self,
function_name: &Identifier<N>
) -> Result<VerifyingKey<N>>
pub fn get_verifying_key(
&self,
function_name: &Identifier<N>
) -> Result<VerifyingKey<N>>
Returns the verifying key for the given function name.
sourcepub fn insert_proving_key(
&self,
function_name: &Identifier<N>,
proving_key: ProvingKey<N>
) -> Result<()>
pub fn insert_proving_key(
&self,
function_name: &Identifier<N>,
proving_key: ProvingKey<N>
) -> Result<()>
Inserts the given proving key for the given function name.
sourcepub fn insert_verifying_key(
&self,
function_name: &Identifier<N>,
verifying_key: VerifyingKey<N>
) -> Result<()>
pub fn insert_verifying_key(
&self,
function_name: &Identifier<N>,
verifying_key: VerifyingKey<N>
) -> Result<()>
Inserts the given verifying key for the given function name.
sourcepub fn remove_proving_key(&self, function_name: &Identifier<N>)
pub fn remove_proving_key(&self, function_name: &Identifier<N>)
Removes the proving key for the given function name.
sourcepub fn remove_verifying_key(&self, function_name: &Identifier<N>)
pub fn remove_verifying_key(&self, function_name: &Identifier<N>)
Removes the verifying key for the given function name.
Trait Implementations
sourceimpl<N: Network> PartialEq<Stack<N>> for Stack<N>
impl<N: Network> PartialEq<Stack<N>> for Stack<N>
impl<N: Network> Eq for Stack<N>
Auto Trait Implementations
impl<N> !RefUnwindSafe for Stack<N>
impl<N> Send for Stack<N>
impl<N> Sync for Stack<N>
impl<N> Unpin for Stack<N> where
N: Unpin,
<N as Environment>::Field: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
impl<N> !UnwindSafe for Stack<N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more