pub struct Stack<N: Network> { /* private fields */ }

Implementations§

source§

impl<N: Network> Stack<N>

source

pub fn authorize<A: Aleo<Network = N>, R: Rng + CryptoRng>( &self, private_key: &PrivateKey<N>, function_name: impl TryInto<Identifier<N>>, inputs: impl ExactSizeIterator<Item = impl TryInto<Value<N>>>, rng: &mut R ) -> Result<Authorization<N>>

Authorizes a call to the program function for the given inputs.

source§

impl<N: Network> Stack<N>

source

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.

source

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.

source§

impl<N: Network> Stack<N>

source

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.

source

pub fn sample_record<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, record_name: &Identifier<N>, rng: &mut R ) -> Result<Record<N, Plaintext<N>>>

Returns a record for the given record name, with the given burner address.

source

pub fn sample_plaintext<R: Rng + CryptoRng>( &self, plaintext_type: &PlaintextType<N>, rng: &mut R ) -> Result<Plaintext<N>>

Samples a plaintext value according to the given plaintext type.

source§

impl<N: Network> Stack<N>

source

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.

source

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.

source§

impl<N: Network> Stack<N>

source

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.

source§

impl<N: Network> Stack<N>

source

pub fn contains_proving_key(&self, function_name: &Identifier<N>) -> bool

Returns true if the proving key for the given function name exists.

source

pub fn contains_verifying_key(&self, function_name: &Identifier<N>) -> bool

Returns true if the verifying key for the given function name exists.

source

pub fn get_proving_key( &self, function_name: &Identifier<N> ) -> Result<ProvingKey<N>>

Returns the proving key for the given function name.

source

pub fn get_verifying_key( &self, function_name: &Identifier<N> ) -> Result<VerifyingKey<N>>

Returns the verifying key for the given function name.

source

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.

source

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.

source

pub fn remove_proving_key(&self, function_name: &Identifier<N>)

Removes the proving key for the given function name.

source

pub fn remove_verifying_key(&self, function_name: &Identifier<N>)

Removes the verifying key for the given function name.

Trait Implementations§

source§

impl<N: Clone + Network> Clone for Stack<N>

source§

fn clone(&self) -> Stack<N>

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<N: Network> PartialEq for Stack<N>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<N: Network> StackEvaluate<N> for Stack<N>

source§

fn evaluate_closure<A: Aleo<Network = N>>( &self, closure: &Closure<N>, inputs: &[Value<N>], call_stack: CallStack<N>, signer: Address<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.

source§

fn evaluate_function<A: Aleo<Network = N>>( &self, call_stack: CallStack<N>, caller: Option<ProgramID<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.

source§

impl<N: Network> StackExecute<N> for Stack<N>

source§

fn execute_closure<A: Aleo<Network = N>>( &self, closure: &Closure<N>, inputs: &[Value<A>], call_stack: CallStack<N>, signer: Address<A>, 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.

source§

fn execute_function<A: Aleo<Network = N>, R: CryptoRng + Rng>( &self, call_stack: CallStack<N>, console_caller: Option<ProgramID<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.

source§

impl<N: Network> StackMatches<N> for Stack<N>

source§

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.

source§

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.

source§

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.

source§

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.

source§

fn matches_plaintext( &self, plaintext: &Plaintext<N>, plaintext_type: &PlaintextType<N> ) -> Result<()>

Checks that the given plaintext matches the layout of the plaintext type.

source§

fn matches_future(&self, future: &Future<N>, locator: &Locator<N>) -> Result<()>

Checks that the given future matches the layout of the future type.

source§

impl<N: Network> StackProgram<N> for Stack<N>

source§

fn program(&self) -> &Program<N>

Returns the program.

source§

fn program_id(&self) -> &ProgramID<N>

Returns the program ID.

source§

fn contains_external_record(&self, locator: &Locator<N>) -> bool

Returns true if the stack contains the external record.

source§

fn get_external_stack( &self, program_id: &ProgramID<N> ) -> Result<&Arc<Stack<N>>>

Returns the external stack for the given program ID.

source§

fn get_external_program(&self, program_id: &ProgramID<N>) -> Result<&Program<N>>

Returns the external program for the given program ID.

source§

fn get_external_record(&self, locator: &Locator<N>) -> Result<&RecordType<N>>

Returns the external record if the stack contains the external record.

source§

fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>

Returns the function with the given function name.

source§

fn get_function_ref( &self, function_name: &Identifier<N> ) -> Result<&Function<N>>

Returns a reference to the function with the given function name.

source§

fn get_number_of_calls(&self, function_name: &Identifier<N>) -> Result<usize>

Returns the expected number of calls for the given function name.

source§

impl<N: Network> StackProgramTypes<N> for Stack<N>

source§

fn get_register_types(&self, name: &Identifier<N>) -> Result<&RegisterTypes<N>>

Returns the register types for the given closure or function name.

source§

fn get_finalize_types(&self, name: &Identifier<N>) -> Result<&FinalizeTypes<N>>

Returns the register types for the given finalize name.

source§

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§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V