Skip to content

Commit

Permalink
Problem: panic on invalid elasticity_multiplier (#1398)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe authored Apr 22, 2024
1 parent b13984b commit 598bd7d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* (test) [#1380](https://github.com/crypto-org-chain/cronos/pull/1380) Upgrade cosmovisor to 1.5.0 in integration test.
* (versiondb) [#1379](https://github.com/crypto-org-chain/cronos/pull/1379) Flush versiondb when graceful shutdown, make rocksdb upgrade smooth.

### Bug Fixes

* (rpc) [#1397](https://github.com/crypto-org-chain/cronos/pull/1397) Avoid panic on invalid elasticity_multiplier.


*April 8, 2024*

## v1.2.0-rc1
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ replace (
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20240408020015-27de4edabc79
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20240419022701-412115d02b10
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 h1:R1
github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63/go.mod h1:rocwIfnS+kA060x64gkSIRvWB9StSppIkJuo5MWzL24=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240228013111-9bd1e035ed1d h1:ihUBUAEwQYHZEqf7lXrJithNCUJTjB8q3oSQA6Nevco=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240228013111-9bd1e035ed1d/go.mod h1:cmAawe8FV/52oPKbgeHLt4UpNkrNu8R5KD+kw0kxJFc=
github.com/crypto-org-chain/ethermint v0.6.1-0.20240408020015-27de4edabc79 h1:X5QvqiJjeBlCXjC6b5kpIL/vo2Honp/crZbCPafFBhA=
github.com/crypto-org-chain/ethermint v0.6.1-0.20240408020015-27de4edabc79/go.mod h1:zJYmx1D+tDggzvXmdJ0/I62TeIykdCMfJBjBxOcniAU=
github.com/crypto-org-chain/ethermint v0.6.1-0.20240419022701-412115d02b10 h1:6uN0+FzbTTFbGAlqdrKjcJt/geaK6zveGtm2p33tXJg=
github.com/crypto-org-chain/ethermint v0.6.1-0.20240419022701-412115d02b10/go.mod h1:zJYmx1D+tDggzvXmdJ0/I62TeIykdCMfJBjBxOcniAU=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230825054824-75403cd90c6e h1:rSTc35OBjjCBx47rHPWBCIHNGPbMnEj8f7fNcK2TjVI=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ schema = 3
hash = "sha256-lDIqRLUrXYCb9mmFBY/+WW+ee69+IkxOgqjHVyo4ij0="
replaced = "github.com/crypto-org-chain/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20240408020015-27de4edabc79"
hash = "sha256-kzUbVz9+KPFFoauHmSgywEvhPeKtU2EinyxPTVrqsWE="
version = "v0.6.1-0.20240419022701-412115d02b10"
hash = "sha256-wuXg0oZlIHc+x9tSmxZxGNoBa521p+o/Nk4ynJHKlRU="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.2"
Expand Down
29 changes: 17 additions & 12 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ def exec(c, tmp_path_factory):
wait_for_port(ports.evmrpc_port(c.base_port(0)))
wait_for_new_blocks(cli, 1)

height = cli.block_height()
target_height0 = height + 15
print("upgrade v1.1 height", target_height0)

def do_upgrade(plan_name, target, mode=None):
rsp = cli.gov_propose_legacy(
"community",
Expand All @@ -156,11 +152,14 @@ def do_upgrade(plan_name, target, mode=None):
wait_for_block(c.cosmos_cli(), target + 2, timeout=480)
wait_for_port(ports.rpc_port(c.base_port(0)))

do_upgrade("v1.1.0", target_height0, "block")
cli = c.cosmos_cli()

# test migrate keystore
cli.migrate_keystore()
height = cli.block_height()
target_height0 = height + 15
print("upgrade v1.1 height", target_height0)

do_upgrade("v1.1.0", target_height0, "block")
cli = c.cosmos_cli()

# check basic tx works
wait_for_port(ports.evmrpc_port(c.base_port(0)))
Expand Down Expand Up @@ -196,6 +195,7 @@ def do_upgrade(plan_name, target, mode=None):
print("old values", old_height, old_balance, old_base_fee)

do_upgrade("v1.2", target_height1)
cli = c.cosmos_cli()

# check basic tx works
wait_for_port(ports.evmrpc_port(c.base_port(0)))
Expand Down Expand Up @@ -240,10 +240,11 @@ def do_upgrade(plan_name, target, mode=None):
max_callback_gas = cli.query_params()["max_callback_gas"]
assert max_callback_gas == "50000", max_callback_gas

e = cli.query_params("evm", height=target_height0 - 1)["params"]["evm_denom"]
assert e == "basetcro", e
e = cli.query_params("evm", height=target_height1 - 1)["params"]["evm_denom"]
assert e == "basetcro", e
e0 = cli.query_params("evm", height=target_height0 - 1)["params"]
e1 = cli.query_params("evm", height=target_height1 - 1)["params"]
f0 = cli.query_params("feemarket", height=target_height0 - 1)["params"]
f1 = cli.query_params("feemarket", height=target_height1 - 1)["params"]
assert e0["evm_denom"] == e1["evm_denom"] == "basetcro"

# update the genesis time = current time + 5 secs
newtime = datetime.utcnow() + timedelta(seconds=5)
Expand All @@ -257,7 +258,11 @@ def do_upgrade(plan_name, target, mode=None):
file.write_text(json.dumps(genesis))
c.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1")
wait_for_new_blocks(c.cosmos_cli(), 1)
c.supervisorctl("stop", "all")

assert e0 == cli.query_params("evm", height=target_height0 - 1)["params"]
assert e1 == cli.query_params("evm", height=target_height1 - 1)["params"]
assert f0 == cli.query_params("feemarket", height=target_height0 - 1)["params"]
assert f1 == cli.query_params("feemarket", height=target_height1 - 1)["params"]


def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
Expand Down

0 comments on commit 598bd7d

Please sign in to comment.