Crate diem_vm

source ·
Expand description

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::diem_vm::DiemVM;

Modules

Macros

Traits

  • This trait describes the VM’s execution interface.
  • This trait describes the VM’s validation interfaces.

Functions