Virtual Machine

MoveVM performs the transactions represented in the Move bytecode. There are two main packages: core VM and VM runtime. core VM contains the underlying VM data types - mainly file formats and upper level abstractions. It also defines the gas measurement logic abstraction.

MoveVM is a stacked computer with a static type system. The structure of the file format allows the definition of modules, types (resource and unrestricted types) and functions. The code is represented by bytecode directives that may refer to external functions and types. The file format also enforces the use of certain invariants of the language, such as hidden types and private fields. It is clear from the file format definition that the module defines the scope/namespace for functions and types. Types are opaque because all fields are private, and types do not carry any functions or methods.

The MoveVM core crate provides the definition of the file format and all utilities related to the file format:

ยท A simple Rust abstraction over the file format (XMETA/language/vm/src/file_format.rs) and the bytecodes. These Rust structures are widely used in the code base.

ยท Serialization and deserialization of the file format. These define the on-chain binary representation of the code.

ยท Some pretty printing functionalities.

ยท A proptest infrastructure for the file format.

ยท The gas cost/synthesis infrastructure.

The CompiledModule and CompiledScript definitions in XMETA/language/vm/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 CompiledModules and CompiledScripts.

Last updated