pub struct ExecutionEngine {
pub process: Process<TestnetV0>,
}Expand description
Execution engine wrapping a snarkVM Process.
Fields§
§process: Process<TestnetV0>Implementations§
Source§impl ExecutionEngine
impl ExecutionEngine
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Initialize a new process using Process::load() (credits loaded by default).
Sourcepub fn new_with_v0_fee_keys() -> Result<Self>
pub fn new_with_v0_fee_keys() -> Result<Self>
Initialize with explicit V0 fee keys injected.
Sourcepub fn inject_v0_fee_keys(&mut self) -> Result<()>
pub fn inject_v0_fee_keys(&mut self) -> Result<()>
Inject V0 fee proving/verifying keys for testnet fee_public support.
Sourcepub fn add_program(&self, program: &Program<TestnetV0>) -> Result<()>
pub fn add_program(&self, program: &Program<TestnetV0>) -> Result<()>
Add a program to the engine.
Authorize and execute locally using pre-parsed snarkVM Value inputs.
Use this variant when inputs include record ciphertexts that must be decrypted first.
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.
Sourcepub 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>>
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.
Sourcepub fn deploy_program<R: Rng + CryptoRng>(
&self,
program: &Program<TestnetV0>,
rng: &mut R,
) -> Result<Deployment<TestnetV0>>
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.
Sourcepub 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>>
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).
Sourcepub fn deployment_cost_minimum(
&self,
deployment: &Deployment<TestnetV0>,
_consensus_version: ConsensusVersion,
) -> Result<u64>
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.
Sourcepub fn verify_execution_transaction(
&self,
execution: &Execution<TestnetV0>,
) -> Result<()>
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().
Sourcepub fn verify_deployment_transaction(
&self,
deployment: &Deployment<TestnetV0>,
rng: &mut TestRng,
) -> Result<()>
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§
impl !Freeze for ExecutionEngine
impl !RefUnwindSafe for ExecutionEngine
impl !UnwindSafe for ExecutionEngine
impl Send for ExecutionEngine
impl Sync for ExecutionEngine
impl Unpin for ExecutionEngine
impl UnsafeUnpin for ExecutionEngine
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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