Struct snarkvm_synthesizer::Stack
source · pub struct Stack<N>where
N: Network,{ /* private fields */ }
Implementations§
source§impl<N> Stack<N>where
N: Network,
impl<N> Stack<N>where N: Network,
Authorizes a call to the program function for the given inputs.
source§impl<N> Stack<N>where
N: Network,
impl<N> Stack<N>where N: Network,
sourcepub fn deploy<A, R>(&self, rng: &mut R) -> Result<Deployment<N>, Error>where
A: Aleo<Network = N>,
R: Rng + CryptoRng,
pub fn deploy<A, R>(&self, rng: &mut R) -> Result<Deployment<N>, Error>where A: Aleo<Network = N>, R: Rng + CryptoRng,
Deploys the given program ID, if it does not exist.
sourcepub fn verify_deployment<A, R>(
&self,
deployment: &Deployment<N>,
rng: &mut R
) -> Result<(), Error>where
A: Aleo<Network = N>,
R: Rng + CryptoRng,
pub fn verify_deployment<A, R>( &self, deployment: &Deployment<N>, rng: &mut R ) -> Result<(), Error>where A: Aleo<Network = N>, R: Rng + CryptoRng,
Checks each function in the program on the given verifying key and certificate.
source§impl<N> Stack<N>where
N: Network,
impl<N> Stack<N>where N: Network,
sourcepub fn sample_value<R>(
&self,
burner_address: &Address<N>,
value_type: &ValueType<N>,
rng: &mut R
) -> Result<Value<N>, Error>where
R: Rng + CryptoRng,
pub fn sample_value<R>( &self, burner_address: &Address<N>, value_type: &ValueType<N>, rng: &mut R ) -> Result<Value<N>, Error>where R: Rng + CryptoRng,
Returns a value for the given value type.
source§impl<N> Stack<N>where
N: Network,
impl<N> Stack<N>where N: Network,
sourcepub fn synthesize_key<A, R>(
&self,
function_name: &Identifier<N>,
rng: &mut R
) -> Result<(), Error>where
A: Aleo<Network = N>,
R: Rng + CryptoRng,
pub fn synthesize_key<A, R>( &self, function_name: &Identifier<N>, rng: &mut R ) -> Result<(), Error>where A: Aleo<Network = N>, R: Rng + CryptoRng,
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 as Environment>::Field>
) -> Result<(), Error>
pub fn synthesize_from_assignment( &self, function_name: &Identifier<N>, assignment: &Assignment<<N as Environment>::Field> ) -> Result<(), Error>
Synthesizes and stores the (proving_key, verifying_key)
for the given function name and assignment.
source§impl<N> Stack<N>where
N: Network,
impl<N> Stack<N>where N: Network,
sourcepub fn new(
process: &Process<N>,
program: &ProgramCore<N, Instruction<N>, Command<N>>
) -> Result<Stack<N>, Error>
pub fn new( process: &Process<N>, program: &ProgramCore<N, Instruction<N>, Command<N>> ) -> Result<Stack<N>, Error>
Initializes a new stack, if it does not already exist, given the process and the program.
source§impl<N> Stack<N>where
N: Network,
impl<N> Stack<N>where N: Network,
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>, Error>
pub fn get_proving_key( &self, function_name: &Identifier<N> ) -> Result<ProvingKey<N>, Error>
Returns the proving key for the given function name.
sourcepub fn get_verifying_key(
&self,
function_name: &Identifier<N>
) -> Result<VerifyingKey<N>, Error>
pub fn get_verifying_key( &self, function_name: &Identifier<N> ) -> Result<VerifyingKey<N>, Error>
Returns the verifying key for the given function name.
sourcepub fn insert_proving_key(
&self,
function_name: &Identifier<N>,
proving_key: ProvingKey<N>
) -> Result<(), Error>
pub fn insert_proving_key( &self, function_name: &Identifier<N>, proving_key: ProvingKey<N> ) -> Result<(), Error>
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<(), Error>
pub fn insert_verifying_key( &self, function_name: &Identifier<N>, verifying_key: VerifyingKey<N> ) -> Result<(), Error>
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> PartialEq for Stack<N>where
N: Network,
impl<N> PartialEq for Stack<N>where N: Network,
source§impl<N> StackEvaluate<N> for Stack<N>where
N: Network,
impl<N> StackEvaluate<N> for Stack<N>where N: Network,
source§fn evaluate_closure<A>(
&self,
closure: &ClosureCore<N, Instruction<N>>,
inputs: &[Value<N>],
call_stack: CallStack<N>,
signer: Address<N>,
caller: Address<N>,
tvk: Field<N>
) -> Result<Vec<Value<N>>, Error>where
A: Aleo<Network = N>,
fn evaluate_closure<A>( &self, closure: &ClosureCore<N, Instruction<N>>, inputs: &[Value<N>], call_stack: CallStack<N>, signer: Address<N>, caller: Address<N>, tvk: Field<N> ) -> Result<Vec<Value<N>>, Error>where A: Aleo<Network = 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> StackExecute<N> for Stack<N>where
N: Network,
impl<N> StackExecute<N> for Stack<N>where N: Network,
source§fn execute_closure<A>(
&self,
closure: &ClosureCore<N, Instruction<N>>,
inputs: &[Value<A>],
call_stack: CallStack<N>,
signer: Address<A>,
caller: Address<A>,
tvk: Field<A>
) -> Result<Vec<Value<A>>, Error>where
A: Aleo<Network = N>,
fn execute_closure<A>( &self, closure: &ClosureCore<N, Instruction<N>>, inputs: &[Value<A>], call_stack: CallStack<N>, signer: Address<A>, caller: Address<A>, tvk: Field<A> ) -> Result<Vec<Value<A>>, Error>where A: Aleo<Network = N>,
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, R>(
&self,
call_stack: CallStack<N>,
console_caller: Option<ProgramID<N>>,
rng: &mut R
) -> Result<Response<N>, Error>where
A: Aleo<Network = N>,
R: CryptoRng + Rng,
fn execute_function<A, R>( &self, call_stack: CallStack<N>, console_caller: Option<ProgramID<N>>, rng: &mut R ) -> Result<Response<N>, Error>where A: Aleo<Network = N>, R: CryptoRng + Rng,
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> StackMatches<N> for Stack<N>where
N: Network,
impl<N> StackMatches<N> for Stack<N>where N: Network,
source§fn matches_value_type(
&self,
value: &Value<N>,
value_type: &ValueType<N>
) -> Result<(), Error>
fn matches_value_type( &self, value: &Value<N>, value_type: &ValueType<N> ) -> Result<(), Error>
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<(), Error>
fn matches_register_type( &self, stack_value: &Value<N>, register_type: &RegisterType<N> ) -> Result<(), Error>
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<(), Error>
fn matches_external_record( &self, record: &Record<N, Plaintext<N>>, locator: &Locator<N> ) -> Result<(), Error>
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<(), Error>
fn matches_record( &self, record: &Record<N, Plaintext<N>>, record_name: &Identifier<N> ) -> Result<(), Error>
Checks that the given record matches the layout of the record type.
source§impl<N> StackProgram<N> for Stack<N>where
N: Network,
impl<N> StackProgram<N> for Stack<N>where N: Network,
source§fn program(&self) -> &ProgramCore<N, Instruction<N>, Command<N>>
fn program(&self) -> &ProgramCore<N, Instruction<N>, Command<N>>
Returns the program.
source§fn program_id(&self) -> &ProgramID<N>
fn program_id(&self) -> &ProgramID<N>
Returns the program ID.
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>>, Error>
fn get_external_stack( &self, program_id: &ProgramID<N> ) -> Result<&Arc<Stack<N>>, Error>
Returns the external stack for the given program ID.
source§fn get_external_program(
&self,
program_id: &ProgramID<N>
) -> Result<&ProgramCore<N, Instruction<N>, Command<N>>, Error>
fn get_external_program( &self, program_id: &ProgramID<N> ) -> Result<&ProgramCore<N, Instruction<N>, Command<N>>, Error>
Returns the external program for the given program ID.
source§fn get_external_record(
&self,
locator: &Locator<N>
) -> Result<&RecordType<N>, Error>
fn get_external_record( &self, locator: &Locator<N> ) -> Result<&RecordType<N>, Error>
Returns the external record if the stack contains the external record.
source§fn get_function(
&self,
function_name: &Identifier<N>
) -> Result<FunctionCore<N, Instruction<N>, Command<N>>, Error>
fn get_function( &self, function_name: &Identifier<N> ) -> Result<FunctionCore<N, Instruction<N>, Command<N>>, Error>
Returns the function with the given function name.
source§fn get_function_ref(
&self,
function_name: &Identifier<N>
) -> Result<&FunctionCore<N, Instruction<N>, Command<N>>, Error>
fn get_function_ref( &self, function_name: &Identifier<N> ) -> Result<&FunctionCore<N, Instruction<N>, Command<N>>, Error>
Returns a reference to the function with the given function name.
source§impl<N> StackProgramTypes<N> for Stack<N>where
N: Network,
impl<N> StackProgramTypes<N> for Stack<N>where N: Network,
source§fn get_register_types(
&self,
name: &Identifier<N>
) -> Result<&RegisterTypes<N>, Error>
fn get_register_types( &self, name: &Identifier<N> ) -> Result<&RegisterTypes<N>, Error>
Returns the register types for the given closure or function name.
source§fn get_finalize_types(
&self,
name: &Identifier<N>
) -> Result<&FinalizeTypes<N>, Error>
fn get_finalize_types( &self, name: &Identifier<N> ) -> Result<&FinalizeTypes<N>, Error>
Returns the register types for the given finalize name.
impl<N> Eq for Stack<N>where N: Network,
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> 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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.