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

source

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

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

source§

impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,

source

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.

source

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

source

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.

source

pub fn execute_authorization<R>( &self, authorization: Authorization<N>, fee: Option<Fee<N>>, 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 for the given authorization.

source§

impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,

source

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.

source

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

source

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

pub fn finalize( &self, state: FinalizeGlobalState, transactions: &Transactions<N> ) -> Result<(), Error>

Finalizes the given transactions into the VM.

source§

impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,

source

pub fn verify_transaction( &self, transaction: &Transaction<N>, rejected_id: Option<Field<N>> ) -> bool

Returns true if the transaction is valid.

source

pub fn verify_deployment(&self, deployment: &Deployment<N>) -> bool

Returns true if the deployment is valid.

source

pub fn verify_execution(&self, execution: &Execution<N>) -> bool

Returns true if the execution is valid.

source

pub fn verify_fee( &self, fee: &Fee<N>, deployment_or_execution_id: Field<N> ) -> bool

Returns true if the fee is valid.

source

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

source

pub fn from(store: ConsensusStore<N, C>) -> Result<VM<N, C>, Error>

Initializes the VM from storage.

source

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

Returns true if a program with the given program ID exists.

source

pub fn process(&self) -> Arc<RwLock<RawRwLock, Process<N>>>

Returns the process.

source§

impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,

source

pub fn finalize_store( &self ) -> &FinalizeStore<N, <C as ConsensusStorage<N>>::FinalizeStorage>

Returns the finalize store.

source

pub fn block_store( &self ) -> &BlockStore<N, <C as ConsensusStorage<N>>::BlockStorage>

Returns the block store.

source

pub fn transaction_store( &self ) -> &TransactionStore<N, <C as ConsensusStorage<N>>::TransactionStorage>

Returns the transaction store.

source

pub fn transition_store( &self ) -> &TransitionStore<N, <C as ConsensusStorage<N>>::TransitionStorage>

Returns the transition store.

source§

impl<N, C> VM<N, C>where N: Network, C: ConsensusStorage<N>,

source

pub fn genesis<R>( &self, private_key: &PrivateKey<N>, rng: &mut R ) -> Result<Block<N>, Error>where R: Rng + CryptoRng,

Returns a new genesis block.

source

pub fn add_next_block(&self, block: &Block<N>) -> Result<(), Error>

Adds the given block into the VM.

Trait Implementations§

source§

impl<N, C> Clone for VM<N, C>where N: Clone + Network, C: Clone + ConsensusStorage<N>,

source§

fn clone(&self) -> VM<N, C>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<N, C> !RefUnwindSafe for VM<N, C>

§

impl<N, C> Send for VM<N, C>

§

impl<N, C> Sync for VM<N, C>

§

impl<N, C> Unpin for VM<N, C>where C: Unpin, N: Unpin,

§

impl<N, C> !UnwindSafe for VM<N, C>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

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

§

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