VM Execution Result#

Result Kinds#

Return

Represents successful execution of a sub-VM

VMError

Represents a VM produced error, such as non-zero exit code or exceeding resource limits.

It uses predefined string error codes.

UserError

Represents a user-produced error in utf-8 format.

InternalError#

It is a special Result Kinds that represents an internal error in the VM, such as: Host communication failures or Module unavailability.

Internal errors are not visible by the contracts. Most likely Host will vote timeout if encounters such an error

Non-Deterministic Block Result Encoding#

Contract Result Encoding#

Return#

Arbitrary structure in Calldata Encoding

UserError and VMError#

Calldata Encoding encoding of

{
  "message": "<error_message_string>",
  "fingerprint": {
    "frames": [
      {
        "module_name": "<module_name>",
        "func": "<number: function_index>"
      }
    ],
    "module_instances": {
      "<module_name>": {
        "memories": [
          "<bytes: 32_byte_blake3_hash>"
        ]
      }
    }
  }
}

For sake of preventing skipping execution for error results, validators are obligated to calculate VM fingerprint on error.

Fingerprint is serialized using Calldata Encoding to be deterministic, and has following structure:

  1. Frames are ordered from most recent to oldest one (most likely, _start)

  2. Function index is an index of function in WASM module

  3. Memories are ordered by their index in WASM module

  4. Memories are hashed using BLAKE3 hash function, which is cryptographically secure and provides acceptable performance