Skip to main content

ExecutionEngine

Struct ExecutionEngine 

Source
pub struct ExecutionEngine {
    pub process: Process<TestnetV0>,
}
Expand description

Execution engine wrapping a snarkVM Process.

Fields§

§process: Process<TestnetV0>

Implementations§

Source§

impl ExecutionEngine

Source

pub fn new() -> Result<Self>

Initialize a new process using Process::load() (credits loaded by default).

Source

pub fn new_with_v0_fee_keys() -> Result<Self>

Initialize with explicit V0 fee keys injected.

Source

pub fn inject_v0_fee_keys(&mut self) -> Result<()>

Inject V0 fee proving/verifying keys for testnet fee_public support.

Source

pub fn add_program(&self, program: &Program<TestnetV0>) -> Result<()>

Add a program to the engine.

Source

pub fn authorize_and_execute_with_values( &self, private_key: &PrivateKey<TestnetV0>, program_id: &ProgramID<TestnetV0>, function_name: &str, values: Vec<Value<TestnetV0>>, rng: &mut TestRng, ) -> Result<(Response<TestnetV0>, Trace<TestnetV0>)>

Authorize and execute locally using pre-parsed snarkVM Value inputs. Use this variant when inputs include record ciphertexts that must be decrypted first.

Source

pub fn authorize_and_execute( &self, private_key: &PrivateKey<TestnetV0>, program_id: &ProgramID<TestnetV0>, function_name: &str, inputs: Vec<&str>, rng: &mut TestRng, ) -> Result<(Response<TestnetV0>, Trace<TestnetV0>)>

Authorize and execute locally. Returns response + trace.

Inputs are parsed as snarkVM Values — record ciphertexts (e.g. record1...) are handled correctly, unlike raw string inputs.

Source

pub fn prove_and_package( &self, trace: Trace<TestnetV0>, private_key: &PrivateKey<TestnetV0>, program_id: &ProgramID<TestnetV0>, function_name: &str, base_fee: u64, priority_fee: u64, query: &impl QueryTrait<TestnetV0>, rng: &mut TestRng, ) -> Result<Transaction<TestnetV0>>

Prove execution + fee, verify, package into Transaction.

Source

pub fn inner(&self) -> &Process<TestnetV0>

Reference to the inner Process.

Source

pub fn deploy_program<R: Rng + CryptoRng>( &self, program: &Program<TestnetV0>, rng: &mut R, ) -> Result<Deployment<TestnetV0>>

Pure program deployment proof — generates a Deployment from source.

This only proves the program circuit. Fee and transaction packaging must be done separately via build_deployment_transaction.

Source

pub fn build_deployment_transaction<R: Rng + CryptoRng>( &self, private_key: &PrivateKey<TestnetV0>, _program: &Program<TestnetV0>, deployment: &Deployment<TestnetV0>, base_fee: u64, priority_fee_in_microcredits: u64, _consensus_version: ConsensusVersion, query: &impl QueryTrait<TestnetV0>, rng: &mut R, ) -> Result<Transaction<TestnetV0>>

Full deployment pipeline: prove program → authorize fee → prove fee → verify → package into Transaction.

This is the equivalent of JS SDK’s buildDeploymentTransaction.

base_fee is the minimum deployment cost (use ExecutionEngine::deployment_cost_minimum to compute it). priority_fee_in_microcredits is an additional fee on top. consensus_version determines which cost formula applies (TestnetV0 uses V14). query supplies the current state root (from AleoHttpClient::fetch_state_root).

Source

pub fn deployment_cost_minimum( &self, deployment: &Deployment<TestnetV0>, _consensus_version: ConsensusVersion, ) -> Result<u64>

Compute the minimum deployment cost for a deployment at the given consensus version.

Source

pub fn verify_execution_transaction( &self, execution: &Execution<TestnetV0>, ) -> Result<()>

Verify an execute transaction’s proof.

The program must already be registered in this engine via add_program().

Source

pub fn verify_deployment_transaction( &self, deployment: &Deployment<TestnetV0>, rng: &mut TestRng, ) -> Result<()>

Verify a deploy transaction’s proof. Uses an empty engine (no user programs loaded) to avoid edition-zero collision.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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: Sized + 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: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

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

fn try_from(value: U) -> Result<T, !>

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