Skip to main content

Process

Struct Process 

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

Implementations§

Source§

impl<N: Network> Process<N>

Source

pub fn authorize<A: Aleo<Network = N>, R: Rng + CryptoRng>( &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>

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

Source

pub fn authorize_unchecked<A: Aleo<Network = N>, R: Rng + CryptoRng>( &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>

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: Aleo<Network = N>, R: Rng + CryptoRng>( &self, request: Request<N>, rng: &mut R, ) -> Result<Authorization<N>, ProcessAuthError>

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: Aleo<Network = N>, R: Rng + CryptoRng>( &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>

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: Aleo<Network = N>, R: Rng + CryptoRng>( &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>

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

Source§

impl<N: Network> Process<N>

Source

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.

Source

pub fn load_deployment(&self, deployment: &Deployment<N>) -> Result<()>

Adds the newly-deployed program. This method assumes the given deployment is valid.

Source§

impl<N: Network> Process<N>

Source

pub fn evaluate<A: Aleo<Network = N>>( &self, authorization: Authorization<N>, ) -> Result<Response<N>, ProcessEvalError>

Evaluates a program function on the given request.

Source§

impl<N: Network> Process<N>

Source

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.

Source§

impl<N: Network> Process<N>

Source

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.

Source§

impl<N: Network> Process<N>

Source

pub fn ensure_records_exist<'a>( transitions: impl ExactSizeIterator<Item = &'a Transition<N>> + DoubleEndedIterator + Clone, call_graph: &HashMap<N::TransitionID, Vec<N::TransitionID>>, execution_stacks: &IndexMap<ProgramID<N>, Arc<Stack<N>>>, ) -> Result<()>

Checks that, for each non-closure function in the execution, each ExternalRecord and DynamicRecord received as an input or from a callee corresponds to a static Record that exists on the ledger at the end of the execution (whether spent or not). A function given this guarantee should itself ensure that all records it outputs or passes to non-closure callees exist on the ledger at the end of the execution.

Input transitions: Iterator over the Transitions in the execution. The root transition must be last.

Input call_graph: A copy of the call graph. It is assumed to contain all transitions in transitions. All children of a given Transition ID must appear in the same order as the corresponding calls happen in the function.

Source§

impl<N: Network> Process<N>

Source

pub fn verify_execution( consensus_version: ConsensusVersion, varuna_version: VarunaVersion, inclusion_version: InclusionVersion, execution: &Execution<N>, execution_stacks: &IndexMap<ProgramID<N>, Arc<Stack<N>>>, ) -> Result<()>

Verifies the given execution is valid. Note: This does not check that the global state root exists in the ledger.

Source§

impl<N: Network> Process<N>

Source

pub fn construct_call_graph<'a>( transitions: impl ExactSizeIterator<Item = &'a Transition<N>> + DoubleEndedIterator, execution_stacks: &IndexMap<ProgramID<N>, Arc<Stack<N>>>, ) -> Result<HashMap<N::TransitionID, Vec<N::TransitionID>>>

Source§

impl<N: Network> Process<N>

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

Verifies the given fee is valid. Note: This does not check that the global state root exists in the ledger.

Source§

impl<N: Network> Process<N>

Source

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

Initializes a new process.

Source

pub fn lock(&self) -> ProcessExclusiveGuard<'_, N>

Guard the Process against any concurrent reads or writes.

Source

pub fn mapping_types_exist(&self, program: &Program<N>) -> Result<()>

Ensure that the types referred to in this program’s mappings exist.

Source§

impl<N: Network> Process<N>

Source

pub fn load() -> Result<Self>

Initializes a new process.

Source

pub fn load_v0() -> Result<Self>

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

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>>>

Returns the stack for the given program ID.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

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>
where <N as Environment>::Field: Unpin,

§

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> 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> Same for T

Source§

type Output = T

Should always be Self
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