[][src]Crate libra_vm

The VM runtime

Transaction flow

This is the path taken to process a single transaction.

                  SignedTransaction
                           +
                           |
+--------------------------|-------------------+
| Validate  +--------------+--------------+    |
|           |                             |    |
|           |       check signature       |    |
|           |                             |    |
|           +--------------+--------------+    |
|                          |                   |
|                          |                   |
|                          v                   |
|           +--------------+--------------+    |
|           |                             |    |
|           |      check size and gas     |    |
|           |                             |    +---------------------------------+
|           +--------------+--------------+    |         validation error        |
|                          |                   |                                 |
|                          |                   |                                 |
|                          v                   |                                 |
|           +--------------+--------------+    |                                 |
|           |                             |    |                                 |
|           |         run prologue        |    |                                 |
|           |                             |    |                                 |
|           +--------------+--------------+    |                                 |
|                          |                   |                                 |
+--------------------------|-------------------+                                 |
                           |                                                     |
+--------------------------|-------------------+                                 |
|                          v                   |                                 |
|  Verify   +--------------+--------------+    |                                 |
|           |                             |    |                                 |
|           |     deserialize script,     |    |                                 |
|           |     verify arguments        |    |                                 |
|           |                             |    |                                 |
|           +--------------+--------------+    |                                 |
|                          |                   |                                 |
|                          |                   |                                 v
|                          v                   |                    +----------------+------+
|           +--------------+--------------+    |                    |                       |
|           |                             |    +------------------->+ discard, no write set |
|           |     deserialize modules     |    | verification error |                       |
|           |                             |    |                    +----------------+------+
|           +--------------+--------------+    |                                 ^
|                          |                   |                                 |
|                          |                   |                                 |
|                          v                   |                                 |
|           +--------------+--------------+    |                                 |
|           |                             |    |                                 |
|           | verify scripts and modules  |    |                                 |
|           |                             |    |                                 |
|           +--------------+--------------+    |                                 |
|                          |                   |                                 |
+--------------------------|-------------------+                                 |
                           |                                                     |
+--------------------------|-------------------+                                 |
|                          v                   |                                 |
| Execute   +--------------+--------------+    |                                 |
|           |                             |    |                                 |
|           |        execute main         |    |                                 |
|           |                             |    |                                 |
|           +--------------+--------------+    |                                 |
|                          |                   |                                 |
|      success or failure  |                   |                                 |
|                          v                   |                                 |
|           +--------------+--------------+    |                                 |
|           |                             |    +---------------------------------+
|           |        run epilogue         |    | invariant violation (internal panic)
|           |                             |    |
|           +--------------+--------------+    |
|                          |                   |
|                          |                   |
|                          v                   |
|           +--------------+--------------+    |                    +-----------------------+
|           |                             |    | execution failure  |                       |
|           |       make write set        +------------------------>+ keep, only charge gas |
|           |                             |    |                    |                       |
|           +--------------+--------------+    |                    +-----------------------+
|                          |                   |
+--------------------------|-------------------+
                           |
                           v
            +--------------+--------------+
            |                             |
            |  keep, transaction executed |
            |        + gas charged        |
            |                             |
            +-----------------------------+

Re-exports

pub use crate::libra_transaction_executor::LibraVM;
pub use crate::libra_transaction_validator::LibraVMValidator;

Modules

data_cache

Scratchpad for on chain values during the execution.

libra_transaction_executor
libra_transaction_validator
logging
system_module_names

Names of modules, functions, and types used by Libra System.

transaction_metadata

Traits

VMExecutor

This trait describes the VM's execution interface.

VMValidator

This trait describes the VM's validation interfaces.

Functions

txn_effects_to_writeset_and_events