Skip to content

Commit fa6497f

Browse files
committed
test store list
1 parent 1925d5e commit fa6497f

File tree

5 files changed

+51
-22
lines changed

5 files changed

+51
-22
lines changed

app/proposal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (h *ProposalHandler) SetBlockList(blob []byte) error {
6464
if err != nil {
6565
return fmt.Errorf("invalid bech32 address: %s, err: %w", s, err)
6666
}
67-
m[string(addr)] = struct{}{}
67+
m[addr.String()] = struct{}{}
6868
}
6969

7070
h.Blocklist = m
@@ -84,7 +84,7 @@ func (h *ProposalHandler) ValidateTransactions(txs [][]byte) error {
8484
}
8585

8686
for _, signer := range sigTx.GetSigners() {
87-
if _, ok := h.Blocklist[string(signer)]; ok {
87+
if _, ok := h.Blocklist[signer.String()]; ok {
8888
return fmt.Errorf("signer is blocked: %s", signer.String())
8989
}
9090
}

integration_tests/cosmoscli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def staking_pool(self, bonded=True):
334334

335335
def transfer(self, from_, to, coins, generate_only=False, fees=None, **kwargs):
336336
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
337-
return json.loads(
337+
rsp = json.loads(
338338
self.raw(
339339
"tx",
340340
"bank",
@@ -349,6 +349,9 @@ def transfer(self, from_, to, coins, generate_only=False, fees=None, **kwargs):
349349
**kwargs,
350350
)
351351
)
352+
if rsp["code"] == 0:
353+
rsp = self.event_query_tx_for(rsp["txhash"])
354+
return rsp
352355

353356
def get_delegated_amount(self, which_addr):
354357
return json.loads(

integration_tests/test_e2ee.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
from .utils import encrypt_file
2-
3-
41
def test_encrypt_decrypt(cronos):
52
cli = cronos.cosmos_cli()
63

@@ -19,6 +16,16 @@ def test_encrypt_decrypt(cronos):
1916

2017
# prepare data file to encrypt
2118
content = "Hello World!"
22-
cipherfile = encrypt_file(cli, content)
19+
plainfile = cli.data_dir / "plaintext"
20+
plainfile.write_text(content)
21+
22+
cipherfile = cli.data_dir / "ciphertext"
23+
cli.encrypt(
24+
plainfile,
25+
cli.address("validator"),
26+
cli.address("community"),
27+
output=cipherfile,
28+
)
29+
2330
assert cli.decrypt(cipherfile, identity="key0") == content
2431
assert cli.decrypt(cipherfile, identity="key1") == content

integration_tests/test_gov_update_params.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
import json
33

44
import pytest
5+
from pystarport import ports
56

6-
from .utils import CONTRACTS, approve_proposal, deploy_contract, eth_to_bech32
7+
from .utils import (
8+
CONTRACTS,
9+
approve_proposal,
10+
deploy_contract,
11+
eth_to_bech32,
12+
wait_for_new_blocks,
13+
wait_for_port,
14+
)
715

816
pytestmark = pytest.mark.gov
917

@@ -86,3 +94,28 @@ def test_gov_update_params(cronos, tmp_path):
8694
rsp = cli.query_params()
8795
print("params", rsp)
8896
assert rsp == params
97+
98+
# gen two keys for two accounts
99+
name = "e2ee-identity"
100+
pubkey0 = cli.keygen(keyring_name=name)
101+
cli.register_e2ee_key(pubkey0, _from="validator")
102+
assert cli.query_e2ee_key(cli.address("validator")) == pubkey0
103+
cronos.supervisorctl("stop", "cronos_777-1-node0")
104+
cronos.supervisorctl("start", "cronos_777-1-node0")
105+
wait_for_port(ports.evmrpc_port(cronos.base_port(0)))
106+
107+
addr = cli.address("user")
108+
plainfile = cli.data_dir / "plaintext"
109+
plainfile.write_text(json.dumps({"addresses": [addr]}))
110+
cipherfile = cli.data_dir / "ciphertext"
111+
cli.encrypt(
112+
plainfile,
113+
cli.address("validator"),
114+
output=cipherfile,
115+
)
116+
rsp = cli.store_blocklist(cipherfile, from_="validator")
117+
assert rsp["code"] == 0, rsp["raw_log"]
118+
wait_for_new_blocks(cli, 4)
119+
rsp = cli.transfer(addr, cli.address("validator"), "1basecro")
120+
assert rsp["code"] != 0
121+
assert "signer is blocked" in rsp["raw_log"]

integration_tests/utils.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -732,17 +732,3 @@ def get_send_enable(port):
732732
url = f"http://127.0.0.1:{port}/cosmos/bank/v1beta1/params"
733733
raw = requests.get(url).json()
734734
return raw["params"]["send_enabled"]
735-
736-
737-
def encrypt_file(cli, content):
738-
plainfile = cli.data_dir / "plaintext"
739-
plainfile.write_text(content)
740-
741-
cipherfile = cli.data_dir / "ciphertext"
742-
cli.encrypt(
743-
plainfile,
744-
cli.address("validator"),
745-
cli.address("community"),
746-
output=cipherfile,
747-
)
748-
return cipherfile

0 commit comments

Comments
 (0)