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 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.
Source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where
N: Network,
Sourcepub fn deploy<A, R>(
&self,
program: &ProgramCore<N>,
rng: &mut R,
) -> Result<Deployment<N>, ProcessDeployError>
pub fn deploy<A, R>( &self, program: &ProgramCore<N>, rng: &mut R, ) -> Result<Deployment<N>, ProcessDeployError>
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>, ProcessEvalError>where
A: Aleo<Network = N>,
pub fn evaluate<A>(
&self,
authorization: Authorization<N>,
) -> Result<Response<N>, ProcessEvalError>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,
consensus_version: ConsensusVersion,
deployment: &Deployment<N>,
rng: &mut R,
) -> Result<(), Error>
pub fn verify_deployment<A, R>( &self, consensus_version: ConsensusVersion, deployment: &Deployment<N>, rng: &mut R, ) -> Result<(), Error>
Verifies the given deployment is ordered.
Source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where
N: Network,
Sourcepub fn verify_execution(
&self,
consensus_version: ConsensusVersion,
varuna_version: VarunaVersion,
inclusion_version: InclusionVersion,
execution: &Execution<N>,
) -> Result<(), Error>
pub fn verify_execution( &self, consensus_version: ConsensusVersion, varuna_version: VarunaVersion, inclusion_version: InclusionVersion, 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.
Source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where
N: Network,
pub fn construct_call_graph<'a>( &self, transitions: impl ExactSizeIterator<Item = &'a Transition<N>> + DoubleEndedIterator, ) -> Result<HashMap<<N as Network>::TransitionID, Vec<<N as Network>::TransitionID>>, Error>
Source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where
N: Network,
Sourcepub fn verify_fee(
&self,
consensus_version: ConsensusVersion,
varuna_version: VarunaVersion,
inclusion_version: InclusionVersion,
fee: &Fee<N>,
deployment_or_execution_id: Field<N>,
) -> Result<(), Error>
pub fn verify_fee( &self, consensus_version: ConsensusVersion, varuna_version: VarunaVersion, inclusion_version: InclusionVersion, fee: &Fee<N>, deployment_or_execution_id: Field<N>, ) -> Result<(), Error>
Verifies the given fee is valid. Note: This does not check that the global state root exists in the ledger.
Source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where
N: Network,
Sourcepub fn add_stack(&mut self, stack: Stack<N>) -> Option<Arc<Stack<N>>>
pub fn add_stack(&mut 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 mapping_types_exist(&self, program: &ProgramCore<N>) -> Result<(), Error>
pub fn mapping_types_exist(&self, program: &ProgramCore<N>) -> Result<(), Error>
Ensure that the types referred to in this program’s mappings exist.
Source§impl<N> Process<N>where
N: Network,
impl<N> Process<N>where
N: Network,
Sourcepub fn load_v0() -> Result<Process<N>, Error>
pub fn load_v0() -> Result<Process<N>, Error>
Initializes a new process with the V0 credits.aleo verifiying keys.
Sourcepub fn add_program(&mut self, program: &ProgramCore<N>) -> Result<(), Error>
pub fn add_program(&mut self, program: &ProgramCore<N>) -> Result<(), Error>
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(
&mut self,
program: &ProgramCore<N>,
edition: u16,
) -> Result<(), Error>
pub fn add_program_with_edition( &mut self, program: &ProgramCore<N>, edition: u16, ) -> Result<(), Error>
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(
&mut self,
programs: &[(ProgramCore<N>, u16)],
) -> Result<(), Error>
pub fn add_programs_with_editions( &mut self, programs: &[(ProgramCore<N>, u16)], ) -> Result<(), Error>
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 const fn universal_srs(&self) -> &UniversalSRS<N>
pub const 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>>, 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_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 remove_proving_key(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
) -> Result<(), Error>
pub fn remove_proving_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, ) -> Result<(), Error>
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<(), 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.
Sourcepub fn remove_verifying_key(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
) -> Result<(), Error>
pub fn remove_verifying_key( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, ) -> Result<(), Error>
Removes the given verifying key, for the given program ID and function name.
Sourcepub fn synthesize_key<A, R>(
&self,
program_id: &ProgramID<N>,
function_name: &Identifier<N>,
rng: &mut R,
) -> Result<(), Error>
pub fn synthesize_key<A, R>( &self, program_id: &ProgramID<N>, function_name: &Identifier<N>, rng: &mut R, ) -> Result<(), Error>
Synthesizes the proving and verifying key for the given program ID and function name.
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for Process<N>
impl<N> !RefUnwindSafe for Process<N>
impl<N> Send for Process<N>
impl<N> Sync for Process<N>
impl<N> Unpin for Process<N>
impl<N> UnsafeUnpin for Process<N>
impl<N> !UnwindSafe for Process<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<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