Crates.io | aptos-vm |
lib.rs | aptos-vm |
version | 0.2.7 |
source | src |
created_at | 2022-05-26 19:11:28.885211 |
updated_at | 2022-08-16 07:46:23.558787 |
description | Aptos VM runtime |
homepage | https://aptoslabs.com |
repository | https://github.com/aptos-labs/aptos-core |
max_upload_size | |
id | 594326 |
size | 198,204 |
The MoveVM runtime is the verification and execution engine for the Move bytecode format. The runtime is imported and loaded in 2 modes: verification mode (by the admission control and mempool components) and execution mode (by the execution component).
The MoveVM runtime is a stack machine. The VM runtime receives as input a block which is a list of transaction scripts and a data view. The data view is a read only snapshot of the data and code in the blockchain at a given version (i.e., block height). At the time of startup, the runtime does not have any code or data loaded. It is effectively “empty”.
Every transaction executes within the context of a Aptos account---specifically the transaction submitter's account. The execution of every transaction consists of three parts: the account prologue, the transaction itself, and the account epilogue. This is the only transaction flow known to the runtime, and it is the only flow the runtime executes. The runtime is responsible to load the individual transaction from the block and execute the transaction flow:
success
or failure
depending upon the
result of running the prologue. No updates to the blockchain state are
ever performed by the prologue.During execution, the runtime resolves references to code by loading the referenced code via the data view. One can think of this process as similar to linking. Then, within the context of a block of transactions---a list of transactions coupled with a data view---the runtime caches code and linked and imported modules across transactions within the block. The runtime tracks state changes (data updates) from one transaction to the next within each block of transactions; the semantics of the execution of a block specify that transactions are sequentially executed and, as a consequence, state changes of previous transactions must be visible to subsequent transactions within each block.
runtime
and diem vm
related
code.process_txn
module..
├── src # VM Runtime files
│ ├── code_cache # VM Runtime code cache
│ ├── loaded_data # VM Runtime loaded data types, runtime caches over code
│ ├── unit_tests # unit tests
├── vm-cache-map # abstractions for the code cache
This crate is mainly used in two parts: AC and mempool use it to determine if it should accept a transaction or not; the Executor runs the MoveVM runtime to execute the program field in a SignedTransaction and convert it into a TransactionOutput, which contains a writeset that the executor need to patch to the blockchain as a side effect of this transaction.