Skip to content

feat(tracer): Implement txGasDimensionLogger and txGasDimensionByOpcode custom tracers#554

Merged
AnkushinDaniil merged 8 commits intomainfrom
daniil/feature/gas-dimension-tracers
Jan 19, 2026
Merged

feat(tracer): Implement txGasDimensionLogger and txGasDimensionByOpcode custom tracers#554
AnkushinDaniil merged 8 commits intomainfrom
daniil/feature/gas-dimension-tracers

Conversation

@AnkushinDaniil
Copy link
Collaborator

@AnkushinDaniil AnkushinDaniil commented Jan 14, 2026

Fixes #556
Implement txGasDimensionLogger and txGasDimensionByOpcode custom tracers for multi-dimensional gas analysis

Dependencies

@AnkushinDaniil AnkushinDaniil force-pushed the daniil/feature/gas-dimension-tracers branch 2 times, most recently from e36e8df to 95e1792 Compare January 14, 2026 13:02
@AnkushinDaniil AnkushinDaniil changed the title Daniil/feature/gas dimension tracers feat(tracer): Implement txGasDimensionLogger and txGasDimensionByOpcode custom tracers Jan 14, 2026
@AnkushinDaniil AnkushinDaniil marked this pull request as ready for review January 14, 2026 14:20
Copilot AI review requested due to automatic review settings January 14, 2026 14:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements two custom tracers for multi-dimensional gas analysis in Arbitrum: txGasDimensionLogger for per-opcode gas dimension breakdown and txGasDimensionByOpcode for aggregated gas analysis by opcode type. These tracers enable detailed tracking of gas consumption across different resource dimensions (computation, storage access, storage growth, and history growth).

Changes:

  • Added TxGasDimensionLoggerTracer and TxGasDimensionByOpcodeTracer for multi-dimensional gas tracking
  • Enhanced IArbitrumTxTracer interface with gas dimension capture methods
  • Modified ArbitrumVirtualMachine to capture gas dimensions during bytecode execution
  • Updated ArbitrumTransactionProcessor to track intrinsic and poster gas for dimension tracers

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Nethermind.Arbitrum/Tracing/TxGasDimensionLoggerTracer.cs Implements per-opcode gas dimension logger tracer with detailed breakdown
src/Nethermind.Arbitrum/Tracing/TxGasDimensionByOpcodeTracer.cs Implements aggregated gas dimension tracer grouped by opcode type
src/Nethermind.Arbitrum/Tracing/IArbitrumTxTracer.cs Adds gas dimension tracing interface methods
src/Nethermind.Arbitrum/Properties/scripts/generate-system-test-config.sh Fixes file paths for accounts and chainspec template
src/Nethermind.Arbitrum/Execution/ArbitrumTransactionProcessor.cs Captures intrinsic and poster gas for dimension tracers
src/Nethermind.Arbitrum/Evm/ArbitrumVirtualMachine.cs Implements gas dimension capture during bytecode execution
src/Nethermind.Arbitrum/ArbitrumPlugin.cs Registers the new tracers with the factory
src/Nethermind.Arbitrum.Test/Tracing/TxGasDimensionLoggerTracerTests.cs Unit tests for the dimension logger tracer
src/Nethermind.Arbitrum.Test/Tracing/TxGasDimensionByOpcodeTracerTests.cs Unit tests for the by-opcode dimension tracer
src/Nethermind.Arbitrum.Test/Tracing/GasDimensionTracerIntegrationTests.cs Integration tests for both tracers
src/Nethermind.Arbitrum.Test/Tracing/GasDimensionSerializationTests.cs Tests for JSON serialization of gas dimension data
src/Nethermind Submodule update to support new functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ode tracers

  Add Arbitrum-specific gas dimension tracers matching Nitro's implementation:

  - txGasDimensionLogger: Per-opcode gas dimension breakdown (pc, op, depth, cost, cpu, rw, growth, hist)
  - txGasDimensionByOpcode: Aggregated gas dimensions by opcode type

  Implementation details:
  - Extend IArbitrumTxTracer with gas dimension capture interface
  - Add RunByteCodeWithGasDimensionCapture to ArbitrumVirtualMachine for before/after MultiGas snapshots
  - Capture intrinsic gas and poster gas in ArbitrumTransactionProcessor
  - Register tracers in ArbitrumPlugin initialization
  - Fix tracer unwrapping to use GetTracer<T>() for proper wrapper handling
  PR #550 introduced naming mismatches between the script defaults and
  actual file names:

  - Template path: chainspec.template → system-test-chainspec.template
  - Accounts default: default.json → defaults.json

  These mismatches caused the script to fail when invoked via
  `make generate-system-test-config` or directly.
@AnkushinDaniil AnkushinDaniil force-pushed the daniil/feature/gas-dimension-tracers branch from c87705b to 895d040 Compare January 19, 2026 11:54
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Health
Nethermind.Arbitrum 81% 58%
Summary 81% (9164 / 11303) 58% (2294 / 3928)

Minimum allowed line rate is 60%

@AnkushinDaniil AnkushinDaniil enabled auto-merge (squash) January 19, 2026 14:57
@AnkushinDaniil AnkushinDaniil merged commit 9f9b620 into main Jan 19, 2026
5 checks passed
@AnkushinDaniil AnkushinDaniil deleted the daniil/feature/gas-dimension-tracers branch January 19, 2026 15:37
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.

Base computation-only opcodes multigas tracer

4 participants