diff --git a/CHANGELOG.md b/CHANGELOG.md index c419b3d046..0448400755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes * (rpc) [\#1190](https://github.com/evmos/ethermint/issues/1190) Fix `UnmarshalJSON` panic of breaking EVM and fee market `Params`. +* (evm) [\#1187](https://github.com/evmos/ethermint/pull/1187) Fix `TxIndex` value (expected 0, actual 1) when trace the first tx of a block via `debug_traceTransaction` API. ## [v0.17.1] - 2022-07-13 diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 0115790690..c79c35de48 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -398,7 +398,10 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ tx := req.Msg.AsTransaction() txConfig.TxHash = tx.Hash() - txConfig.TxIndex++ + if len(req.Predecessors) > 0 { + txConfig.TxIndex++ + } + result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false) if err != nil { // error will be returned with detail status from traceTx