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

fix(rpc): align fee history #1611

Merged
merged 19 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
## Unreleased

### Bug Fixes
* (rpc) [#1613](https://github.com/evmos/ethermint/pull/1613) Change the default json-rpc listen address to localhost.
* (rpc) [#1611](https://github.com/evmos/ethermint/pull/1611) Add missing next fee in fee history as ethereum.

## [v0.21.0-rc1] - 2022-1-13
Expand Down
2 changes: 1 addition & 1 deletion rpc/backend/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (b *Backend) processBlock(
// set basefee
targetOneFeeHistory.BaseFee = blockBaseFee
cfg := b.ChainConfig()
if cfg.IsLondon(big.NewInt(blockHeight)) {
if cfg.IsLondon(big.NewInt(blockHeight + 1)) {
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
targetOneFeeHistory.NextBaseFee = misc.CalcBaseFee(cfg, b.CurrentHeader())
} else {
targetOneFeeHistory.NextBaseFee = new(big.Int)
Expand Down
46 changes: 46 additions & 0 deletions tests/integration_tests/test_fee_history.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import pytest
from web3 import Web3

from .network import setup_ethermint
from .utils import (
ADDRS,
send_transaction,
)
mmsqe marked this conversation as resolved.
Show resolved Hide resolved


@pytest.fixture(scope="module")
def custom_ethermint(tmp_path_factory):
path = tmp_path_factory.mktemp("fee-history")
yield from setup_ethermint(path, 26500, long_timeout_commit=True)


@pytest.fixture(
scope="module", params=["ethermint", "geth", "ethermint-ws"]
)
def cluster(request, custom_ethermint, geth):
"""
run on both ethermint and geth
"""
provider = request.param
if provider == "ethermint":
yield custom_ethermint
elif provider == "geth":
yield geth
elif provider == "ethermint-ws":
ethermint_ws = custom_ethermint.copy()
ethermint_ws.use_websocket()
yield ethermint_ws
else:
raise NotImplementedError


def test_basic(cluster):
w3: Web3 = cluster.w3
eth_rpc = w3.provider
tx_value = 10
gas_price = w3.eth.gas_price
tx = {"to": ADDRS["community"], "value": tx_value, "gasPrice": gas_price}
send_transaction(w3, tx)
for provider in [eth_rpc]:
fee_history = provider.make_request("eth_feeHistory", [4, "latest", [100]])
assert len(fee_history["result"]["baseFeePerGas"]) == 5