Skip to content

Commit

Permalink
Problem: no enough db type tested for nodes (#1710)
Browse files Browse the repository at this point in the history
* Problem: no enough db type tested for nodes

add goleveldb

* fix

* fix
  • Loading branch information
mmsqe authored Nov 29, 2024
1 parent de33114 commit 3beaf73
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
13 changes: 13 additions & 0 deletions integration_tests/configs/default.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@
'app-config': {
'app-db-backend': 'pebbledb',
},
}, {
coins: '1000000000000000000stake,10000000000000000000000basetcro',
staked: '1000000000000000000stake',
mnemonic: '${VALIDATOR3_MNEMONIC}',
client_config: {
'broadcast-mode': 'sync',
},
config: {
db_backend: 'goleveldb',
},
'app-config': {
'app-db-backend': 'goleveldb',
},
}],
accounts: [{
name: 'community',
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/test_rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)))
Expand Down
8 changes: 6 additions & 2 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down
10 changes: 7 additions & 3 deletions integration_tests/test_versiondb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
1 change: 1 addition & 0 deletions scripts/.env
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 3beaf73

Please sign in to comment.