Skip to content

Commit

Permalink
Problem: rpc fails when basefee overflow int64
Browse files Browse the repository at this point in the history
- add integration test to reproduce
  • Loading branch information
yihuang committed Mar 15, 2024
1 parent 6c2b816 commit 0bf1a6c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bug Fixes

- [#1336](https://github.com/crypto-org-chain/cronos/pull/1336) Update ethermint to develop to fix feeHistory rpc api.
- [#]() Fix issues when basefee overflows int64

*February 28, 2024*

Expand Down
20 changes: 20 additions & 0 deletions integration_tests/configs/big_basefee.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local config = import 'default.jsonnet';

config {
'cronos_777-1'+: {
genesis+: {
app_state+: {
feemarket+: {
params+: {
base_fee_change_denominator: '3',
elasticity_multiplier: '4',
// 100 cro
base_fee: '100000000000000000000',
// 1 cro
min_gas_price: '1000000000000000000',
},
},
},
},
},
}
36 changes: 36 additions & 0 deletions integration_tests/test_overflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from pathlib import Path

import pytest

from .utils import ADDRS, KEYS, send_transaction, setup_custom_cronos, w3_wait_for_block


@pytest.fixture(scope="module")
def cronos(tmp_path_factory):
path = tmp_path_factory.mktemp("cronos-mempool")
yield from setup_custom_cronos(
path, 26300, Path(__file__).parent / "configs/big_basefee.jsonnet"
)


def test_basefee_overflow(cronos):
"""
test if any json-rpc breaks when base fee overflows int64
"""
w3 = cronos.w3
w3_wait_for_block(w3, 1)
print(w3.eth.gas_price)
tx = {
"from": ADDRS["validator"],
"to": ADDRS["community"],
"value": 1,
"gasPrice": w3.eth.gas_price,
}
tx["gas"] = w3.eth.estimate_gas(tx)
receipt = send_transaction(
w3,
tx,
KEYS["community"],
)
assert receipt.status == 1
print("receipt", receipt)

0 comments on commit 0bf1a6c

Please sign in to comment.