Skip to main content

Process

Struct Process 

Source
pub struct Process<N>
where N: Network,
{ /* private fields */ }

Implementations§

Source§

impl<N> Process<N>
where N: Network,

Source

pub fn authorize<A, R>( &self, private_key: &PrivateKey<N>, program_id: impl TryInto<ProgramID<N>>, function_name: impl TryInto<Identifier<N>>, inputs: impl ExactSizeIterator<Item = impl TryInto<Value<N>>>, rng: &mut R, ) -> Result<Authorization<N>, ProcessAuthError>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

Authorizes a call to the program function for the given inputs.

Source

pub fn authorize_unchecked<A, R>( &self, private_key: &PrivateKey<N>, program_id: impl TryInto<ProgramID<N>>, function_name: impl TryInto<Identifier<N>>, inputs: impl ExactSizeIterator<Item = impl TryInto<Value<N>>>, rng: &mut R, ) -> Result<Authorization<N>, ProcessAuthError>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

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.

Source

pub fn authorize_request<A, R>( &self, request: Request<N>, rng: &mut R, ) -> Result<Authorization<N>, ProcessAuthError>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

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.

Source

pub fn authorize_fee_private<A, R>( &self, private_key: &PrivateKey<N>, credits: Record<N, Plaintext<N>>, base_fee_in_microcredits: u64, priority_fee_in_microcredits: u64, deployment_or_execution_id: Field<N>, rng: &mut R, ) -> Result<Authorization<N>, ProcessAuthError>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

Authorizes the fee given the credits record, the fee amount (in microcredits), and the deployment or execution ID.

Source

pub fn authorize_fee_public<A, R>( &self, private_key: &PrivateKey<N>, base_fee_in_microcredits: u64, priority_fee_in_microcredits: u64, deployment_or_execution_id: Field<N>, rng: &mut R, ) -> Result<Authorization<N>, ProcessAuthError>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

Authorizes the fee given the the fee amount (in microcredits) and the deployment or execution ID.

Source§

impl<N> Process<N>
where N: Network,

Source

pub fn deploy<A, R>( &self, program: &ProgramCore<N>, rng: &mut R, ) -> Result<Deployment<N>, ProcessDeployError>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

Deploys the given program ID, if it does not exist.

Source

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,

Source

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,

Source

pub fn execute<A, R>( &self, authorization: Authorization<N>, rng: &mut R, ) -> Result<(Response<N>, Trace<N>), ProcessExecError>
where A: Aleo<Network = N>, R: CryptoRng + Rng,

Executes the given authorization.

Source§

impl<N> Process<N>
where N: Network,

Source

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().

Source

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().

Source

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,

Source

pub fn verify_deployment<A, R>( &self, consensus_version: ConsensusVersion, 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,

Source

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,

Source

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,

Source

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,

Source

pub fn setup<A, R>(rng: &mut R) -> Result<Process<N>, Error>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

Initializes a new process.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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,

Source

pub fn load() -> Result<Process<N>, Error>

Initializes a new process.

Source

pub fn load_v0() -> Result<Process<N>, Error>

Initializes a new process with the V0 credits.aleo verifiying keys.

Source

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.

Source

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.

Source

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.

Source

pub const fn universal_srs(&self) -> &UniversalSRS<N>

Returns the universal SRS.

Source

pub fn contains_program(&self, program_id: &ProgramID<N>) -> bool

Returns true if the process contains the program with the given ID.

Source

pub fn program_ids(&self) -> Vec<ProgramID<N>>

Returns the program IDs of all programs in the process.

Source

pub fn get_stack( &self, program_id: impl TryInto<ProgramID<N>>, ) -> Result<Arc<Stack<N>>, Error>

Returns the stack for the given program ID.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn synthesize_translation_key<A, R>( &self, program_id: &ProgramID<N>, record_name: &Identifier<N>, rng: &mut R, ) -> Result<(), Error>
where A: Aleo<Network = N>, R: Rng + CryptoRng,

Synthesizes the translation key for the given record name.

Trait Implementations§

Source§

impl<N> Clone for Process<N>
where N: Clone + Network,

Source§

fn clone(&self) -> Process<N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more