Skip to content

Conversation

rezbera
Copy link
Contributor

@rezbera rezbera commented Jul 25, 2025

Adds inspection support for system transactions to enable tracing with debug_traceTransaction and debug_traceBlock APIs.

Changes

  • Added InspectSystemCallEvm trait extending InspectEvm and SystemCallEvm
  • Added InspectorHandler::inspect_run_system_call method for system call inspection
  • Implemented inspection support for mainnet EVM with comprehensive test coverage
  • Re-exported new traits in main revm crate

Closes #2798

@rezbera
Copy link
Contributor Author

rezbera commented Jul 25, 2025

tested with a system call in bera-reth and its working as intended (after updating alloy-evm + bera-reth ofc). The following tx is executed as a system tx, and is now traceable.

curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0xf13ff9cde2232ffece74532fc34110eaa38bb01d8cba415c9eba8390319030b6",{"tracer":"callTracer"}],"id":1}' \
      http://localhost:8545/ | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1097  100   935  100   162  11553   2001 --:--:-- --:--:-- --:--:-- 13712
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "from": "0xfffffffffffffffffffffffffffffffffffffffe",
    "gas": "0x1000000",
    "gasUsed": "0x42d9",
    "to": "0x4200000000000000000000000000000000000042",
    "input": "0x60644a6b000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000309070f3f3d1ef0bd7e3186f7945261291d9363005eb126c64660daec91d51514bbcc50e8fb1d0f632bad82f2901e43d7600000000000000000000000000000000",
    "calls": [
      {
        "from": "0x4200000000000000000000000000000000000042",
        "gas": "0x1c27be0",
        "gasUsed": "0x19f0",
        "to": "0x4200000000000000000000000000000000000043",
        "input": "0x999da65b000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000309070f3f3d1ef0bd7e3186f7945261291d9363005eb126c64660daec91d51514bbcc50e8fb1d0f632bad82f2901e43d7600000000000000000000000000000000",
        "value": "0x0",
        "type": "CALL"
      }
    ],
    "value": "0x0",
    "type": "CALL"
  }
}

Copy link

codspeed-hq bot commented Jul 25, 2025

CodSpeed Performance Report

Merging #2808 will not alter performance

Comparing rezbera:rezbera/add-system-tx-inspection (39142c8) with main (c2c4b3f)

Summary

✅ 171 untouched benchmarks

@rezbera rezbera marked this pull request as ready for review July 26, 2025 07:56
Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be added to op-revm

///
/// Similar to [`InspectEvm::inspect_one_tx`] but for system calls.
/// Uses [`SYSTEM_ADDRESS`] as the caller.
fn inspect_system_call_one(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inspection naming is inspect_one_tx so it would be nicer for this to be inspect_one_system_call

/// Inspect a system call with the current inspector and a custom caller.
///
/// Similar to [`InspectEvm::inspect_one_tx`] but for system calls with a custom caller.
fn inspect_system_call_with_caller_one(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inspect_one_system_call_with_caller

/// Inspect a system call with a given inspector.
///
/// Similar to [`InspectEvm::inspect_one`] but for system calls.
fn inspect_system_call_with_inspector_one(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn inspect_system_call_with_inspector_one(
fn inspect_one_system_call_with_inspector(

rezbera added 7 commits July 29, 2025 08:14
…ttern

- inspect_system_call_one -> inspect_one_system_call
- inspect_system_call_with_caller_one -> inspect_one_system_call_with_caller
- inspect_system_call_with_inspector_one -> inspect_one_system_call_with_inspector
- Implement InspectSystemCallEvm trait for OpEvm
- Add inspect_one_system_call_with_caller method
- Add comprehensive test for system call inspection functionality
- Remove unnecessary custom bytecode setup
- Use default context for cleaner test
- Format import statements in exec.rs
- Fix whitespace formatting in test functions
- Ensure consistent code style across files
This reverts commit fba9ceb.
@rezbera rezbera requested a review from rakita July 29, 2025 02:21
@rakita rakita merged commit 9008e93 into bluealloy:main Jul 29, 2025
30 checks passed
@rezbera rezbera deleted the rezbera/add-system-tx-inspection branch July 29, 2025 10:08
@github-actions github-actions bot mentioned this pull request Jul 29, 2025
@github-actions github-actions bot mentioned this pull request Aug 6, 2025
lwedge99 pushed a commit to sentioxyz/revm that referenced this pull request Sep 16, 2025
* att1

* cargo fmt

* reduce test bloat

* remove InspectSystemCallCommitEvm

* fix: rename system call inspection methods to match inspect_one_tx pattern

- inspect_system_call_one -> inspect_one_system_call
- inspect_system_call_with_caller_one -> inspect_one_system_call_with_caller
- inspect_system_call_with_inspector_one -> inspect_one_system_call_with_inspector

* feat: add system call inspection support to op-revm

- Implement InspectSystemCallEvm trait for OpEvm
- Add inspect_one_system_call_with_caller method
- Add comprehensive test for system call inspection functionality

* fix: simplify system call inspection test

- Remove unnecessary custom bytecode setup
- Use default context for cleaner test

* style: fix code formatting for CI

- Format import statements in exec.rs
- Fix whitespace formatting in test functions
- Ensure consistent code style across files

* trigger ci

* Revert "trigger ci"

This reverts commit fba9ceb.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat request: Add Inspecting support for System Transactons
2 participants