Struct snarkvm_synthesizer::prelude::Process
source · pub struct Process<N>where
N: Network,{ /* private fields */ }
Implementations§
source§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.
source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
sourcepub 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.
sourcepub 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.
source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
sourcepub fn evaluate<A>(
&self,
authorization: Authorization<N>
) -> Result<Response<N>, Error>where
A: Aleo<Network = N>,
pub fn evaluate<A>( &self, authorization: Authorization<N> ) -> Result<Response<N>, Error>where A: Aleo<Network = N>,
Evaluates a program function on the given request.
source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
sourcepub 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()
.
sourcepub 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()
.
sourcepub 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()
.
source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
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,
Verifies the given deployment is ordered.
source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
sourcepub 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.
sourcepub 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.
source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where N: Network,
sourcepub const fn universal_srs(&self) -> &Arc<UniversalSRS<N>>
pub const fn universal_srs(&self) -> &Arc<UniversalSRS<N>>
Returns the universal SRS.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.