Crates.io | mv-binary-format |
lib.rs | mv-binary-format |
version | 0.3.2 |
source | src |
created_at | 2022-05-22 21:13:20.082819 |
updated_at | 2022-08-23 18:49:57.499146 |
description | Move Binary Format |
homepage | https://diem.com |
repository | https://github.com/diem/diem |
max_upload_size | |
id | 591442 |
size | 430,101 |
The MoveVM executes transactions expressed in the Move bytecode. There are two main crates: the core VM and the VM runtime. The VM core contains the low-level data type for the VM - mostly the file format and abstraction over it. A gas metering logical abstraction is also defined there.
The MoveVM is a stack machine with a static type system. The MoveVM honors the specification of the Move language through a mix of file format, verification (for reference bytecode verifier README) and runtime constraints. The structure of the file format allows the definition of modules, types (resources and unrestricted types), and functions. Code is expressed via bytecode instructions, which may have references to external functions and types. The file format also imposes certain invariants of the language such as opaque types and private fields. From the file format definition it should be clear that modules define a scope/namespace for functions and types. Types are opaque given all fields are private, and types carry no functions or methods.
The MoveVM core crate provides the definition of the file format and all utilities related to the file format:
diem/language/move-binary-format/src/file_format.rs
) and the bytecodes. These Rust
structures are widely used in the code base.The CompiledModule
and CompiledScript
definitions in
diem/language/move-binary-format/src/file_format.rs
are the top-level structs for a Move
Module or Transaction Script, respectively. These structs provide a
simple abstraction over the file format. Additionally, a set of
Views are defined to easily navigate and inspect
CompiledModule
s and CompiledScript
s.
.
├── src # VM core files
├── tests # Proptests
└── vm-runtime # Interpreter and runtime data types (see README in that folder)