Struct aleo_rust::snarkvm_types::VM
source · pub struct VM<N, C>where
N: Network,
C: ConsensusStorage<N>,{ /* private fields */ }
Implementations§
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
Authorizes a call to the program function for the given inputs.
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
sourcepub fn deploy<R>(
&self,
private_key: &PrivateKey<N>,
program: &ProgramCore<N, Instruction<N>, Command<N>>,
_: (Record<N, Plaintext<N>>, u64),
query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>,
rng: &mut R
) -> Result<Transaction<N>, Error>where
R: Rng + CryptoRng,
pub fn deploy<R>( &self, private_key: &PrivateKey<N>, program: &ProgramCore<N, Instruction<N>, Command<N>>, _: (Record<N, Plaintext<N>>, u64), query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>, rng: &mut R ) -> Result<Transaction<N>, Error>where R: Rng + CryptoRng,
Returns a new deploy transaction.
The priority_fee_in_microcredits
is an additional fee on top of the deployment fee.
sourcepub fn deploy_raw<R>(
&self,
program: &ProgramCore<N, Instruction<N>, Command<N>>,
rng: &mut R
) -> Result<Deployment<N>, Error>where
R: Rng + CryptoRng,
pub fn deploy_raw<R>( &self, program: &ProgramCore<N, Instruction<N>, Command<N>>, rng: &mut R ) -> Result<Deployment<N>, Error>where R: Rng + CryptoRng,
Returns a deployment for the given program.
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
sourcepub fn execute<R>(
&self,
private_key: &PrivateKey<N>,
_: (impl TryInto<ProgramID<N>>, impl TryInto<Identifier<N>>),
inputs: impl ExactSizeIterator<Item = impl TryInto<Value<N>>>,
fee: Option<(Record<N, Plaintext<N>>, u64)>,
query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>,
rng: &mut R
) -> Result<Transaction<N>, Error>where
R: Rng + CryptoRng,
pub fn execute<R>( &self, private_key: &PrivateKey<N>, _: (impl TryInto<ProgramID<N>>, impl TryInto<Identifier<N>>), inputs: impl ExactSizeIterator<Item = impl TryInto<Value<N>>>, fee: Option<(Record<N, Plaintext<N>>, u64)>, query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>, rng: &mut R ) -> Result<Transaction<N>, Error>where R: Rng + CryptoRng,
Returns a new execute transaction.
The priority_fee_in_microcredits
is an additional fee on top of the deployment fee.
Returns a new execute transaction for the given authorization.
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
sourcepub fn execute_fee<R>(
&self,
private_key: &PrivateKey<N>,
fee_record: Record<N, Plaintext<N>>,
fee_in_microcredits: u64,
deployment_or_execution_id: Field<N>,
query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>,
rng: &mut R
) -> Result<Transaction<N>, Error>where
R: Rng + CryptoRng,
pub fn execute_fee<R>( &self, private_key: &PrivateKey<N>, fee_record: Record<N, Plaintext<N>>, fee_in_microcredits: u64, deployment_or_execution_id: Field<N>, query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>, rng: &mut R ) -> Result<Transaction<N>, Error>where R: Rng + CryptoRng,
Executes a fee for the given private key, fee record, and fee amount (in microcredits). Returns the fee transaction.
sourcepub fn execute_fee_raw<R>(
&self,
private_key: &PrivateKey<N>,
fee_record: Record<N, Plaintext<N>>,
fee_in_microcredits: u64,
deployment_or_execution_id: Field<N>,
query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>,
rng: &mut R
) -> Result<(Response<N>, Fee<N>), Error>where
R: Rng + CryptoRng,
pub fn execute_fee_raw<R>( &self, private_key: &PrivateKey<N>, fee_record: Record<N, Plaintext<N>>, fee_in_microcredits: u64, deployment_or_execution_id: Field<N>, query: Option<Query<N, <C as ConsensusStorage<N>>::BlockStorage>>, rng: &mut R ) -> Result<(Response<N>, Fee<N>), Error>where R: Rng + CryptoRng,
Executes a fee for the given private key, fee record, and fee amount (in microcredits). Returns the response and fee.
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
sourcepub fn speculate<'a>(
&self,
state: FinalizeGlobalState,
transactions: impl ExactSizeIterator<Item = &'a Transaction<N>>
) -> Result<Transactions<N>, Error>
pub fn speculate<'a>( &self, state: FinalizeGlobalState, transactions: impl ExactSizeIterator<Item = &'a Transaction<N>> ) -> Result<Transactions<N>, Error>
Speculates on the given list of transactions in the VM, returning the confirmed transactions.
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
sourcepub fn verify_transaction(
&self,
transaction: &Transaction<N>,
rejected_id: Option<Field<N>>
) -> bool
pub fn verify_transaction( &self, transaction: &Transaction<N>, rejected_id: Option<Field<N>> ) -> bool
Returns true
if the transaction is valid.
sourcepub fn verify_deployment(&self, deployment: &Deployment<N>) -> bool
pub fn verify_deployment(&self, deployment: &Deployment<N>) -> bool
Returns true
if the deployment is valid.
sourcepub fn verify_execution(&self, execution: &Execution<N>) -> bool
pub fn verify_execution(&self, execution: &Execution<N>) -> bool
Returns true
if the execution is valid.
sourcepub fn verify_fee(
&self,
fee: &Fee<N>,
deployment_or_execution_id: Field<N>
) -> bool
pub fn verify_fee( &self, fee: &Fee<N>, deployment_or_execution_id: Field<N> ) -> bool
Returns true
if the fee is valid.
sourcepub fn check_transaction(
&self,
transaction: &Transaction<N>,
rejected_id: Option<Field<N>>
) -> Result<(), Error>
pub fn check_transaction( &self, transaction: &Transaction<N>, rejected_id: Option<Field<N>> ) -> Result<(), Error>
Verifies the transaction in the VM. On failure, returns an error.
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
sourcepub fn from(store: ConsensusStore<N, C>) -> Result<VM<N, C>, Error>
pub fn from(store: ConsensusStore<N, C>) -> Result<VM<N, C>, Error>
Initializes the VM from storage.
sourcepub fn contains_program(&self, program_id: &ProgramID<N>) -> bool
pub fn contains_program(&self, program_id: &ProgramID<N>) -> bool
Returns true
if a program with the given program ID exists.
source§impl<N, C> VM<N, C>where
N: Network,
C: ConsensusStorage<N>,
impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,
sourcepub fn finalize_store(
&self
) -> &FinalizeStore<N, <C as ConsensusStorage<N>>::FinalizeStorage>
pub fn finalize_store( &self ) -> &FinalizeStore<N, <C as ConsensusStorage<N>>::FinalizeStorage>
Returns the finalize store.
sourcepub fn block_store(
&self
) -> &BlockStore<N, <C as ConsensusStorage<N>>::BlockStorage>
pub fn block_store( &self ) -> &BlockStore<N, <C as ConsensusStorage<N>>::BlockStorage>
Returns the block store.
sourcepub fn transaction_store(
&self
) -> &TransactionStore<N, <C as ConsensusStorage<N>>::TransactionStorage>
pub fn transaction_store( &self ) -> &TransactionStore<N, <C as ConsensusStorage<N>>::TransactionStorage>
Returns the transaction store.
sourcepub fn transition_store(
&self
) -> &TransitionStore<N, <C as ConsensusStorage<N>>::TransitionStorage>
pub fn transition_store( &self ) -> &TransitionStore<N, <C as ConsensusStorage<N>>::TransitionStorage>
Returns the transition store.