pub struct Interpreter<S, Tx = ()> { /* private fields */ }
Expand description

VM interpreter.

The internal state of the VM isn’t expose because the intended usage is to either inspect the resulting receipts after a transaction execution, or the resulting mutated transaction.

These can be obtained with the help of a crate::transactor::Transactor or a client implementation.

Implementations§

Create a new interpreter instance out of a storage implementation.

If the provided storage implements crate::storage::InterpreterStorage, the returned interpreter will provide full functionality.

Set the consensus parameters for the interpreter

Build the interpreter

Create a new interpreter without a storage backend.

It will have restricted capabilities.

Create a new storage with a provided in-memory storage.

It will have full capabilities.

Execute the current instruction pair located in $m[$pc].

Execute a provided instruction

Initialize the VM with the provided transaction and check all predicates defined in the inputs.

The storage provider is not used since contract opcodes are not allowed for predicates. This way, its possible, for the sake of simplicity, it is possible to use unit as storage provider.

Debug

This is not a valid entrypoint for debug calls. It will only return a bool, and not the VM state required to trace the execution steps.

Allocate internally a new instance of Interpreter with the provided storage, initialize it with the provided transaction and return the result of th execution in form of StateTransition

Initialize a pre-allocated instance of Interpreter with the provided transaction and execute it. The result will be bound to the lifetime of the interpreter and will avoid unnecessary copy with the data that can be referenced from the interpreter instance itself.

Deploys Create transaction without initialization VM and without invalidation of the last state of execution of the Script transaction.

Returns Create transaction with all modifications after execution.

Prepare a call instruction for execution

Initialize the VM for a predicate context

Initialize the VM with a given transaction, backed by a storage provider that allows execution of contract opcodes.

For predicate verification, check Self::init_predicate

Returns the current state of the VM memory

Returns the current state of the registers

Debug handler

The current transaction.

The initial balances.

Consensus parameters

Receipts generated by a transaction execution.

Trait Implementations§

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Calculate the base32 serialized length
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Error type if conversion fails
Check if all values are in range and return array-like struct of u5 values

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more
Convert Self to base32 vector
Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more
Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more