Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Nov 30, 2024
1 parent d5fd3e3 commit 3797446
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
15 changes: 15 additions & 0 deletions integration_tests/configs/permissions.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local config = import 'default.jsonnet';

config {
'cronos_777-1'+: {
genesis+: {
app_state+: {
cronos+: {
params+: {
cronos_admin: 'crc18z6q38mhvtsvyr5mak8fj8s8g4gw7kjjtsgrn7', //same account as VALIDATOR2_MNEMONIC
},
},
},
},
},
}
20 changes: 16 additions & 4 deletions integration_tests/test_permissions.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import os
from pathlib import Path

import pytest

from .network import setup_custom_cronos
from .utils import ADDRS, eth_to_bech32, wait_for_new_blocks


def test_permissions_updates(cronos):
@pytest.fixture(scope="module")
def custom_cronos(tmp_path_factory):
path = tmp_path_factory.mktemp("cronos")
yield from setup_custom_cronos(
path, 27100, Path(__file__).parent / "configs/permissions.jsonnet"
)


def test_permissions_updates(custom_cronos):
"""
- test permissions updates
- reproduce an iavl prune issue: https://github.com/cosmos/iavl/pull/1007
"""
acc = eth_to_bech32(ADDRS["signer1"])
cli = cronos.cosmos_cli(1) # node1 is iavl
cli = custom_cronos.cosmos_cli(1) # node1 is iavl
cli.create_account("community", os.environ["COMMUNITY_MNEMONIC"])
rsp = cli.query_permissions(acc)
print("permissions", rsp)
Expand All @@ -30,9 +42,9 @@ def test_permissions_updates(cronos):
assert rsp["can_change_token_mapping"] is True
assert rsp["can_turn_bridge"] is True

cronos.supervisorctl("stop", "cronos_777-1-node1")
custom_cronos.supervisorctl("stop", "cronos_777-1-node1")
print(cli.prune())
cronos.supervisorctl("start", "cronos_777-1-node1")
custom_cronos.supervisorctl("start", "cronos_777-1-node1")

rsp = cli.update_permissions(acc, 4, from_="validator")
assert rsp["code"] == 0, rsp["raw_log"]
Expand Down
5 changes: 2 additions & 3 deletions scripts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ export COMMUNITY_MNEMONIC="notable error gospel wave pair ugly measure elite tod
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"
export SIGNER3_MNEMONIC="step endless survey brand topic warrior merry boat metal throw tag recycle pitch animal drill jar hero library arm swift kitten proof acoustic chef"
# same account as VALIDATOR2_MNEMONIC
export CRONOS_ADMIN="crc18z6q38mhvtsvyr5mak8fj8s8g4gw7kjjtsgrn7"
export IBC_CRO_DENOM="ibc/6411AE2ADA1E73DB59DB151A8988F9B7D5E7E233D8414DB6817F8F1A01611F86"
export CRONOS_ADMIN="crc12luku6uxehhak02py4rcz65zu0swh7wjsrw0pp"
export IBC_CRO_DENOM="ibc/6411AE2ADA1E73DB59DB151A8988F9B7D5E7E233D8414DB6817F8F1A01611F86"

0 comments on commit 3797446

Please sign in to comment.