Adapter
Move Adapter
The Move VM was built to be platform-agnostic, hence it lacks blockchain specific concepts like transactions, accounts, storage, etc. The VM treats these components as black boxes which it can access through a simple API interface.
The Move Adapter's job is to provide this interface to the VM, and to translate the VM's requests to the blockchain's native concepts and vice versa. It is for this reason that the majority of our development effort was spent on the Move Adapter and the execution client during the first phase of the prototyping project.
Adapter's goal
Strictly speaking, the adapter's job is to execute transactions and produce a write set to be committed to the ledger. Before we can execute a transaction however, we need to make sure that:
- it is well-formed, i.e. syntactically correct
- has a valid signature,
- the objects being referenced by object id do exist, with correct version number and matching digests in the case of owned/immutable objects,
- aforementioned objects are accessible by the sender of the transaction,
- transaction fields respect the protocol rules (max number of arguments, etc.)
- gas payment object(s) can cover the maximum budget of the transaction.
This list of operations is done at the iota-node level. During execution of:
fn prepare_certificate(
&self,
_execution_guard: &ExecutionLockReadGuard<'_>,
certificate: &VerifiedExecutableTransaction,
input_objects: InputObjects,
epoch_store: &Arc<AuthorityPerEpochStore>,
) -> IotaResult<(InnerTemporaryStore, TransactionEffects, Option<ExecutionError>)>
Therefore, the adapter assumes these checks have already been performed.
Adapter's main components
- Execution engine
- Move VM
- Gas charger
- Temporary store
Gas charger
- Tracks all gas operations for a single transaction.
- This is the main entry point for gas accounting.
- All the information about gas is stored in this object.
Execution engine
Set of methods aimed at executing transactions.
execute_transaction_to_effects
execute_genesis_state_update
execute_transaction
execution_loop
Execution engine is the component that manages a transaction execution and the overlying infrastructure. It adds functionalities on top of the MoveVM (not related to the iota-framework, but for instance it manages all the transaction kinds: transfer object, transfer iota, pay iota, function call, etc.)
Move VM
The role of the Move Virtual Machine is to execute a transaction from a global state and produce some transaction effects representing modifications to the global state. The effects can then be applied to the global state to generate a new global state resulting from the execution. In other words, the main purpose is executing transactions to effects.
Temporary store
Backing storage. During the Move call execution, it retrieves package information on-chain, avoiding the need to provide package information with input objects. Also used as a cache that is used after the execution to populate the created/modified/deleted objects references in the transaction effects.