Skip to content

Commit

Permalink
fix: gas price value in eth_getTransaction JSON-RPC response (evmos…
Browse files Browse the repository at this point in the history
…#1082)

Solution:
- pass the correct baseFee parameter

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
  • Loading branch information
yihuang and fedekunze committed May 24, 2022
1 parent 36b9c09 commit 1af2a75
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes

* (rpc) [tharsis#1059](https://github.com/tharsis/ethermint/pull/1059) Remove unnecessary event filtering logic on the `eth_baseFee` JSON-RPC endpoint.
* (rpc) [tharsis#1082](https://github.com/tharsis/ethermint/pull/1082) fix gas price returned in getTransaction api.

### API Breaking

Expand Down
4 changes: 2 additions & 2 deletions rpc/ethereum/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac
common.Hash{},
uint64(0),
uint64(0),
e.chainID,
nil,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -734,7 +734,7 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac
common.BytesToHash(block.BlockID.Hash.Bytes()),
uint64(res.Height),
txIndex,
e.chainID,
nil,
)
}

Expand Down
9 changes: 7 additions & 2 deletions rpc/ethereum/namespaces/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,17 @@ func (e *PublicAPI) getTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock,
msg = ethMsgs[i]
}

baseFee, err := e.backend.BaseFee(block.Block.Height)
if err != nil {
return nil, err
}

return rpctypes.NewTransactionFromMsg(
msg,
common.BytesToHash(block.Block.Hash()),
uint64(block.Block.Height),
uint64(idx),
e.chainIDEpoch,
baseFee,
)
}

Expand Down Expand Up @@ -952,7 +957,7 @@ func (e *PublicAPI) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error)
common.Hash{},
uint64(0),
uint64(0),
e.chainIDEpoch,
nil,
)
if err != nil {
return nil, err
Expand Down

0 comments on commit 1af2a75

Please sign in to comment.