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

Commit

Permalink
format error on EstimateGas rpc call
Browse files Browse the repository at this point in the history
  • Loading branch information
ramacarlucho committed Sep 14, 2022
1 parent 67f1e97 commit 2470802
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rpc/backend/call_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rp
GasCap: b.RPCGasCap(),
}

_, err = b.TendermintBlockByNumber(blockNr)
if err != nil {
// the error message imitates geth behavior
return 0, errors.New("header not found")
}

// From ContextWithHeight: if the provided height is 0,
// it will return an empty context and the gRPC query will use
// the latest block height for querying.
Expand Down
2 changes: 2 additions & 0 deletions tests/integration_tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ def test_estimate_gas(ethermint, geth):
eth_rpc = ethermint.w3.provider
geth_rpc = geth.w3.provider
make_same_rpc_calls(eth_rpc, geth_rpc, "eth_estimateGas", [tx])
make_same_rpc_calls(eth_rpc, geth_rpc, "eth_estimateGas", [tx, "0x0"])
make_same_rpc_calls(eth_rpc, geth_rpc, "eth_estimateGas", [tx, "0x5000"])
make_same_rpc_calls(eth_rpc, geth_rpc, "eth_estimateGas", [{}])


Expand Down

0 comments on commit 2470802

Please sign in to comment.