Skip to content

feat(vm): add composable application-level EVM tracers - #1298

Draft
psy2848048 wants to merge 3 commits into
cosmos:mainfrom
psy2848048:feat/tracer
Draft

psy2848048 wants to merge 3 commits into
cosmos:mainfrom
psy2848048:feat/tracer

Conversation

@psy2848048

Copy link
Copy Markdown

Description

This PR adds opt-in, composable application-level EVM tracing.

Embedding applications can register multiple tracer factories with SetApplicationTracerFactories. Their hooks are composed in registration order with the existing debug tracer, allowing applications to collect execution data for compliance policies, indexing, and other post-transaction processing without replacing vm.Config.Tracer.

evmd does not enable an application tracer by default. This keeps the example chain's existing behavior unchanged and avoids tracing overhead unless explicitly configured by an embedding application.
Projects building on Cosmos EVM - would be compliance-related project - can opt in to this API to collect deterministic execution data for application-specific compliance controls, such as account or contract allowlists and denylists.

Key behavior:

  • Creates fresh application tracers for each top-level EVM execution.
  • Supports multiple application tracers in deterministic registration order.
  • Preserves execution-scoped tracer state for post-tx hooks, including failed transactions.
  • Provides an optional collector for call touches, native transfers, and successful ERC-20 transfer and transferFrom calls.
  • Adds CallEVMViewWithData for isolated, non-committing calls that must not pollute the parent transaction trace.
  • Keeps ordinary CallEVM and CallEVMWithData tracing independent of the commit parameter.

Closes: #1293

Review Guide

The most important files to review are:

  • x/vm/tracer/manager.go — hook composition, nested execution handling, and depth adjustment.
  • x/vm/keeper/tracer_set.go — application tracer registration and per-execution initialization.
  • x/vm/keeper/call_evm_tracing.go — manager reuse for nested native EVM calls.
  • x/vm/keeper/call_evm.go — isolated CallEVMViewWithData execution.
  • x/vm/keeper/state_transition.go — top-level tracing initialization and failed-transaction context preservation.
  • x/vm/tracer/application/ — optional transaction-wide collector.

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

@psy2848048
psy2848048 marked this pull request as ready for review September 22, 2026 06:44
@psy2848048
psy2848048 requested a review from a team as a code owner September 22, 2026 06:44
@greptile-apps

greptile-apps Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@psy2848048
psy2848048 marked this pull request as draft September 22, 2026 08:45
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.

[Feature] Composable application-level EVM tracers for policy and compliance

1 participant