[improvement] TraceTx/TraceBlock can't capture post-tx processing EVM calls
- Dominant language
- Go
- Stars
- 164
- Forks
- 213
- Avg merge
- 3d 58m
- Merged PRs (30d)
- 12
Description
## Description
`TraceTx` and `TraceBlock` queries do not capture EVM calls that occur during post-transaction processing hooks. This creates a discrepancy between traced execution and actual transaction execution.
## Problem
When `PostTxProcessing` hooks make EVM calls (e.g., calling precompiles or contracts), these calls are not captured by `TraceTx` and `TraceBlock` queries, resulting in incomplete traces.
### Key Issues
1. **`TraceTx`/`TraceBlock` do not execute `PostTxProcessing` hooks**
- See: [`grpc_query.go:583`](https://github.com/cosmos/evm/blob/main/x/vm/keeper/grpc_query.go#L583), [`grpc_query.go:848`](https://github.com/cosmos/evm/blob/main/x/vm/keeper/grpc_query.go#L848)
2. **`EvmHooks` interface has no tracer parameter**
- See: [`types/interfaces.go:79-82`](https://github.com/cosmos/evm/blob/main/x/vm/types/interfaces.go#L79-L82)
```go
type EvmHooks interface {
PostTxProcessing(ctx sdk.Context, sender common.Address,
msg core.Message, receipt *ethtypes.Receipt) error
// No tracer parameter ↑
}
```
3. **Tracer scope is limited to `ApplyMessageWithConfig`**
- The tracer does not extend to `PostTxProcessing` execution
## Related Code
- [`x/vm/keeper/grpc_query.go:497-668`](https://github.com/cosmos/evm/blob/main/x/vm/keeper/grpc_query.go#L497-L668) - `TraceTx`/`TraceBlock` implementations
- [`x/vm/keeper/state_transition.go:268-307`](https://github.com/cosmos/evm/blob/main/x/vm/keeper/state_transition.go#L268-L307) - `PostTxProcessing` call site
- [`x/vm/types/interfaces.go:79-82`](https://github.com/cosmos/evm/blob/main/x/vm/types/interfaces.go#L79-L82) - `EvmHooks` interface definition
Contributor guide
Research direction
Start in x/vm/keeper/grpc_query.go at the TraceTx and TraceBlock entry points, then read x/vm/keeper/state_transition.go and x/vm/types/interfaces.go around the cited lines. Trace how PostTxProcessing is invoked and how the tracer is scoped. Done means post-transaction EVM calls appear in TraceTx and TraceBlock results without breaking existing tracing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100