Skip to main content

Module revm

Module revm 

Source
Expand description

Integration of the Revm EVM runtime with Linera.

This module provides the glue between Linera’s blockchain infrastructure and the Revm EVM interpreter, enabling Ethereum smart contracts to run on Linera chains.

§Architecture

The integration consists of several key components:

  • Database Trait Implementations: Adapts Linera’s storage layer to Revm’s Database and DatabaseRef traits (see database.rs).

  • Inspector Pattern: Intercepts EVM operations like contract creation and calls to bridge between Revm’s execution model and Linera’s runtime requirements.

  • Precompiles: Extends standard Ethereum precompiles with Linera-specific functionality accessible from EVM contracts.

  • Contract/Service Modules: Provides both contract (mutable) and service (read-only query) execution modes for EVM bytecode.

§Cross-Contract Communication

EVM contracts running on Linera can interact with each other using fictional selectors (see GET_ACCOUNT_INFO_SELECTOR, etc.) that don’t correspond to real EVM functions but enable internal protocol operations like querying state from other contracts or committing changes across contract boundaries.

Structs§

RevmContractInstance
An instance of a user contract running on the Revm EVM.
RevmServiceInstance
An instance of a user service running on the Revm EVM.

Enums§

EvmContractModule
A user contract in a compiled EVM module.
EvmServiceModule
A user service in a compiled EVM module.

Constants§

ALREADY_CREATED_CONTRACT_SELECTOR
Fictional selector for creating a contract from a pre-populated account.
COMMIT_CONTRACT_CHANGES_SELECTOR
Fictional selector for internal cross-contract calls to commit state changes.
GET_ACCOUNT_INFO_SELECTOR
Fictional selector for internal cross-contract calls to retrieve account information.
GET_CONTRACT_STORAGE_SELECTOR
Fictional selector for internal cross-contract calls to retrieve storage values.
JSON_EMPTY_VECTOR
The JSON serialization of an empty vector: [].

Functions§

address_to_user_application_id
Converts an EVM address into the corresponding Linera application ID.