Skip to content

Commit

Permalink
Problem: more tx throughput is not enabled (#1186)
Browse files Browse the repository at this point in the history
* Problem: block gas limit can be enlarged

Solution:
- due to improved performance, we can enlarge block gas limit to enable more tx throughput.

* add integration test

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* upgrade plan name

* Update CHANGELOG.md

Co-authored-by: Thomas Nguy <[email protected]>
Signed-off-by: yihuang <[email protected]>

* fix python lint

* fix test

* format url

* fix url

---------

Signed-off-by: yihuang <[email protected]>
Signed-off-by: mmsqe <[email protected]>
Co-authored-by: Thomas Nguy <[email protected]>
Co-authored-by: mmsqe <[email protected]>
  • Loading branch information
3 people authored Sep 27, 2023
1 parent 2dd9c8b commit c539a95
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [cronos#1163](https://github.com/crypto-org-chain/cronos/pull/1163) Support stateful precompiled contract for ica.
- [cronos#837](https://github.com/crypto-org-chain/cronos/pull/837) Support stateful precompiled contract for bank.
- [cronos#1184](https://github.com/crypto-org-chain/cronos/pull/1184) Update ibc-go to `v7.3.1`.
- [cronos#1186](https://github.com/crypto-org-chain/cronos/pull/1186) Enlarge the max block gas limit in new version.
- [cronos#1187](https://github.com/crypto-org-chain/cronos/pull/1187) Disable gravity module in app.
- [cronos#1185](https://github.com/crypto-org-chain/cronos/pull/1185) Support ibc callback.

Expand Down
10 changes: 9 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
)

func (app *App) RegisterUpgradeHandlers(cdc codec.BinaryCodec, clientKeeper clientkeeper.Keeper) {
planName := "sdk47-upgrade"
planName := "v1.1.0"
// Set param key table for params module migration
for _, subspace := range app.ParamsKeeper.GetSubspaces() {
var keyTable paramstypes.KeyTable
Expand Down Expand Up @@ -106,6 +106,14 @@ func (app *App) RegisterUpgradeHandlers(cdc codec.BinaryCodec, clientKeeper clie
if err != nil {
return m, err
}

// enlarge block gas limit
consParams, err := app.ConsensusParamsKeeper.Get(ctx)
if err != nil {
return m, err
}
consParams.Block.MaxGas = 60_000_000
app.ConsensusParamsKeeper.Set(ctx, consParams)
return m, nil
})
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
, nativeByteOrder ? true # nativeByteOrder mode will panic on big endian machines
}:
let
version = "v1.0.4";
version = "v1.1.0";
pname = "cronosd";
tags = [ "ledger" "netgo" network "rocksdb" "grocksdb_no_link" ] ++ lib.optionals nativeByteOrder [ "nativebyteorder" ];
ldflags = lib.concatStringsSep "\n" ([
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/configs/upgrade-test-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ let
in
pkgs.linkFarm "upgrade-test-package" [
{ name = "genesis"; path = released; }
{ name = "sdk47-upgrade"; path = current; }
{ name = "v1.1.0"; path = current; }
]
5 changes: 5 additions & 0 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from collections import namedtuple

import bech32
import requests
from dateutil.parser import isoparse
from pystarport.utils import build_cli_args_safe, format_doc_string, interact

Expand Down Expand Up @@ -1746,3 +1747,7 @@ def event_query_tx_for(self, hash):
stderr=subprocess.DEVNULL,
)
)

def consensus_params(self, port, height):
url = f"http://127.0.0.1:{port}/consensus_params?height={height}"
return requests.get(url).json()["result"]["consensus_params"]
6 changes: 5 additions & 1 deletion integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
)
print("old values", old_height, old_balance, old_base_fee)

plan_name = "sdk47-upgrade"
plan_name = "v1.1.0"
rsp = cli.gov_propose_legacy(
"community",
"software-upgrade",
Expand Down Expand Up @@ -158,6 +158,10 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
assert old_erc20_balance == contract.caller(block_identifier=old_height).balanceOf(
ADDRS["validator"]
)
# check consensus params
port = ports.rpc_port(custom_cronos.base_port(0))
res = cli.consensus_params(port, w3.eth.get_block_number())
assert res["block"]["max_gas"] == "60000000"

rsp = cli.query_params("icaauth")
assert rsp["params"]["min_timeout_duration"] == "3600s", rsp
Expand Down

0 comments on commit c539a95

Please sign in to comment.