pub struct Stack<N: Network> { /* private fields */ }
Implementations§
Source§impl<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.
Source§impl<N: Network> Stack<N>
impl<N: Network> Stack<N>
Sourcepub fn sample_plaintext<R: Rng + CryptoRng>(
&self,
plaintext_type: &PlaintextType<N>,
rng: &mut R,
) -> Result<Plaintext<N>>
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>
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.
Source§impl<N: Network> Stack<N>
impl<N: Network> Stack<N>
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§
Source§impl<N: Network> StackEvaluate<N> for Stack<N>
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>>>
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§impl<N: Network> StackExecute<N> for Stack<N>
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>>>
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>>,
root_tvk: Option<Field<N>>,
rng: &mut R,
) -> Result<Response<N>>
fn execute_function<A: Aleo<Network = N>, R: CryptoRng + Rng>( &self, call_stack: CallStack<N>, console_caller: Option<ProgramID<N>>, root_tvk: Option<Field<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>
impl<N: Network> StackMatches<N> for Stack<N>
Source§fn matches_value_type(
&self,
value: &Value<N>,
value_type: &ValueType<N>,
) -> Result<()>
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<()>
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<()>
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<()>
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<()>
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§impl<N: Network> StackProgram<N> for Stack<N>
impl<N: Network> StackProgram<N> for Stack<N>
Source§fn program_id(&self) -> &ProgramID<N>
fn program_id(&self) -> &ProgramID<N>
Returns the program ID.
Source§fn program_depth(&self) -> usize
fn program_depth(&self) -> usize
Returns the program depth.
Source§fn contains_external_record(&self, locator: &Locator<N>) -> bool
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>>>
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>>
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>>
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_finalize_cost(&self, function_name: &Identifier<N>) -> Result<u64>
fn get_finalize_cost(&self, function_name: &Identifier<N>) -> Result<u64>
Returns the expected finalize cost for the given function name.
Source§fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>
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>>
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>
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>
impl<N: Network> StackProgramTypes<N> for Stack<N>
Source§fn get_register_types(&self, name: &Identifier<N>) -> Result<&RegisterTypes<N>>
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>>
fn get_finalize_types(&self, name: &Identifier<N>) -> Result<&FinalizeTypes<N>>
Returns the register types for the given finalize name.
impl<N: Network> Eq for Stack<N>
Auto Trait Implementations§
impl<N> Freeze for Stack<N>
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 as Environment>::Field: Unpin,
N: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
impl<N> !UnwindSafe for Stack<N>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more