From 0c0c55cb407cd621e47166a93d06435058b05446 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 29 Nov 2024 17:57:41 +0800 Subject: [PATCH 1/3] Problem: no enough db type tested for nodes add goleveldb --- integration_tests/configs/default.jsonnet | 13 +++++++++++++ integration_tests/utils.py | 1 + scripts/.env | 1 + 3 files changed, 15 insertions(+) diff --git a/integration_tests/configs/default.jsonnet b/integration_tests/configs/default.jsonnet index f42efc5ac5..3a37464ffc 100644 --- a/integration_tests/configs/default.jsonnet +++ b/integration_tests/configs/default.jsonnet @@ -59,6 +59,19 @@ client_config: { 'broadcast-mode': 'sync', }, + config: { + db_backend: 'goleveldb', + }, + 'app-config': { + 'app-db-backend': 'goleveldb', + }, + }, { + coins: '1000000000000000000stake,10000000000000000000000basetcro', + staked: '1000000000000000000stake', + mnemonic: '${VALIDATOR3_MNEMONIC}', + client_config: { + 'broadcast-mode': 'sync', + }, config: { db_backend: 'pebbledb', }, diff --git a/integration_tests/utils.py b/integration_tests/utils.py index c4474d8ce6..5ea3680dbb 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -36,6 +36,7 @@ ACCOUNTS = { "validator": Account.from_mnemonic(os.getenv("VALIDATOR1_MNEMONIC")), "validator2": Account.from_mnemonic(os.getenv("VALIDATOR2_MNEMONIC")), + "validator3": Account.from_mnemonic(os.getenv("VALIDATOR3_MNEMONIC")), "community": Account.from_mnemonic(os.getenv("COMMUNITY_MNEMONIC")), "signer1": Account.from_mnemonic(os.getenv("SIGNER1_MNEMONIC")), "signer2": Account.from_mnemonic(os.getenv("SIGNER2_MNEMONIC")), diff --git a/scripts/.env b/scripts/.env index 647508dd10..8626f66794 100644 --- a/scripts/.env +++ b/scripts/.env @@ -1,6 +1,7 @@ export PASSWORD='123456' export VALIDATOR1_MNEMONIC="visit craft resemble online window solution west chuckle music diesel vital settle comic tribe project blame bulb armed flower region sausage mercy arrive release" export VALIDATOR2_MNEMONIC="direct travel shrug hand twice agent sail sell jump phone velvet pilot mango charge usual multiply orient garment bleak virtual action mention panda vast" +export VALIDATOR3_MNEMONIC="panda much deny whale fun iron liquid rookie rice ridge artist slush legend salad adapt public all thunder galaxy give ostrich endless prosper good" export COMMUNITY_MNEMONIC="notable error gospel wave pair ugly measure elite toddler cost various fly make eye ketchup despair slab throw tribe swarm word fruit into inmate" export SIGNER1_MNEMONIC="shed crumble dismiss loyal latin million oblige gesture shrug still oxygen custom remove ribbon disorder palace addict again blanket sad flock consider obey popular" export SIGNER2_MNEMONIC="night renew tonight dinner shaft scheme domain oppose echo summer broccoli agent face guitar surface belt veteran siren poem alcohol menu custom crunch index" From 413c8548eeb1293d53cf7d1ced0db5818f9288aa Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 29 Nov 2024 18:29:42 +0800 Subject: [PATCH 2/3] fix --- integration_tests/test_rollback.py | 8 ++++---- integration_tests/test_upgrade.py | 8 ++++++-- integration_tests/test_versiondb.py | 10 +++++++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/integration_tests/test_rollback.py b/integration_tests/test_rollback.py index 9bcce10a3a..040de7a7db 100644 --- a/integration_tests/test_rollback.py +++ b/integration_tests/test_rollback.py @@ -31,8 +31,8 @@ def update_node_cmd(path, cmd, i): def post_init(broken_binary): def inner(path, base_port, config): chain_id = "cronos_777-1" - update_node_cmd(path / chain_id, broken_binary, 2) update_node_cmd(path / chain_id, broken_binary, 3) + update_node_cmd(path / chain_id, broken_binary, 4) return inner @@ -67,10 +67,10 @@ def test_rollback(custom_cronos): - use rollback command to rollback the db. - switch to correct binary should make the node syncing again. - node2: test memiavl node - node3: test iavl node + node3: test memiavl node + node4: test iavl node """ - nodes = [2, 3] + nodes = [3, 4] clis = {i: custom_cronos.cosmos_cli(i) for i in nodes} for i, cli in clis.items(): wait_for_port(ports.rpc_port(custom_cronos.base_port(i))) diff --git a/integration_tests/test_upgrade.py b/integration_tests/test_upgrade.py index f71447c66f..142d5a7429 100644 --- a/integration_tests/test_upgrade.py +++ b/integration_tests/test_upgrade.py @@ -157,7 +157,9 @@ def exec(c, tmp_path_factory): json.dump(json.loads(cli.export()), fp) fp.flush() - c.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1") + c.supervisorctl( + "start", "cronos_777-1-node0", "cronos_777-1-node1", "cronos_777-1-node2" + ) wait_for_port(ports.evmrpc_port(base_port)) wait_for_new_blocks(cli, 1) @@ -278,7 +280,9 @@ def do_upgrade(plan_name, target, mode=None): genesis["genesis_time"] = config.get("genesis-time") file = c.cosmos_cli(i).data_dir / "config/genesis.json" file.write_text(json.dumps(genesis)) - c.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1") + c.supervisorctl( + "start", "cronos_777-1-node0", "cronos_777-1-node1", "cronos_777-1-node2" + ) wait_for_new_blocks(c.cosmos_cli(), 1) height = cli.block_height() diff --git a/integration_tests/test_versiondb.py b/integration_tests/test_versiondb.py index d79dfa5ac3..eece5eebf7 100644 --- a/integration_tests/test_versiondb.py +++ b/integration_tests/test_versiondb.py @@ -72,9 +72,13 @@ def test_versiondb_migration(cronos: Cronos): patch_app_db_backend(cli1.data_dir / "config/app.toml", "rocksdb") print("start all nodes") - print(cronos.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1")) - wait_for_port(ports.evmrpc_port(cronos.base_port(0))) - wait_for_port(ports.evmrpc_port(cronos.base_port(1))) + print( + cronos.supervisorctl( + "start", "cronos_777-1-node0", "cronos_777-1-node1", "cronos_777-1-node2" + ) + ) + for i in range(len(cronos.config["validators"])): + wait_for_port(ports.evmrpc_port(cronos.base_port(i))) assert w3.eth.get_balance(community, block_identifier=block0) == balance0 assert w3.eth.get_balance(community, block_identifier=block1) == balance1 From bbe7c9eda09d185e2b0d89eda0452159dbf2840e Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 29 Nov 2024 18:30:16 +0800 Subject: [PATCH 3/3] fix --- integration_tests/configs/default.jsonnet | 8 ++++---- integration_tests/test_mempool.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/integration_tests/configs/default.jsonnet b/integration_tests/configs/default.jsonnet index 3a37464ffc..dddcb55af0 100644 --- a/integration_tests/configs/default.jsonnet +++ b/integration_tests/configs/default.jsonnet @@ -60,10 +60,10 @@ 'broadcast-mode': 'sync', }, config: { - db_backend: 'goleveldb', + db_backend: 'pebbledb', }, 'app-config': { - 'app-db-backend': 'goleveldb', + 'app-db-backend': 'pebbledb', }, }, { coins: '1000000000000000000stake,10000000000000000000000basetcro', @@ -73,10 +73,10 @@ 'broadcast-mode': 'sync', }, config: { - db_backend: 'pebbledb', + db_backend: 'goleveldb', }, 'app-config': { - 'app-db-backend': 'pebbledb', + 'app-db-backend': 'goleveldb', }, }], accounts: [{ diff --git a/integration_tests/test_mempool.py b/integration_tests/test_mempool.py index bdd921cab1..488988848a 100644 --- a/integration_tests/test_mempool.py +++ b/integration_tests/test_mempool.py @@ -61,7 +61,7 @@ def test_mempool(cronos_mempool): print(f"all send tx hash: {sended_hash_set} at {block_num_0}") all_pending = w3.eth.get_filter_changes(filter.filter_id) - assert len(all_pending) == 4 + assert len(all_pending) == len(KEYS.items()) - 1 block_num_1 = w3.eth.get_block_number() print(f"block_num_1 {block_num_1}")