diff --git a/integration_tests/cosmoscli.py b/integration_tests/cosmoscli.py index 56d293644e..6019d2ea92 100644 --- a/integration_tests/cosmoscli.py +++ b/integration_tests/cosmoscli.py @@ -9,7 +9,6 @@ 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 @@ -1748,6 +1747,6 @@ def event_query_tx_for(self, hash): ) ) - 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"] + def query_bank_send(self): + res = json.loads(self.raw("q", "bank", "send-enabled", home=self.data_dir)) + return res["send_enabled"] diff --git a/integration_tests/test_basic.py b/integration_tests/test_basic.py index 15ae15c7a6..b39af932aa 100644 --- a/integration_tests/test_basic.py +++ b/integration_tests/test_basic.py @@ -18,6 +18,7 @@ KEYS, Greeter, RevertTestContract, + approve_proposal, build_batch_tx, contract_address, contract_path, @@ -852,3 +853,36 @@ def test_replay_protection(cronos): def test_submit_any_proposal(cronos, tmp_path): submit_any_proposal(cronos, tmp_path) + + +def test_submit_send_enabled(cronos, tmp_path): + # check bank send enable + cli = cronos.cosmos_cli() + p = cli.query_bank_send() + assert len(p) == 0, "should be empty" + proposal = tmp_path / "proposal.json" + # governance module account as signer + signer = "crc10d07y265gmmuvt4z0w9aw880jnsr700jdufnyd" + send_enable = [ + {"denom": "basetcro", "enabled": False}, + {"denom": "stake", "enabled": True}, + ] + proposal_src = { + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSetSendEnabled", + "authority": signer, + "sendEnabled": send_enable, + } + ], + "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_bank_send() + assert sorted(p, key=lambda x: x["denom"]) == send_enable diff --git a/integration_tests/test_upgrade.py b/integration_tests/test_upgrade.py index e9629bd8e6..99fcc6981b 100644 --- a/integration_tests/test_upgrade.py +++ b/integration_tests/test_upgrade.py @@ -14,6 +14,7 @@ approve_proposal, deploy_contract, edit_ini_sections, + get_consensus_params, send_transaction, wait_for_block, wait_for_new_blocks, @@ -160,7 +161,7 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory): ) # check consensus params port = ports.rpc_port(custom_cronos.base_port(0)) - res = cli.consensus_params(port, w3.eth.get_block_number()) + res = get_consensus_params(port, w3.eth.get_block_number()) assert res["block"]["max_gas"] == "60000000" rsp = cli.query_params("icaauth") diff --git a/integration_tests/utils.py b/integration_tests/utils.py index 9fd9a481b2..6db1937cb1 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -15,6 +15,7 @@ import bech32 import eth_utils import pytest +import requests import rlp import toml from dateutil.parser import isoparse @@ -716,3 +717,8 @@ def get_logs_since(w3, addr, start): "address": [addr], } ) + + +def get_consensus_params(port, height): + url = f"http://127.0.0.1:{port}/consensus_params?height={height}" + return requests.get(url).json()["result"]["consensus_params"]