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

Commit

Permalink
fix: gas price value in eth_getTransaction JSON-RPC response (#1082)
Browse files Browse the repository at this point in the history
Solution:
- pass the correct baseFee parameter

Co-authored-by: Federico Kunze Küllmer <[email protected]>
  • Loading branch information
yihuang and fedekunze authored May 19, 2022
1 parent a313008 commit d359cbd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (cli) [tharsis#1086](https://github.com/tharsis/ethermint/pull/1086) Add rollback command.

### Bug Fixes

* (rpc) [tharsis#1082](https://github.com/tharsis/ethermint/pull/1082) fix gas price returned in getTransaction api.

## [v0.15.0] - 2022-05-09

### State Machine Breaking
Expand Down
9 changes: 7 additions & 2 deletions rpc/backend/evm_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransactio
common.Hash{},
uint64(0),
uint64(0),
b.chainID,
nil,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -649,12 +649,17 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransactio
return nil, errors.New("can't find index of ethereum tx")
}

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

return types.NewTransactionFromMsg(
msg,
common.BytesToHash(block.BlockID.Hash.Bytes()),
uint64(res.Height),
txIndex,
b.chainID,
baseFee,
)
}

Expand Down
9 changes: 7 additions & 2 deletions rpc/namespaces/ethereum/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,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 @@ -983,7 +988,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 d359cbd

Please sign in to comment.