MCPcopy Index your code
hub / github.com/FuelLabs/fuel-vm

github.com/FuelLabs/fuel-vm @v0.66.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.66.4 ↗ · + Follow
3,655 symbols 16,441 edges 291 files 723 documented · 20% updated 35d agov0.66.4 · 2026-04-29★ 37233 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Fuel execution environment

builddiscord

The repository contains crates implementing the FuelVM specification used by fuel-core and the Sway compiler.

Crates living here

Crate Version Description
fuel-asm crates.io Contains the FuelVM instruction set - opcodes used by the Sway and VM.
fuel-compression crates.io DA-layer compression of Fuel transaction types
fuel-crypto crates.io Cryptographic primitives used across Fuel Rust based projects.
fuel-merkle crates.io Implementations of the Merkle Tree used by the fuel-core to fulfill fraud proofs requirements, and fuel-tx to validate transaction validity.
fuel-storage crates.io Storage abstraction is used to connect FuelVM, fuel-merkle, and fuel-core together without direct access.
fuel-tx crates.io Contains a definition of types from the specification, with canonical serialization and deserialization. The Transaction and Checked<Tx> type implements fee calculation and validation of rules defined by the specification.
fuel-types crates.io Atomic types are used by almost all Fuel Rust-based crates. The crate defines the most common entities and implements their serialization/deserialization.
fuel-vm crates.io The VM itself executes fuel-asm opcodes generated by the Sway compiler. It is used as a core component of the fuel-core block executor to validate, estimate, and execute Create and Script transactions.

Testing

The ci_checks.sh script file can be used to run all CI checks, including the running of tests.

source ci_checks.sh

The script requires pre-installed tools. For more information run:

cat ci_checks.sh

Bug reporting and reproduction

If you find any bug or unexpected behavior, please open an issue. It would be helpful to provide a scenario of how to reproduce the problem: - A text description of the problem(maybe with links) - A runnable script with instruction - A repository with reproduction code and instructions on how to compile/run - A unit test with the usage of the pure opcodes from fuel-asm

How to use pure opcodes

The fuel-vm has many unit tests, almost for each opcode. Supporting a huge test codebase requires proper test utils that you can re-use to reproduce a bug.

Add a new test case

If a specific opcode has unexpected behaviors, maybe there is a unit test already that you can reuse to reproduce a bug. You need to add a new test_case like:

#[test_case(JumpMode::RelativeIS, 0, 0, 100 => Ok(4); "is-relative jump")]

Before the test and run this specific test or all tests.

Build custom scripts

If you need to write your own specific script and run it, you can use test_helpers::run_script.

For example:

#[test]
fn dynamic_call_frame_ops_bug_missing_ssp_check() {
    let ops = vec![
        op::cfs(RegId::SP),
        op::slli(0x10, RegId::ONE, 26),
        op::aloc(0x10),
        op::sw(RegId::ZERO, 0x10, 0),
        op::ret(RegId::ONE),
    ];
    let receipts = run_script(ops);
    assert_panics(&receipts, PanicReason::MemoryOverflow);
}

It returns receipts that contain result of execution. The assert_panics can be used to check for panics.

Build custom transactions

The fuel-tx provides fuel_tx::TransactionBuilder that simplifies the building of custom transaction for testing purposes.

You can check how TransactionBuilder::script or TransactionBuilder::create are used for better understanding.

Extension points exported contracts — how you extend this code

IntoChecked (Interface)
Performs checks for a transaction [7 implementers]
fuel-vm/src/checked_transaction.rs
Serialize (Interface)
Allows serialize the type into the `Output`. https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/tx_format [10 …
fuel-types/src/canonical.rs
Compressible (Interface)
This type can be compressed to a more compact form and back using `CompressibleBy` and `DecompressibleBy` traits. [11 …
fuel-compression/src/traits.rs
Mappable (Interface)
Mappable type with `Key` and `Value`. # Example ```rust use fuel_storage::Mappable; pub struct Contract; impl Mappabl [17 …
fuel-storage/src/lib.rs
PrepareSign (Interface)
Prepares transaction for signing. [6 implementers]
fuel-tx/src/transaction/id.rs
CheckRegId (Interface)
Type is convertible to a [`RegId`] [2 implementers]
fuel-asm/src/lib.rs
KeyFormatting (Interface)
(no doc) [2 implementers]
fuel-merkle/src/common/node.rs
MerkleTreeTestAdaptor (Interface)
(no doc) [1 implementers]
fuel-merkle/test-helpers/src/data/sparse.rs

Core symbols most depended-on inside this repo

iter
called by 443
fuel-merkle/src/common/position_path.rs
push
called by 432
fuel-vm/src/interpreter/receipts.rs
clone
called by 405
fuel-merkle/src/sparse/merkle_tree/node.rs
extend
called by 303
fuel-crypto/src/hasher.rs
into_iter
called by 219
fuel-vm/src/storage/blob_data.rs
insert
called by 210
fuel-merkle/src/sparse/merkle_tree.rs
check
called by 191
fuel-tx/src/transaction/validity.rs
gas_costs
called by 167
fuel-vm/src/transactor.rs

Shape

Method 1,827
Function 1,379
Class 261
Interface 104
Enum 84

Languages

Rust100%

Modules by API surface

fuel-tx/src/transaction/consensus_parameters/gas.rs147 symbols
fuel-tx/src/transaction.rs120 symbols
fuel-tx/src/transaction/consensus_parameters.rs83 symbols
fuel-vm/src/checked_transaction.rs76 symbols
fuel-vm/src/tests/blockchain.rs74 symbols
fuel-tx/src/transaction/types/input.rs66 symbols
fuel-vm/src/interpreter/memory.rs65 symbols
fuel-vm/src/interpreter.rs64 symbols
fuel-merkle/src/sparse/merkle_tree.rs63 symbols
fuel-tx/src/builder.rs60 symbols
fuel-vm/src/util.rs56 symbols
fuel-merkle/src/sparse/merkle_tree/node.rs55 symbols

For agents

$ claude mcp add fuel-vm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact