Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/v1.3.x' into release/v1.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed May 3, 2024
2 parents 92d6366 + 101490d commit ab18183
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 37 deletions.
25 changes: 14 additions & 11 deletions integration_tests/test_e2ee.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import json

from .utils import prepare_cipherfile, wait_for_new_blocks


def test_encrypt_decrypt(cronos):
cli = cronos.cosmos_cli()
cli0 = cronos.cosmos_cli()
cli1 = cronos.cosmos_cli(1)

# gen two keys for two accounts
name0 = "key0"
name1 = "key1"
pubkey0 = cli0.keygen(keyring_name=name0)
pubkey1 = cli1.keygen(keyring_name=name1)
sender = "validator"
cli0.register_e2ee_key(pubkey0, _from=sender)
cli1.register_e2ee_key(pubkey1, _from=sender)
# query in batch
assert cli0.query_e2ee_keys(cli0.address(sender), cli1.address(sender)) == [
pubkey0,
pubkey1,
]
# prepare data file to encrypt
content = "Hello World!"
cipherfile = prepare_cipherfile(cli, cli1, name0, name1, content)
assert cli.decrypt(cipherfile, identity=name0) == content
assert cli1.decrypt(cipherfile, identity=name1) == content


def test_block_list(cronos):
cli0 = cronos.cosmos_cli()
cli1 = cronos.cosmos_cli(1)
Expand Down
1 change: 0 additions & 1 deletion integration_tests/test_gov_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
approve_proposal,
deploy_contract,
eth_to_bech32,
prepare_cipherfile,
wait_for_new_blocks,
wait_for_port,
)
Expand Down
25 changes: 0 additions & 25 deletions integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,28 +732,3 @@ def get_send_enable(port):
url = f"http://127.0.0.1:{port}/cosmos/bank/v1beta1/params"
raw = requests.get(url).json()
return raw["params"]["send_enabled"]


def prepare_cipherfile(cli0, cli1, name0, name1, content):
# gen two keys for two accounts
pubkey0 = cli0.keygen(keyring_name=name0)
pubkey1 = cli1.keygen(keyring_name=name1)
sender = "validator"
cli0.register_e2ee_key(pubkey0, _from=sender)
cli1.register_e2ee_key(pubkey1, _from=sender)
# query in batch
assert cli0.query_e2ee_keys(cli0.address(sender), cli1.address(sender)) == [
pubkey0,
pubkey1,
]
# prepare data file to encrypt
plainfile = cli0.data_dir / "plaintext"
plainfile.write_text(content)
cipherfile = cli0.data_dir / "ciphertext"
cli0.encrypt(
plainfile,
cli0.address(sender),
cli1.address(sender),
output=cipherfile,
)
return cipherfile

0 comments on commit ab18183

Please sign in to comment.