### Use Revm Execution API Source: https://github.com/bluealloy/revm/blob/main/README.md Example of setting up an EVM instance and transacting with it. Can also be used with inspectors for tracing. ```rust let mut evm = Context::mainnet().with_block(block).build_mainnet(); let out = evm.transact(tx); ``` ```rust let mut evm = evm.with_inspector(tracer); let out = evm.inspect_tx(tx); ``` -------------------------------- ### Integrating Custom EVM and Handler Source: https://github.com/bluealloy/revm/blob/main/examples/custom_precompile_journal/README.md Demonstrates the setup for using a custom EVM with a custom handler for transaction execution. Requires a database and an inspector. ```rust use custom_precompile_journal::{CustomEvm, CustomHandler}; use revm::{context::Context, inspector::NoOpInspector, MainContext}; // Create the custom EVM let context = Context::mainnet().with_db(db); let mut evm = CustomEvm::new(context, NoOpInspector); // Create the handler let handler = CustomHandler::>::default(); // Execute transactions let result = handler.run(&mut evm); ``` -------------------------------- ### Basic Custom EVM Usage Source: https://github.com/bluealloy/revm/blob/main/examples/my_evm/README.md Instantiate and run a custom EVM with a custom handler. This is the fundamental setup for a modified EVM execution. ```rust let mut my_evm = MyEvm::new(Context::mainnet(), ()); let _res = MyHandler::default().run(&mut my_evm); ``` -------------------------------- ### Clone and Build revm from Source Source: https://github.com/bluealloy/revm/blob/main/book/src/dev.md Use these commands to clone the revm repository and build the release version. Ensure you have Rust and Cargo installed. Clang is required for specific feature flags. ```bash git clone https://github.com/bluealloy/revm.git cd revm cargo build --release ``` -------------------------------- ### Event Logging with Log Callback Source: https://github.com/bluealloy/revm/blob/main/book/src/inspector.md Example of capturing and processing EVM events using the `log` callback. It demonstrates how to access the log's address, topics, and data. ```rust fn log(&mut self, _interp: &mut Interpreter, _ctx: &mut CTX, log: Log) { println!("LOG emitted from: {:?}", log.address); println!("Topics: {:?}", log.topics()); println!("Data: {}", hex::encode(log.data.data)); } ``` -------------------------------- ### Basic EVM Transaction Execution in Rust Source: https://github.com/bluealloy/revm/blob/main/book/src/architecture.md Instantiates an EVM with a given block context and executes a transaction. This is the fundamental way to run transactions and get results. ```rust let mut evm = Context::mainnet().with_block(block).build_mainnet(); let out = evm.transact(tx); ``` -------------------------------- ### Custom Inspector Implementation Source: https://github.com/bluealloy/revm/blob/main/book/src/inspector.md Example of creating a custom inspector by implementing the trait. This inspector tracks gas used and the number of calls made during execution. ```rust #[derive(Default)] struct MyInspector { gas_used: u64, call_count: usize, } impl Inspector for MyInspector { fn step(&mut self, interp: &mut Interpreter, _context: &mut CTX) { self.gas_used += interp.gas.spent(); } fn call(&mut self, _context: &mut CTX, _inputs: &mut CallInputs) -> Option { self.call_count += 1; None // Don't override the call } } ``` -------------------------------- ### Revme Command-Line Help Source: https://github.com/bluealloy/revm/blob/main/book/src/revme.md Displays the available commands and options for the Revme binary. Use this to understand the primary functionalities like running state tests or EVM bytecode. ```bash $: revme --help Usage: revme Commands: statetest Execute Ethereum state tests evm Run arbitrary EVM bytecode bytecode Print the structure of an EVM bytecode bench Run bench from specified list help Print this message or the help of the given subcommand(s) Options: -h, --help Print help ``` -------------------------------- ### Build and Test Workspace Source: https://github.com/bluealloy/revm/blob/main/AGENTS.md Commands for building, testing, and linting the entire REVM workspace. ```bash cargo build --workspace ``` ```bash cargo nextest run --workspace ``` ```bash cargo nextest run --workspace --no-default-features ``` ```bash cargo nextest run --workspace --all-features ``` ```bash cargo clippy --workspace --all-targets --all-features ``` ```bash cargo fmt --all --check ``` ```bash typos ``` -------------------------------- ### Running Legacy Ethereum State Tests Source: https://github.com/bluealloy/revm/blob/main/book/src/revme.md Execute legacy Ethereum state tests by first cloning the legacytests repository and then pointing Revme to the specific test directory. Ensure the correct path to the test suite is provided. ```bash git clone https://github.com/ethereum/legacytests cargo run --release -p revme -- statetest legacytests/Cancun/GeneralStateTests ``` -------------------------------- ### Build and Test Commands Source: https://github.com/bluealloy/revm/blob/main/CLAUDE.md Commands for building, testing, and linting the REVM workspace. Includes options for different features and targets. ```bash cargo build --workspace ``` ```bash cargo nextest run --workspace ``` ```bash cargo nextest run --workspace --no-default-features ``` ```bash cargo nextest run --workspace --all-features ``` ```bash cargo clippy --workspace --all-targets --all-features ``` ```bash cargo fmt --all --check ``` ```bash typos ``` ```bash cargo check --target riscv32imac-unknown-none-elf --no-default-features ``` ```bash cargo check --target riscv64imac-unknown-none-elf --no-default-features ``` ```bash cargo check --target riscv32imac-unknown-none-elf -p revm-database --no-default-features ``` ```bash cargo check --target riscv64imac-unknown-none-elf -p revm-database --no-default-features ``` ```bash ./scripts/run-tests.sh ``` ```bash cargo run --release -p revme -- statetest test-fixtures/main/develop/state_tests ``` -------------------------------- ### Journal Access Patterns in Precompiles Source: https://github.com/bluealloy/revm/blob/main/examples/custom_precompile_journal/README.md Shows how to interact with the journal for storage reads/writes, balance transfers, and balance increments within a precompile context. Ensure proper error handling for journal operations. ```rust let value = context .journal_mut() .sload(address, key) .map_err(|e| PrecompileError::Other(format!("Storage read failed: {:?}", e)))? .data; context .journal_mut() .sstore(address, key, value) .map_err(|e| PrecompileError::Other(format!("Storage write failed: {:?}", e)))?; context .journal_mut() .transfer(from, to, amount) .map_err(|e| PrecompileError::Other(format!("Transfer failed: {:?}", e)))?; context .journal_mut() .balance_incr(address, amount) .map_err(|e| PrecompileError::Other(format!("Balance increment failed: {:?}", e)))?; ``` -------------------------------- ### create_init_frame and CreateInputs::new Parameter Change Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md These functions now accept an additional `reservoir: u64` parameter for propagating state gas. ```rust create_init_frame and CreateInputs::new gained a trailing `reservoir: u64` param. ``` -------------------------------- ### Handler::pre_execution and apply_eip7702_auth_list Parameter Change Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md These functions now accept `&mut InitialAndFloorGas` to allow writing back state gas and refund information. ```rust Handler::pre_execution ``` ```rust apply_eip7702_auth_list ``` ```rust &mut InitialAndFloorGas ``` -------------------------------- ### Gas::new_with_regular_gas_and_reservoir Constructor Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Use this constructor for creating child frame gas with reservoir support. It replaces older methods for gas initialization. ```rust Gas::new_with_regular_gas_and_reservoir(limit, reservoir) ``` -------------------------------- ### Using Inspector with EVM Source: https://github.com/bluealloy/revm/blob/main/book/src/inspector.md Demonstrates how to integrate a custom inspector with the EVM. The inspector is passed during EVM construction, and its collected data can be accessed after execution. ```rust let inspector = MyInspector::default(); let mut evm = Context::mainnet() .with_db(db) .build_mainnet_with_inspector(inspector); // Execute with inspection let result = evm.inspect_one_tx(tx)?; println!("Gas used: {}", evm.inspector.gas_used); println!("Calls made: {}", evm.inspector.call_count); ``` -------------------------------- ### Run Ethereum State Tests Source: https://github.com/bluealloy/revm/blob/main/bins/revme/README.md Execute Ethereum state tests locally by cloning the tests repository and running the statetest subcommand with the path to the test directory. This verifies revm's compliance with Ethereum specifications. ```shell git clone https://github.com/ethereum/tests cargo run -p revme statetest tests/GeneralStateTests ``` -------------------------------- ### Running Ethereum State Tests with Revme Source: https://github.com/bluealloy/revm/blob/main/book/src/revme.md Execute Ethereum state tests by providing the path to the test folder. This command is used for validating EVM implementations against standard Ethereum test suites. ```bash cargo run --release -p revme -- statetest folder_path ``` -------------------------------- ### Run All revm-ee-tests Source: https://github.com/bluealloy/revm/blob/main/crates/ee-tests/README.md Execute all tests within the revm-ee-tests crate. This is the standard command for a full test suite run. ```bash cargo test -p revm-ee-tests ``` -------------------------------- ### Handler::first_frame_input Parameter Change Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `Handler::first_frame_input` parameter has changed from `init_and_floor_gas: &InitialAndFloorGas` to `reservoir: u64`. Compute reservoir using `InitialAndFloorGas::initial_gas_and_reservoir`. ```rust init_and_floor_gas: &InitialAndFloorGas ``` ```rust reservoir: u64 ``` ```rust InitialAndFloorGas::initial_gas_and_reservoir(tx_gas_limit, tx_gas_limit_cap, is_eip8037) -> (gas_limit, reservoir) ``` -------------------------------- ### ResultGas::new_with_state_gas Constructor Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Use this constructor for initializing ResultGas with state gas. It replaces the deprecated `ResultGas::new()` which now takes more parameters. ```rust ResultGas::new_with_state_gas(total_gas_spent, refunded, floor_gas, state_gas_spent) ``` -------------------------------- ### Format Code Source: https://github.com/bluealloy/revm/blob/main/AGENTS.md Command to ensure code formatting consistency across the project before committing. ```bash cargo fmt --all ``` -------------------------------- ### Run Test Script and State Tests Source: https://github.com/bluealloy/revm/blob/main/AGENTS.md Executes the project's test script and runs state tests using the revme CLI. ```bash ./scripts/run-tests.sh ``` ```bash cargo run --release -p revme -- statetest test-fixtures/main/develop/state_tests ``` -------------------------------- ### Handler::first_frame_input Parameter Change Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md This function now takes `&InitialAndFloorGas` to compute the reservoir for the first frame. ```rust Handler::first_frame_input gained `&InitialAndFloorGas` param ``` -------------------------------- ### PrecompileOutput::new with Reservoir Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md When creating a `PrecompileOutput`, include the reservoir parameter to account for state gas. This replaces older constructors that did not handle reservoir. ```rust PrecompileOutput::new(gas_used, bytes, reservoir) ``` -------------------------------- ### create_init_frame Parameter Change Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md This function now takes 2 parameters (previously 3) and gained a `CTX: ContextTr` generic. The reservoir is set by `first_frame_input` after creation. ```rust create_init_frame takes 2 params (was 3) ``` ```rust CTX: ContextTr ``` -------------------------------- ### Precompile::execute Reservoir Parameter Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `Precompile::execute` method now includes a reservoir parameter. Update any custom precompile logic to accommodate this change. ```rust Precompile::execute() also gained `reservoir: u64` param. ``` -------------------------------- ### InitialAndFloorGas Field Renaming and Additions Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `initial_gas` field is renamed to `initial_total_gas`. New fields `initial_state_gas` and `eip7702_reservoir_refund` are added. ```rust initial_total_gas ``` ```rust initial_state_gas ``` ```rust eip7702_reservoir_refund ``` -------------------------------- ### Check Target Specific Builds Source: https://github.com/bluealloy/revm/blob/main/AGENTS.md Commands to check code compilation for specific RISC-V targets, with and without default features. ```bash cargo check --target riscv32imac-unknown-none-elf --no-default-features ``` ```bash cargo check --target riscv64imac-unknown-none-elf --no-default-features ``` ```bash cargo check --target riscv32imac-unknown-none-elf -p revm-database --no-default-features ``` ```bash cargo check --target riscv64imac-unknown-none-elf -p revm-database --no-default-features ``` -------------------------------- ### Bytecode Constructor Replacements Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md New constructors for Bytecode instances, replacing older variants and handling analysis or auto-detection internally. ```rust Bytecode::new_legacy(raw_bytes) Bytecode::new_analyzed(bytecode, original_len, jump_table) Bytecode::new_eip7702(address) Bytecode::new_raw(bytes) ``` -------------------------------- ### Interpreter::clear and EthFrame::clear Parameter Increase Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md These methods now take an additional reservoir parameter. `Interpreter::clear` takes 7 params (was 6), and `EthFrame::clear` takes 11 (was 10). ```rust Interpreter::clear takes 7 params (was 6) ``` ```rust EthFrame::clear takes 11 (was 10) ``` -------------------------------- ### Run Specific revm-ee-tests Subset Source: https://github.com/bluealloy/revm/blob/main/crates/ee-tests/README.md Execute a specific subset of tests, such as EIP-8037 or TIP-1016 state gas tests. This is useful for focusing on particular features or bug fixes. ```bash cargo test -p revm-ee-tests eip8037 ``` -------------------------------- ### validate_initial_tx_gas Parameter Increase Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md This function now takes 5 parameters (previously 3), including `is_amsterdam_eip8037_enabled` and `tx_gas_limit_cap`. ```rust validate_initial_tx_gas takes 5 params (was 3) ``` ```rust is_amsterdam_eip8037_enabled ``` ```rust tx_gas_limit_cap ``` -------------------------------- ### State Inspection within step() Source: https://github.com/bluealloy/revm/blob/main/book/src/inspector.md Shows how to access interpreter state like program counter (PC), opcode, stack depth, and memory size within the `step` callback for detailed execution analysis. ```rust fn step(&mut self, interp: &mut Interpreter, _context: &mut CTX) { let pc = interp.bytecode.pc(); let opcode = interp.bytecode.opcode(); let stack_len = interp.stack.len(); let memory_size = interp.memory.size(); println!("PC: {}, Opcode: 0x{:02x}, Stack: {}, Memory: {}", pc, opcode, stack_len, memory_size); } ``` -------------------------------- ### ResultGas Methods Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Provides an overview of the methods available on the new ResultGas struct for accessing gas-related information. ```rust used() remaining() inner_refunded() final_refunded() spent_sub_refunded() ResultGas::new(limit, spent, refunded, floor_gas, intrinsic_gas) ``` -------------------------------- ### Host and Cfg Traits Method Addition Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `Host` and `Cfg` traits now require the `is_amsterdam_eip8037_enabled() -> bool` method. Implement this on custom types. ```rust is_amsterdam_eip8037_enabled() -> bool ``` -------------------------------- ### Execute and Commit Transaction with Custom EVM Source: https://github.com/bluealloy/revm/blob/main/examples/my_evm/README.md Utilize the ExecuteCommitEvm trait to execute transactions and commit database changes. Requires the database to implement DatabaseCommit. ```rust let mut my_evm = MyEvm::new(Context::mainnet().with_db(InMemoryDB::default()), ()); let _res = my_evm.transact_commit(TxEnv::default()); ``` -------------------------------- ### EthPrecompiles and EthInstructions Default Implementation Removal Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md `EthPrecompiles` and `EthInstructions` no longer implement `Default`. Use the `new` or `new_mainnet_with_spec` constructors instead, passing the required specification. ```rust // Before: EthPrecompiles::default() EthInstructions::default() EthInstructions::new_mainnet() // deprecated // After: EthPrecompiles::new(spec) EthInstructions::new_mainnet_with_spec(spec) ``` -------------------------------- ### StateBuilder::with_background_transition_merge Removed Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md This method was a no-op and has been removed. Remove any calls to it. ```rust StateBuilder::with_background_transition_merge ``` -------------------------------- ### Replace BTreeMap with BlockHashCache for Block Hashes Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `State::block_hashes` field has changed from `BTreeMap` to `BlockHashCache`, a ring buffer with O(1) complexity and 256 entries. This affects how block hashes are accessed and initialized. ```rust // Before: state.block_hashes.get(&block_num) StateBuilder::default().with_block_hashes(btree_map) // After: state.block_hashes.get(block_num) StateBuilder::default().with_block_hashes(block_hash_cache) ``` -------------------------------- ### PrecompileOutput::revert Usage Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Use `PrecompileOutput::revert()` instead of the removed `new_reverted()` method or `reverted()` accessor. ```rust PrecompileOutput::revert() ``` -------------------------------- ### PrecompileOutput Field Changes Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `gas_refunded` and `reverted` fields have been removed from `PrecompileOutput`. New fields `status: PrecompileStatus`, `state_gas_used`, and `reservoir` have been added. ```rust PrecompileOutput::new(gas_used, bytes, reservoir) ``` ```rust status: PrecompileStatus ``` ```rust state_gas_used ``` ```rust reservoir ``` -------------------------------- ### Custom EVM with Inspector Support Source: https://github.com/bluealloy/revm/blob/main/examples/my_evm/README.md Enable transaction inspection by implementing InspectorEvmTr and InspectorHandler traits. This allows integration with Revm's Inspector for transaction tracing. ```rust let mut my_evm = MyEvm::new(Context::mainnet(), revm::inspector::NoOpInspector); let _res = MyHandler::default().inspect_run(&mut my_evm); ``` -------------------------------- ### Replace Fixed-Bytes Hashmaps with Alloy-Core Types Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Hashmaps and Hashsets using fixed-byte types like `Address`, `B256`, and `U256` have been replaced with specialized types from `alloy-core` such as `AddressMap`, `AddressSet`, `B256Map`, and `U256Map`. Import these from `revm::primitives`. ```rust * `DatabaseCommit::commit()`: `HashMap` → `AddressMap`. * `JournalTr::warm_access_list()`: `HashMap>` → `AddressMap>`. * `JournalTr::warm_precompiles()`: `HashSet
` → `AddressSet`. * `JournalTr::precompile_addresses()`: returns `&AddressSet`. ``` -------------------------------- ### PrecompileFn Signature Update Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `PrecompileFn` signature now includes a reservoir parameter. Ensure your precompile implementations are updated to accept this. ```rust fn(&[u8], u64, u64) ``` -------------------------------- ### Bytecode Kind Accessor Methods Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Use these accessor methods to check the kind of Bytecode and retrieve specific information, replacing pattern matching on enum variants. ```rust bytecode.kind() bytecode.is_legacy() bytecode.is_eip7702() bytecode.eip7702_address() bytecode.legacy_jump_table() ``` -------------------------------- ### Handler::validate_against_state_and_deduct_caller Parameter Change Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md This function now requires a `&mut InitialAndFloorGas` parameter. ```rust Handler::validate_against_state_and_deduct_caller ([#3577](https://github.com/bluealloy/revm/pull/3577)): gained `&mut InitialAndFloorGas` param. ``` -------------------------------- ### Inspect and Replay Transaction with Custom EVM Source: https://github.com/bluealloy/revm/blob/main/examples/my_evm/README.md Employ the InspectEvm trait for monitoring execution without committing changes. Allows for inspection before and after committing. ```rust let mut my_evm = MyEvm::new(Context::mainnet(), revm::inspector::NoOpInspector); // Inspect without committing let _res = my_evm.inspect_replay(); // Inspect and commit let _res = my_evm.inspect_commit_replay(); ``` -------------------------------- ### Update apply_auth_list function signature Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Shows the change in the function signature for apply_auth_list before and after the update. ```rust // Before: apply_auth_list(context, auth_list, journal) // After: apply_auth_list(context, auth_list, journal, refund_per_auth) ``` -------------------------------- ### Gas::spent and record_cost Deprecation Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md These methods are deprecated. Use `total_gas_spent()`, `record_regular_cost()`, and `record_state_cost()` instead. ```rust Gas::spent() ``` ```rust record_cost() ``` ```rust total_gas_spent() ``` ```rust record_regular_cost() ``` ```rust record_state_cost() ``` -------------------------------- ### Execute Transaction with Custom EVM Source: https://github.com/bluealloy/revm/blob/main/examples/my_evm/README.md Use the ExecuteEvm trait for a simplified transaction execution interface. This abstracts away handler complexity. ```rust let mut my_evm = MyEvm::new(Context::mainnet(), ()); // Execute a new transaction let _result_and_state = my_evm.transact(TxEnv::default()); // Replay the last transaction let _res_and_state = my_evm.replay(); ``` -------------------------------- ### MemoryGas Functions Removed Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `MemoryGas::record_new_len` and `memory_gas` functions have been removed. Update any code relying on these functions. ```rust MemoryGas::record_new_len ``` ```rust memory_gas ``` -------------------------------- ### EIP-161 state clear moved to journal finalize Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Pre-EIP-161 normalization is now handled by `JournalInner::finalize()`. Several fields and methods related to state clear flags have been removed from `CacheState` and `State`. ```rust // Before: CacheState::new(true) state_builder.without_state_clear() // After: CacheState::new() // (no replacement needed — journal handles it) ``` -------------------------------- ### Inspector Frame Hooks Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md New `frame_start` and `frame_end` methods have been added to the Inspector trait with default implementations. Use these to hook into the frame lifecycle. ```rust Inspector `frame_start` and `frame_end` methods added with default impls ``` -------------------------------- ### Add logs to ExecutionResult::Revert and Halt Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md Before this change, `Revert` and `Halt` variants did not carry logs. This update adds a `logs: Vec` field to both variants. This is specific to the revm variant (Tempo) and not applicable to Ethereum. ```rust // Before: ExecutionResult::Revert { gas, output } ExecutionResult::Halt { reason, gas } // After: ExecutionResult::Revert { gas, logs, output } ExecutionResult::Halt { reason, gas, logs } ``` -------------------------------- ### Call Override with Custom Outcome Source: https://github.com/bluealloy/revm/blob/main/book/src/inspector.md Illustrates how to override a specific contract call by returning a custom `CallOutcome`. This allows for injecting custom logic or pre-defined results for certain calls. ```rust fn call(&mut self, _context: &mut CTX, inputs: &mut CallInputs) -> Option { if inputs.target_address == SPECIAL_ADDRESS { // Override this call with custom logic return Some(CallOutcome::new( InterpreterResult::new(InstructionResult::Return, Bytes::from("custom")), 0..0 )); } None // Let normal execution continue } ``` -------------------------------- ### EVM Transaction Execution with Inspector in Rust Source: https://github.com/bluealloy/revm/blob/main/book/src/architecture.md Configures an EVM with an inspector for detailed tracing and observation during transaction execution. This is used for debugging and analysis. ```rust let mut evm = Context::mainnet().with_block(block).build_mainnet().with_inspector(inspector); let _ = evm.inspect_tx(tx); ``` -------------------------------- ### PrecompileError::other and is_oog Removed Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `PrecompileError::other()`, `other_static()`, and `is_oog()` methods have been removed. ```rust PrecompileError::other() ``` ```rust other_static() ``` ```rust is_oog() ``` -------------------------------- ### Execute System Call with Custom EVM Source: https://github.com/bluealloy/revm/blob/main/examples/my_evm/README.md Use the SystemCallEvm trait to execute system transactions, bypassing most ordinary transaction validation and pre-execution phases. Useful for pre or post-block state manipulation. ```rust let mut my_evm = MyEvm::new(Context::mainnet(), revm::inspector::NoOpInspector); // System call with given input to system contract address. let _res = my_evm.system_call_one(SYSTEM_ADDRESS, address!("f529c70db0800449ebd81fbc6e4221523a989f05"), bytes!("0x0001")); ``` -------------------------------- ### Update Handler::execution_result Signature Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md The `execution_result` function signature in `Handler` has been updated to include a `ResultGas` parameter. The `post_execution::output()` function now also requires this parameter. ```rust // Before: fn execution_result(&mut self, evm, result) -> Result // After: fn execution_result(&mut self, evm, result, result_gas: ResultGas) -> Result ``` -------------------------------- ### EVMError::CustomAny Variant Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md A new `EVMError::CustomAny(AnyError)` variant has been added. Update any exhaustive matches on `EVMError` to include this new variant. ```rust EVMError::CustomAny(AnyError) ``` -------------------------------- ### ResultGas::spent and used Deprecation Source: https://github.com/bluealloy/revm/blob/main/MIGRATION_GUIDE.md These methods are deprecated. Use `total_gas_spent()` and `tx_gas_used()` respectively. New accessors `state_gas_spent()`, `block_regular_gas_used()`, and `block_state_gas_used()` are available. ```rust ResultGas::spent() ``` ```rust used() ``` ```rust total_gas_spent() ``` ```rust tx_gas_used() ``` ```rust state_gas_spent() ``` ```rust block_regular_gas_used() ``` ```rust block_state_gas_used() ```