diff --git a/CHANGELOG.md b/CHANGELOG.md index 4357af2954..1a35e0778b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,18 @@ # Changelog -## UNRELEASED +*April 2, 2024* + +## v1.2.0 ### Bug Fixes - [#1363](https://github.com/crypto-org-chain/cronos/pull/1363) Update ethermint to fix a panic on overflow and patch gasUsed in the RPC API. +### State Machine Breaking + +* [#1366](https://github.com/crypto-org-chain/ethermint/pull/1366) Keep behavior of random opcode as before. + + *March 26, 2024* ## v1.1.1 diff --git a/app/upgrades.go b/app/upgrades.go index b26c55c034..76bbff4227 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -1,151 +1,20 @@ package app import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" - cronostypes "github.com/crypto-org-chain/cronos/v2/x/cronos/types" - icaauthtypes "github.com/crypto-org-chain/cronos/v2/x/icaauth/types" - v0evmtypes "github.com/evmos/ethermint/x/evm/migrations/v0/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" - feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" ) func (app *App) RegisterUpgradeHandlers(cdc codec.BinaryCodec, clientKeeper clientkeeper.Keeper) { - planName := "v1.1.0" - // Set param key table for params module migration - for _, subspace := range app.ParamsKeeper.GetSubspaces() { - var keyTable paramstypes.KeyTable - switch subspace.Name() { - case authtypes.ModuleName: - keyTable = authtypes.ParamKeyTable() //nolint:staticcheck - case banktypes.ModuleName: - keyTable = banktypes.ParamKeyTable() //nolint:staticcheck - case stakingtypes.ModuleName: - keyTable = stakingtypes.ParamKeyTable() - case minttypes.ModuleName: - keyTable = minttypes.ParamKeyTable() //nolint:staticcheck - case distrtypes.ModuleName: - keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck - case slashingtypes.ModuleName: - keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck - case govtypes.ModuleName: - keyTable = govv1.ParamKeyTable() //nolint:staticcheck - case crisistypes.ModuleName: - keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck - case ibctransfertypes.ModuleName: - keyTable = ibctransfertypes.ParamKeyTable() - case icacontrollertypes.SubModuleName: - keyTable = icacontrollertypes.ParamKeyTable() - case icaauthtypes.ModuleName: - keyTable = icaauthtypes.ParamKeyTable() - case evmtypes.ModuleName: - keyTable = v0evmtypes.ParamKeyTable() //nolint:staticcheck - case feemarkettypes.ModuleName: - keyTable = feemarkettypes.ParamKeyTable() - case cronostypes.ModuleName: - keyTable = cronostypes.ParamKeyTable() - default: - continue - } - if !subspace.HasKeyTable() { - subspace.WithKeyTable(keyTable) - } - } - baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - // OPTIONAL: prune expired tendermint consensus states to save storage space - if _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, cdc, clientKeeper); err != nil { - return nil, err - } - // explicitly update the IBC 02-client params, adding the localhost client type - params := clientKeeper.GetParams(ctx) - params.AllowedClients = append(params.AllowedClients, exported.Localhost) - clientKeeper.SetParams(ctx, params) - - // Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module. - baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper) - if icaModule, ok := app.mm.Modules[icatypes.ModuleName].(ica.AppModule); ok { - // set the ICS27 consensus version so InitGenesis is not run - version := icaModule.ConsensusVersion() - fromVM[icatypes.ModuleName] = version - - // create ICS27 Controller submodule params - controllerParams := icacontrollertypes.Params{ - ControllerEnabled: true, - } - - // initialize ICS27 module - icaModule.InitModule(ctx, controllerParams, icahosttypes.Params{}) - } - - m, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) - 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 - }) - - testnetPlanName := "v1.1.0-testnet-1" - app.UpgradeKeeper.SetUpgradeHandler(testnetPlanName, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + planName := "v1.2" + app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { m, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) if err != nil { return m, err } return m, nil }) - - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) - } - if !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - if upgradeInfo.Name == planName { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{ - consensusparamtypes.StoreKey, - crisistypes.StoreKey, - icacontrollertypes.StoreKey, - icaauthtypes.StoreKey, - }, - Deleted: []string{ - authzkeeper.StoreKey, - }, - } - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } - } } diff --git a/default.nix b/default.nix index d19c2b2846..53aa32eb0a 100644 --- a/default.nix +++ b/default.nix @@ -11,7 +11,7 @@ , nativeByteOrder ? true # nativeByteOrder mode will panic on big endian machines }: let - version = "v1.1.1"; + version = "v1.2.0"; pname = "cronosd"; tags = [ "ledger" "netgo" network "rocksdb" "grocksdb_no_link" ] ++ lib.optionals nativeByteOrder [ "nativebyteorder" ]; ldflags = lib.concatStringsSep "\n" ([ diff --git a/go.mod b/go.mod index 6bda2206d4..417cc3e786 100644 --- a/go.mod +++ b/go.mod @@ -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.20240326012741-6263a240556c + github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20240402062856-028760ed329f // 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 diff --git a/go.sum b/go.sum index 8c4e4323b6..cd436443dc 100644 --- a/go.sum +++ b/go.sum @@ -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.20240326012741-6263a240556c h1:3VKwgmkb/CnjHT8v6bwMl70ferUVLcrefEpQc9Q8/F0= -github.com/crypto-org-chain/ethermint v0.6.1-0.20240326012741-6263a240556c/go.mod h1:zJYmx1D+tDggzvXmdJ0/I62TeIykdCMfJBjBxOcniAU= +github.com/crypto-org-chain/ethermint v0.6.1-0.20240402062856-028760ed329f h1:JZ/mnxsQXWaCLgIZHveHJaSB53RK7WCb1NTkMztqavk= +github.com/crypto-org-chain/ethermint v0.6.1-0.20240402062856-028760ed329f/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= diff --git a/gomod2nix.toml b/gomod2nix.toml index c346bc00ae..ea2bb94cab 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -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.20240326012741-6263a240556c" - hash = "sha256-MgvJ9Z0zl+oZtMmbSAlqaibQvzKqEvM1016uF9GEHXI=" + version = "v0.6.1-0.20240402062856-028760ed329f" + hash = "sha256-beJ+wpYSJ5OW8u72RsoEUo4PvECMtRnMXis8bDw6qgE=" replaced = "github.com/crypto-org-chain/ethermint" [mod."github.com/felixge/httpsnoop"] version = "v1.0.2" diff --git a/integration_tests/configs/cosmovisor.jsonnet b/integration_tests/configs/cosmovisor.jsonnet index 51c9c7c3bd..337c22e678 100644 --- a/integration_tests/configs/cosmovisor.jsonnet +++ b/integration_tests/configs/cosmovisor.jsonnet @@ -8,20 +8,23 @@ config { 'iavl-lazy-loading':: super['iavl-lazy-loading'], }, genesis+: { + consensus_params+: { + block+: { + max_gas: '60000000', + }, + }, app_state+: { bank+: { - params: { - send_enabled: [ - { - denom: 'stake', - enabled: true, - }, - { - denom: 'basetcro', - enabled: false, - }, - ], - }, + send_enabled+: [ + { + denom: 'stake', + enabled: true, + }, + { + denom: 'basetcro', + enabled: false, + }, + ], }, feemarket+: { params+: { @@ -29,20 +32,6 @@ config { base_fee:: super.base_fee, }, }, - gov: { - voting_params: { - voting_period: '10s', - }, - deposit_params: { - max_deposit_period: '10s', - min_deposit: [ - { - denom: 'basetcro', - amount: '1', - }, - ], - }, - }, }, }, }, diff --git a/integration_tests/configs/cosmovisor_testnet.jsonnet b/integration_tests/configs/cosmovisor_testnet.jsonnet deleted file mode 100644 index 337c22e678..0000000000 --- a/integration_tests/configs/cosmovisor_testnet.jsonnet +++ /dev/null @@ -1,38 +0,0 @@ -local config = import 'default.jsonnet'; - -config { - 'cronos_777-1'+: { - 'app-config'+: { - 'app-db-backend': 'rocksdb', - 'minimum-gas-prices': '100000000000basetcro', - 'iavl-lazy-loading':: super['iavl-lazy-loading'], - }, - genesis+: { - consensus_params+: { - block+: { - max_gas: '60000000', - }, - }, - app_state+: { - bank+: { - send_enabled+: [ - { - denom: 'stake', - enabled: true, - }, - { - denom: 'basetcro', - enabled: false, - }, - ], - }, - feemarket+: { - params+: { - no_base_fee: false, - base_fee:: super.base_fee, - }, - }, - }, - }, - }, -} diff --git a/integration_tests/configs/upgrade-test-package.nix b/integration_tests/configs/upgrade-test-package.nix index 47e2b3f8bb..b628d99c12 100644 --- a/integration_tests/configs/upgrade-test-package.nix +++ b/integration_tests/configs/upgrade-test-package.nix @@ -7,11 +7,11 @@ let shortRev = builtins.substring 0 7 rev; }; }).defaultNix; - # v1.0.12 - released = (fetchFlake "crypto-org-chain/cronos" "a54d8a9659a98b917d3fc1ae39489fbc0699df60").default; + # v1.1.1 + released = (fetchFlake "crypto-org-chain/cronos" "10b8eeb9052e3c52aa59dec15f5d3aca781d1271").default; current = pkgs.callPackage ../../. { }; in pkgs.linkFarm "upgrade-test-package" [ { name = "genesis"; path = released; } - { name = "v1.1.0"; path = current; } + { name = "v1.2"; path = current; } ] diff --git a/integration_tests/configs/upgrade-testnet-test-package.nix b/integration_tests/configs/upgrade-testnet-test-package.nix deleted file mode 100644 index 3ba625a91d..0000000000 --- a/integration_tests/configs/upgrade-testnet-test-package.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - pkgs = import ../../nix { }; - fetchFlake = repo: rev: (pkgs.flake-compat { - src = { - outPath = builtins.fetchTarball "https://github.com/${repo}/archive/${rev}.tar.gz"; - inherit rev; - shortRev = builtins.substring 0 7 rev; - }; - }).defaultNix; - # v1.1.0-rc3 - released = (fetchFlake "crypto-org-chain/cronos" "b7b261a3652cdf3ee2e224e777a40ce6dbbb0da5").default; - current = pkgs.callPackage ../../. { }; -in -pkgs.linkFarm "upgrade-test-package" [ - { name = "genesis"; path = released; } - { name = "v1.1.0-testnet-1"; path = current; } -] diff --git a/integration_tests/contracts/contracts/Random.sol b/integration_tests/contracts/contracts/Random.sol new file mode 100644 index 0000000000..8f1665d0fb --- /dev/null +++ b/integration_tests/contracts/contracts/Random.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.15; + +contract Random { + function randomTokenId() public returns (uint256) { + return uint256(keccak256(abi.encodePacked(block.prevrandao))); + } +} \ No newline at end of file diff --git a/integration_tests/cosmoscli.py b/integration_tests/cosmoscli.py index ee99f19de2..a8d301894f 100644 --- a/integration_tests/cosmoscli.py +++ b/integration_tests/cosmoscli.py @@ -895,8 +895,8 @@ def ibc_denom_trace(self, path, node): ) )["denom_trace"] - def export(self): - return self.raw("export", home=self.data_dir) + def export(self, **kwargs): + return self.raw("export", home=self.data_dir, **kwargs) def unsaferesetall(self): return self.raw("tendermint", "unsafe-reset-all") diff --git a/integration_tests/test_gov_update_params.py b/integration_tests/test_gov_update_params.py index d615ba7bcb..a2c63f6985 100644 --- a/integration_tests/test_gov_update_params.py +++ b/integration_tests/test_gov_update_params.py @@ -1,12 +1,55 @@ +import hashlib import json import pytest -from .utils import approve_proposal +from .utils import CONTRACTS, approve_proposal, deploy_contract, eth_to_bech32 pytestmark = pytest.mark.gov +def test_evm_update_param(cronos, tmp_path): + contract = deploy_contract( + cronos.w3, + CONTRACTS["Random"], + ) + res = contract.caller.randomTokenId() + assert res > 0, res + cli = cronos.cosmos_cli() + p = cli.query_params("evm")["params"] + del p["chain_config"]["merge_netsplit_block"] + del p["chain_config"]["shanghai_time"] + proposal = tmp_path / "proposal.json" + # governance module account as signer + data = hashlib.sha256("gov".encode()).digest()[:20] + signer = eth_to_bech32(data) + proposal_src = { + "messages": [ + { + "@type": "/ethermint.evm.v1.MsgUpdateParams", + "authority": signer, + "params": p, + } + ], + "deposit": "1basetcro", + "title": "title", + "summary": "summary", + } + proposal.write_text(json.dumps(proposal_src)) + rsp = cli.submit_gov_proposal(proposal, from_="community") + assert rsp["code"] == 0, rsp["raw_log"] + approve_proposal(cronos, rsp) + print("check params have been updated now") + p = cli.query_params("evm")["params"] + invalid_msg = "invalid opcode: PUSH0" + with pytest.raises(ValueError) as e_info: + contract.caller.randomTokenId() + assert invalid_msg in str(e_info.value) + with pytest.raises(ValueError) as e_info: + deploy_contract(cronos.w3, CONTRACTS["Greeter"]) + assert invalid_msg in str(e_info.value) + + def test_gov_update_params(cronos, tmp_path): cli = cronos.cosmos_cli() diff --git a/integration_tests/test_upgrade.py b/integration_tests/test_upgrade.py index 54cdb6813e..3db9e1f3e1 100644 --- a/integration_tests/test_upgrade.py +++ b/integration_tests/test_upgrade.py @@ -16,7 +16,6 @@ deploy_contract, edit_ini_sections, get_consensus_params, - get_send_enable, send_transaction, wait_for_block, wait_for_new_blocks, @@ -27,15 +26,10 @@ @pytest.fixture(scope="module") -def testnet(tmp_path_factory): +def custom_cronos(tmp_path_factory): yield from setup_cronos_test(tmp_path_factory) -@pytest.fixture(scope="module") -def mainnet(tmp_path_factory): - yield from setup_cronos_test(tmp_path_factory, False) - - def init_cosmovisor(home): """ build and setup cosmovisor directory structure in each node's home directory @@ -67,11 +61,11 @@ def post_init(path, base_port, config): ) -def setup_cronos_test(tmp_path_factory, testnet=True): +def setup_cronos_test(tmp_path_factory): path = tmp_path_factory.mktemp("upgrade") - port = 26100 if testnet else 26200 - nix_name = "upgrade-testnet-test-package" if testnet else "upgrade-test-package" - cfg_name = "cosmovisor_testnet" if testnet else "cosmovisor" + port = 26200 + nix_name = "upgrade-test-package" + cfg_name = "cosmovisor" cmd = [ "nix-build", Path(__file__).parent / f"configs/{nix_name}.nix", @@ -91,7 +85,7 @@ def setup_cronos_test(tmp_path_factory, testnet=True): yield cronos -def exec(c, tmp_path_factory, testnet=True): +def exec(c, tmp_path_factory): """ - propose an upgrade and pass it - wait for it to happen @@ -103,16 +97,14 @@ def exec(c, tmp_path_factory, testnet=True): {"denom": "basetcro", "enabled": False}, {"denom": "stake", "enabled": True}, ] - p = cli.query_bank_send() if testnet else get_send_enable(port) + p = cli.query_bank_send() assert sorted(p, key=lambda x: x["denom"]) == send_enable # export genesis from old version c.supervisorctl("stop", "all") migrate = tmp_path_factory.mktemp("migrate") file_path0 = Path(migrate / "old.json") - with open(file_path0, "w") as fp: - json.dump(json.loads(cli.export()), fp) - fp.flush() + cli.export(output_document=str(file_path0)) c.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1") wait_for_port(ports.evmrpc_port(c.base_port(0))) @@ -123,13 +115,13 @@ def exec(c, tmp_path_factory, testnet=True): print("upgrade height", target_height) w3 = c.w3 - - if not testnet: - # before upgrade, PUSH0 opcode is not supported - with pytest.raises(ValueError) as e_info: - deploy_contract(w3, CONTRACTS["Greeter"]) - assert "invalid opcode: PUSH0" in str(e_info.value) - + random_contract = deploy_contract( + c.w3, + CONTRACTS["Random"], + ) + with pytest.raises(ValueError) as e_info: + random_contract.caller.randomTokenId() + assert "invalid memory address or nil pointer dereference" in str(e_info.value) contract = deploy_contract(w3, CONTRACTS["TestERC20A"]) old_height = w3.eth.block_number old_balance = w3.eth.get_balance(ADDRS["validator"], block_identifier=old_height) @@ -139,7 +131,7 @@ def exec(c, tmp_path_factory, testnet=True): ) print("old values", old_height, old_balance, old_base_fee) - plan_name = "v1.1.0-testnet-1" if testnet else "v1.1.0" + plan_name = "v1.2" rsp = cli.gov_propose_legacy( "community", "software-upgrade", @@ -150,10 +142,10 @@ def exec(c, tmp_path_factory, testnet=True): "upgrade-height": target_height, "deposit": "10000basetcro", }, - mode=None if testnet else "block", + mode=None, ) assert rsp["code"] == 0, rsp["raw_log"] - approve_proposal(c, rsp, event_query_tx=testnet) + approve_proposal(c, rsp, event_query_tx=True) # update cli chain binary c.chain_binary = ( @@ -181,9 +173,11 @@ def exec(c, tmp_path_factory, testnet=True): ) assert receipt.status == 1 - if not testnet: - # after upgrade, PUSH0 opcode is supported - deploy_contract(w3, CONTRACTS["Greeter"]) + # deploy contract should still work + deploy_contract(w3, CONTRACTS["Greeter"]) + # random should work + res = random_contract.caller.randomTokenId() + assert res > 0, res # query json-rpc on older blocks should success assert old_balance == w3.eth.get_balance( @@ -208,21 +202,6 @@ def exec(c, tmp_path_factory, testnet=True): assert rsp["params"]["min_timeout_duration"] == "3600s", rsp max_callback_gas = cli.query_params()["max_callback_gas"] assert max_callback_gas == "50000", max_callback_gas - if not testnet: - # migrate to sdk v0.47 - c.supervisorctl("stop", "all") - sdk_version = "v0.47" - file_path1 = Path(migrate / f"{sdk_version}.json") - with open(file_path1, "w") as fp: - json.dump(cli.migrate_sdk_genesis(sdk_version, str(file_path0)), fp) - fp.flush() - # migrate to cronos v1.0.x - cronos_version = "v1.0" - file_path0 = Path(migrate / f"{cronos_version}.json") - with open(file_path0, "w") as fp: - json.dump(cli.migrate_cronos_genesis(cronos_version, str(file_path1)), fp) - fp.flush() - print(cli.validate_genesis(str(file_path0))) # update the genesis time = current time + 5 secs newtime = datetime.utcnow() + timedelta(seconds=5) @@ -239,9 +218,5 @@ def exec(c, tmp_path_factory, testnet=True): c.supervisorctl("stop", "all") -def test_cosmovisor_upgrade_mainnet(mainnet: Cronos, tmp_path_factory): - exec(mainnet, tmp_path_factory, False) - - -def test_cosmovisor_upgrade_testnet(testnet: Cronos, tmp_path_factory): - exec(testnet, tmp_path_factory, True) +def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory): + exec(custom_cronos, tmp_path_factory) diff --git a/integration_tests/utils.py b/integration_tests/utils.py index 3dd6bf190b..323207d83e 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -59,6 +59,7 @@ "CosmosERC20": "CosmosToken.sol", "TestBank": "TestBank.sol", "TestICA": "TestICA.sol", + "Random": "Random.sol", }