pub struct ProcessExclusiveGuard<'a, N: Network> { /* private fields */ }Expand description
A wrapper ensuring exclusive access to the Process for the purposes of methods which affect the state of the stacks.
Implementations§
Source§impl<'a, N: Network> ProcessExclusiveGuard<'a, N>
impl<'a, N: Network> ProcessExclusiveGuard<'a, N>
Sourcepub fn finalize_deployment<P: FinalizeStorage<N>>(
&self,
state: FinalizeGlobalState,
store: &FinalizeStore<N, P>,
deployment: &Deployment<N>,
fee: &Fee<N>,
) -> Result<(Stack<N>, Vec<FinalizeOperation<N>>), IndexedFinalizeError<N, Command<N>>>
pub fn finalize_deployment<P: FinalizeStorage<N>>( &self, state: FinalizeGlobalState, store: &FinalizeStore<N, P>, deployment: &Deployment<N>, fee: &Fee<N>, ) -> Result<(Stack<N>, Vec<FinalizeOperation<N>>), IndexedFinalizeError<N, Command<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: FinalizeStorage<N>>(
&self,
state: FinalizeGlobalState,
store: &FinalizeStore<N, P>,
execution: &Execution<N>,
fee: Option<&Fee<N>>,
) -> Result<Vec<FinalizeOperation<N>>, IndexedFinalizeError<N, Command<N>>>
pub fn finalize_execution<P: FinalizeStorage<N>>( &self, state: FinalizeGlobalState, store: &FinalizeStore<N, P>, execution: &Execution<N>, fee: Option<&Fee<N>>, ) -> Result<Vec<FinalizeOperation<N>>, IndexedFinalizeError<N, Command<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: FinalizeStorage<N>>(
&self,
state: FinalizeGlobalState,
store: &FinalizeStore<N, P>,
fee: &Fee<N>,
) -> Result<Vec<FinalizeOperation<N>>, IndexedFinalizeError<N, Command<N>>>
pub fn finalize_fee<P: FinalizeStorage<N>>( &self, state: FinalizeGlobalState, store: &FinalizeStore<N, P>, fee: &Fee<N>, ) -> Result<Vec<FinalizeOperation<N>>, IndexedFinalizeError<N, Command<N>>>
Finalizes the fee.
This method assumes the given fee is valid.
This method should only be called by VM::finalize().
Source§impl<'a, N: Network> ProcessExclusiveGuard<'a, N>
impl<'a, N: Network> ProcessExclusiveGuard<'a, N>
Sourcepub fn add_stack(&self, stack: Stack<N>) -> Option<Arc<Stack<N>>>
pub fn add_stack(&self, stack: Stack<N>) -> Option<Arc<Stack<N>>>
Adds a new stack to the process. If the program already exists, then the existing stack is replaced and the original stack is returned. Note. This method assumes that the provided stack is valid.
Sourcepub fn stage_stack(&self, stack: Stack<N>)
pub fn stage_stack(&self, stack: Stack<N>)
Stages a stack to be added to the process.
The new stack is active, while the old stack is retained in old_stacks.
The commit_stacks method must be called to finalize the addition of the new stack.
The revert_stacks method can be called to revert the staged stacks.
Sourcepub fn commit_stacks(&self)
pub fn commit_stacks(&self)
Commits the staged stacks to the process. This finalizes the addition of the new stacks and clears the old stacks.
Sourcepub fn revert_stacks(&self)
pub fn revert_stacks(&self)
Reverts the staged stacks, restoring the previous state of the process. This will remove the new stacks and restore the old stacks.
Sourcepub fn add_program(&self, program: &Program<N>) -> Result<()>
pub fn add_program(&self, program: &Program<N>) -> Result<()>
Adds a new program to the process, verifying that it is a valid addition.
If the program exists, then the existing stack is replaced and discarded.
Note. This method should NOT be used by the on-chain VM to add new program, use finalize_deployment or load_deployment instead instead.
Sourcepub fn add_program_with_edition(
&self,
program: &Program<N>,
edition: u16,
) -> Result<()>
pub fn add_program_with_edition( &self, program: &Program<N>, edition: u16, ) -> Result<()>
Adds a new program with the given edition to the process, verifying that it is a valid addition.
If the program exists, then the existing stack is replaced and discarded.
Note. This method should NOT be used by the on-chain VM to add new program, use finalize_deployment or load_deployment instead instead.
Sourcepub fn add_programs_with_editions(
&self,
programs: &[(Program<N>, u16)],
) -> Result<()>
pub fn add_programs_with_editions( &self, programs: &[(Program<N>, u16)], ) -> Result<()>
Adds a set of programs and editions, in topological order, to the process, deferring validation of the programs until all programs are added.
If a program exists, then the existing stack is replaced and discarded.
Either all programs are added or none are.
Note. This method should NOT be used by the on-chain VM to add new program, use finalize_deployment or load_deployment instead instead.
Sourcepub fn update_credits_verifying_keys(&self) -> Result<()>
pub fn update_credits_verifying_keys(&self) -> Result<()>
Update the credits.aleo program in the VM with the latest verifying keys.
Methods from Deref<Target = Process<N>>§
Authorizes a call to the program function for the given inputs.
Authorizes a call to the program function for the given inputs.
Compared to authorize, this method does not check for circuit satisfiability of the request.
Authorizes a call to the program function for the given inputs.
Compared to authorize, no private key is needed, but this only works for single public requests.
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.
Sourcepub fn deploy<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
program: &Program<N>,
rng: &mut R,
) -> Result<Deployment<N>, ProcessDeployError>
pub fn deploy<A: Aleo<Network = N>, R: Rng + CryptoRng>( &self, program: &Program<N>, rng: &mut R, ) -> Result<Deployment<N>, ProcessDeployError>
Deploys the given program ID, if it does not exist.
Sourcepub fn load_deployment(&self, deployment: &Deployment<N>) -> Result<()>
pub fn load_deployment(&self, deployment: &Deployment<N>) -> Result<()>
Adds the newly-deployed program. This method assumes the given deployment is valid.
Sourcepub fn evaluate<A: Aleo<Network = N>>(
&self,
authorization: Authorization<N>,
) -> Result<Response<N>, ProcessEvalError>
pub fn evaluate<A: Aleo<Network = N>>( &self, authorization: Authorization<N>, ) -> Result<Response<N>, ProcessEvalError>
Evaluates a program function on the given request.
Sourcepub fn execute<A: Aleo<Network = N>, R: CryptoRng + Rng>(
&self,
authorization: Authorization<N>,
rng: &mut R,
) -> Result<(Response<N>, Trace<N>), ProcessExecError>
pub fn execute<A: Aleo<Network = N>, R: CryptoRng + Rng>( &self, authorization: Authorization<N>, rng: &mut R, ) -> Result<(Response<N>, Trace<N>), ProcessExecError>
Executes the given authorization.
Sourcepub fn verify_deployment<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
consensus_version: ConsensusVersion,
deployment: &Deployment<N>,
rng: &mut R,
) -> Result<()>
pub fn verify_deployment<A: Aleo<Network = N>, R: Rng + CryptoRng>( &self, consensus_version: ConsensusVersion, deployment: &Deployment<N>, rng: &mut R, ) -> Result<()>
Verifies the given deployment is ordered.
Sourcepub fn verify_fee(
&self,
consensus_version: ConsensusVersion,
varuna_version: VarunaVersion,
inclusion_version: InclusionVersion,
fee: &Fee<N>,
deployment_or_execution_id: Field<N>,
) -> Result<()>
pub fn verify_fee( &self, consensus_version: ConsensusVersion, varuna_version: VarunaVersion, inclusion_version: InclusionVersion, fee: &Fee<N>, deployment_or_execution_id: Field<N>, ) -> Result<()>
Verifies the given fee is valid. Note: This does not check that the global state root exists in the ledger.
Sourcepub fn lock(&self) -> ProcessExclusiveGuard<'_, N>
pub fn lock(&self) -> ProcessExclusiveGuard<'_, N>
Guard the Process against any concurrent reads or writes.
Sourcepub fn mapping_types_exist(&self, program: &Program<N>) -> Result<()>
pub fn mapping_types_exist(&self, program: &Program<N>) -> Result<()>
Ensure that the types referred to in this program’s mappings exist.
Sourcepub fn universal_srs(&self) -> &UniversalSRS<N>
pub fn universal_srs(&self) -> &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 program_ids(&self) -> Vec<ProgramID<N>>
pub fn program_ids(&self) -> Vec<ProgramID<N>>
Returns the program IDs of all programs in the process.
Sourcepub fn get_stack(
&self,
program_id: impl TryInto<ProgramID<N>>,
) -> Result<Arc<Stack<N>>>
pub fn get_stack( &self, program_id: impl TryInto<ProgramID<N>>, ) -> Result<Arc<Stack<N>>>
Returns the stack for the given program ID.
Sourcepub fn get_latest_edition_for_program(&self, program_id: &ProgramID<N>) -> u16
pub fn get_latest_edition_for_program(&self, program_id: &ProgramID<N>) -> u16
Returns the latest deployed edition for the given program ID, defaulting to 0 if unknown.
Sourcepub fn get_proving_key(
&self,
program_id: impl TryInto<ProgramID<N>>,
function_name: impl TryInto<Identifier<N>>,
) -> Result<ProvingKey<N>>
pub fn get_proving_key( &self, program_id: impl TryInto<ProgramID<N>>, function_name: impl TryInto<Identifier<N>>, ) -> Result<ProvingKey<N>>
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>>
pub fn get_verifying_key( &self, program_id: impl TryInto<ProgramID<N>>, function_name: impl TryInto<Identifier<N>>, ) -> Result<VerifyingKey<N>>
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<()>
pub fn insert_proving_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, proving_key: ProvingKey<N>, ) -> Result<()>
Inserts the given proving key, for the given program ID and function name.
Sourcepub fn remove_proving_key(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
) -> Result<()>
pub fn remove_proving_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, ) -> Result<()>
Removes 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<()>
pub fn insert_verifying_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, verifying_key: VerifyingKey<N>, ) -> Result<()>
Inserts the given verifying key, for the given program ID and function name.
Sourcepub fn remove_verifying_key(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
) -> Result<()>
pub fn remove_verifying_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, ) -> Result<()>
Removes the given verifying key, for the given program ID and function name.
Sourcepub fn synthesize_key<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
rng: &mut R,
) -> Result<()>
pub fn synthesize_key<A: Aleo<Network = N>, R: Rng + CryptoRng>( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, rng: &mut R, ) -> Result<()>
Synthesizes the proving and verifying key for the given program ID and function name.
Sourcepub fn synthesize_translation_key<A: Aleo<Network = N>, R: Rng + CryptoRng>(
&self,
program_id: &ProgramID<N>,
record_name: &Identifier<N>,
rng: &mut R,
) -> Result<()>
pub fn synthesize_translation_key<A: Aleo<Network = N>, R: Rng + CryptoRng>( &self, program_id: &ProgramID<N>, record_name: &Identifier<N>, rng: &mut R, ) -> Result<()>
Synthesizes the translation key for the given record name.
Trait Implementations§
Auto Trait Implementations§
impl<'a, N> Freeze for ProcessExclusiveGuard<'a, N>
impl<'a, N> !RefUnwindSafe for ProcessExclusiveGuard<'a, N>
impl<'a, N> !Send for ProcessExclusiveGuard<'a, N>
impl<'a, N> Sync for ProcessExclusiveGuard<'a, N>
impl<'a, N> Unpin for ProcessExclusiveGuard<'a, N>
impl<'a, N> UnsafeUnpin for ProcessExclusiveGuard<'a, N>
impl<'a, N> !UnwindSafe for ProcessExclusiveGuard<'a, 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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