Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix(rpc): wrong block number in debug trace related api #1591

Merged
merged 10 commits into from
Jan 20, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (rpc) [#1484](https://github.com/evmos/ethermint/pull/1484) Align empty account result for old blocks as ethereum instead of return account not found error.
* (rpc) [#1503](https://github.com/evmos/ethermint/pull/1503) Fix block hashes returned on JSON-RPC filter `eth_newBlockFilter`.
* (ante) [#1566](https://github.com/evmos/ethermint/pull/1566) Fix `gasWanted` on `EthGasConsumeDecorator` ante handler when running transaction in `ReCheckMode`
* (rpc) [#1591](https://github.com/evmos/ethermint/pull/1591) Fix block number returned in opcode for debug trace related api.

## [v0.19.3] - 2022-10-14

Expand Down
8 changes: 4 additions & 4 deletions x/evm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit)
}

// minus one to get the context of block beginning
contextHeight := req.BlockNumber - 1
// get the context of block beginning
contextHeight := req.BlockNumber
if contextHeight < 1 {
// 0 is a special value in `ContextWithHeight`
contextHeight = 1
Expand Down Expand Up @@ -479,8 +479,8 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest)
return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit)
}

// minus one to get the context of block beginning
contextHeight := req.BlockNumber - 1
// get the context of block beginning
contextHeight := req.BlockNumber
if contextHeight < 1 {
// 0 is a special value in `ContextWithHeight`
contextHeight = 1
Expand Down