Struct aleo_rust::snarkvm_types::Process
pub struct Process<N>where
N: Network,{ /* private fields */ }
Implementations§
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
Authorizes a call to the program function for the given inputs.
Authorizes the fee given the credits record, the fee amount (in microcredits), and the deployment or execution ID.
Authorizes the fee given the the fee amount (in microcredits) and the deployment or execution ID.
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
pub fn deploy<A, R>(
&self,
program: &ProgramCore<N, Instruction<N>, Command<N>>,
rng: &mut R
) -> Result<Deployment<N>, Error>where
A: Aleo<Network = N>,
R: Rng + CryptoRng,
pub fn deploy<A, R>( &self, program: &ProgramCore<N, Instruction<N>, Command<N>>, 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.
pub fn load_deployment(
&mut self,
deployment: &Deployment<N>
) -> Result<(), Error>
pub fn load_deployment( &mut self, deployment: &Deployment<N> ) -> Result<(), Error>
Adds the newly-deployed program. This method assumes the given deployment is valid.
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
pub fn finalize_deployment<P>(
&self,
state: FinalizeGlobalState,
store: &FinalizeStore<N, P>,
deployment: &Deployment<N>,
fee: &Fee<N>
) -> Result<(Stack<N>, Vec<FinalizeOperation<N>>), Error>where
P: FinalizeStorage<N>,
pub fn finalize_deployment<P>( &self, state: FinalizeGlobalState, store: &FinalizeStore<N, P>, deployment: &Deployment<N>, fee: &Fee<N> ) -> Result<(Stack<N>, Vec<FinalizeOperation<N>>), Error>where P: FinalizeStorage<N>,
Finalizes the deployment and fee.
This method assumes the given deployment is valid.
This method should only be called by VM::finalize()
.
pub fn finalize_execution<P>(
&self,
state: FinalizeGlobalState,
store: &FinalizeStore<N, P>,
execution: &Execution<N>,
fee: Option<&Fee<N>>
) -> Result<Vec<FinalizeOperation<N>>, Error>where
P: FinalizeStorage<N>,
pub fn finalize_execution<P>( &self, state: FinalizeGlobalState, store: &FinalizeStore<N, P>, execution: &Execution<N>, fee: Option<&Fee<N>> ) -> Result<Vec<FinalizeOperation<N>>, Error>where P: FinalizeStorage<N>,
Finalizes the execution and fee.
This method assumes the given execution is valid.
This method should only be called by VM::finalize()
.
pub fn finalize_fee<P>(
&self,
state: FinalizeGlobalState,
store: &FinalizeStore<N, P>,
fee: &Fee<N>
) -> Result<Vec<FinalizeOperation<N>>, Error>where
P: FinalizeStorage<N>,
pub fn finalize_fee<P>( &self, state: FinalizeGlobalState, store: &FinalizeStore<N, P>, fee: &Fee<N> ) -> Result<Vec<FinalizeOperation<N>>, Error>where P: FinalizeStorage<N>,
Finalizes the fee.
This method assumes the given fee is valid.
This method should only be called by VM::finalize()
.
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
pub 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,
Verifies the given deployment is ordered.
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
pub fn verify_execution(&self, execution: &Execution<N>) -> Result<(), Error>
pub fn verify_execution(&self, execution: &Execution<N>) -> Result<(), Error>
Verifies the given execution is valid. Note: This does not check that the global state root exists in the ledger.
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
pub fn construct_call_graph( &self, execution: &Execution<N> ) -> Result<HashMap<<N as Network>::TransitionID, Vec<<N as Network>::TransitionID>>, Error>
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
pub fn setup<A, R>(rng: &mut R) -> Result<Process<N>, Error>where
A: Aleo<Network = N>,
R: Rng + CryptoRng,
pub fn setup<A, R>(rng: &mut R) -> Result<Process<N>, Error>where A: Aleo<Network = N>, R: Rng + CryptoRng,
Initializes a new process.
pub fn add_program(
&mut self,
program: &ProgramCore<N, Instruction<N>, Command<N>>
) -> Result<(), Error>
pub fn add_program( &mut self, program: &ProgramCore<N, Instruction<N>, Command<N>> ) -> Result<(), Error>
Adds a new program to the process.
If you intend to execute
the program, use deploy
and finalize_deployment
instead.
pub fn add_stack(&mut self, stack: Stack<N>)
pub fn add_stack(&mut self, stack: Stack<N>)
Adds a new stack to the process.
If you intend to execute
the program, use deploy
and finalize_deployment
instead.
§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
pub const fn universal_srs(&self) -> &Arc<UniversalSRS<N>>
pub const fn universal_srs(&self) -> &Arc<UniversalSRS<N>>
Returns the universal SRS.
pub fn contains_program(&self, program_id: &ProgramID<N>) -> bool
pub fn contains_program(&self, program_id: &ProgramID<N>) -> bool
Returns true
if the process contains the program with the given ID.
pub fn get_stack(
&self,
program_id: impl TryInto<ProgramID<N>>
) -> Result<&Arc<Stack<N>>, Error>
pub fn get_stack( &self, program_id: impl TryInto<ProgramID<N>> ) -> Result<&Arc<Stack<N>>, Error>
Returns the stack for the given program ID.
pub fn get_program(
&self,
program_id: impl TryInto<ProgramID<N>>
) -> Result<&ProgramCore<N, Instruction<N>, Command<N>>, Error>
pub fn get_program( &self, program_id: impl TryInto<ProgramID<N>> ) -> Result<&ProgramCore<N, Instruction<N>, Command<N>>, Error>
Returns the program for the given program ID.
pub fn get_proving_key(
&self,
program_id: impl TryInto<ProgramID<N>>,
function_name: impl TryInto<Identifier<N>>
) -> Result<ProvingKey<N>, Error>
pub fn get_proving_key( &self, program_id: impl TryInto<ProgramID<N>>, function_name: impl TryInto<Identifier<N>> ) -> Result<ProvingKey<N>, Error>
Returns the proving key for the given program ID and function name.
pub fn get_verifying_key(
&self,
program_id: impl TryInto<ProgramID<N>>,
function_name: impl TryInto<Identifier<N>>
) -> Result<VerifyingKey<N>, Error>
pub fn get_verifying_key( &self, program_id: impl TryInto<ProgramID<N>>, function_name: impl TryInto<Identifier<N>> ) -> Result<VerifyingKey<N>, Error>
Returns the verifying key for the given program ID and function name.
pub fn insert_proving_key(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
proving_key: ProvingKey<N>
) -> Result<(), Error>
pub fn insert_proving_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, proving_key: ProvingKey<N> ) -> Result<(), Error>
Inserts the given proving key, for the given program ID and function name.
pub fn insert_verifying_key(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
verifying_key: VerifyingKey<N>
) -> Result<(), Error>
pub fn insert_verifying_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, verifying_key: VerifyingKey<N> ) -> Result<(), Error>
Inserts the given verifying key, for the given program ID and function name.
pub fn synthesize_key<A, R>(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
rng: &mut R
) -> Result<(), Error>where
A: Aleo<Network = N>,
R: Rng + CryptoRng,
pub fn synthesize_key<A, R>( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, rng: &mut R ) -> Result<(), Error>where A: Aleo<Network = N>, R: Rng + CryptoRng,
Synthesizes the proving and verifying key for the given program ID and function name.