Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jzvikart committed Nov 15, 2023
1 parent 196b289 commit 5ceb41c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
3 changes: 3 additions & 0 deletions test/integration/framework/src/siftool/chainbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ def __brutally_terminate_processes(cmd):

# This is used for bulding sifchain-testnet-2
def install_testnet(cmd: command.Command, base_dir: str, chain_id: str):
prj = project.Project(cmd)
mnemonics = prj.read_peruser_config_file("mnemonics.json")

faucet_mnemonic = "fiction cousin fragile allow fruit slogan useless sting exile virus scale dress fatigue eight clay sort tape between cargo flag civil rude umbrella sing".split()
node0_admin_mnemonic = "frog skin business valve fish fat glory syrup chicken skin slow ensure sun luggage wild click into paper swamp car ecology infant thought squeeze".split()
node1_admin_mnemonic = "system faculty master promote among arrive dose zone cream fame barrel warm slice please creek puzzle boat excess rain lonely cupboard flame punch shed".split()
Expand Down
3 changes: 2 additions & 1 deletion test/integration/framework/src/siftool/cosmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,15 @@ def transfer(cmd, channel, address, amount, from_addr, chain_id, node, gas_price
args = [akash_binary, "tx", "ibc-transfer", "transfer", "transfer", channel,
address, amount, "--from", from_addr, "--keyring-backend", keyring_backend,
"--chain-id", chain_id, "--node", node, "-y", "--gas-prices", gas_prices,
"--gas", gas, "--packet-timeout-timestam[", str(packet_timeout_timestamp)]
"--gas", gas, "--packet-timeout-timestamp", str(packet_timeout_timestamp)]
res = cmd.execst(args)
return res

# </editor-fold>


# Example: "channel-141", "uosmo" -> "ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC"
# The channel_id is for the side that is receiving the denom (not the counterparty).
# See https://tutorials.cosmos.network/tutorials/6-ibc-dev/
def derive_ibc_denom_hash(channel: str, denom: str) -> str:
port = "transfer" # Seems to be a constant for IBC token transfers
Expand Down
13 changes: 7 additions & 6 deletions test/integration/framework/src/siftool/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, cmd: command.Command, chain_id: Optional[str] = None, sifnode
self.chain_id = chain_id or "localnet"
self.staking_denom = ROWAN
self.default_binary = "sifnoded"
self.port_offset = 0
self.node_info: List[JsonDict] = []
self.clp_admin: Optional[cosmos.Address] = None
self.oracle_admin: Optional[cosmos.Address] = None
Expand Down Expand Up @@ -113,12 +114,12 @@ def add_validator(self, /, binary: Optional[str] = None, admin_name: Optional[s
def ports_for_node(self, i: int) -> JsonDict:
assert i < 10, "Change port configuration for 10 or more nodes"
return {
"rpc": 10286 + i,
"api": 10131 + i,
"grpc": 10909 + i,
"grpc_web": 10919 + i,
"p2p": 10276 + i,
"pprof": 10606 + i,
"rpc": 10286 + self.port_offset + i,
"api": 10131 + self.port_offset + i,
"grpc": 10909 + self.port_offset + i,
"grpc_web": 10919 + self.port_offset + i,
"p2p": 10276 + self.port_offset + i,
"pprof": 10606 + self.port_offset + i,
}

def init(self, faucet_balance: Optional[cosmos.Balance] = None, faucet_mnemonic: Optional[Sequence[str]] = None,
Expand Down
6 changes: 3 additions & 3 deletions test/integration/framework/src/siftool/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ def write_vagrantenv_sh(self, state_vars, data_dir, ethereum_websocket_address,
self.cmd.write_text_file(vagrantenv_path, joinlines(format_as_shell_env_vars(env)))
self.cmd.write_text_file(project_dir("test/integration/vagrantenv.json"), json.dumps(env))

def get_peruser_config_dir(self):
def get_peruser_config_dir(self) -> str:
return self.cmd.get_user_home(".config", "siftool")

def get_user_env_vars(self):
def get_user_env_vars(self) -> JsonDict:
env_file = os.environ["SIFTOOL_ENV_FILE"]
return json.loads(self.cmd.read_text_file(env_file))

def read_peruser_config_file(self, name):
def read_peruser_config_file(self, name) -> Optional[JsonDict]:
path = os.path.join(self.get_peruser_config_dir(), name + ".json")
if self.cmd.exists(path):
return json.loads(self.cmd.read_text_file(path))
Expand Down
16 changes: 15 additions & 1 deletion test/integration/framework/src/siftool/sifchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
import toml
import web3 # TODO Remove dependency
from typing import Mapping, Any, Tuple, AnyStr
from typing import Mapping, Any, Tuple
from siftool import command, cosmos, eth
from siftool.common import *

Expand Down Expand Up @@ -1022,6 +1022,20 @@ def version(self) -> str:
def gov_submit_software_upgrade(self, version: str, from_acct: cosmos.Address, deposit: cosmos.Balance,
upgrade_height: int, upgrade_info: str, title: str, description: str, broadcast_mode: Optional[str] = None
):
# Example:
# sifnoded tx gov submit-proposal software-upgrade 1.2.0-beta \
# --title "Sifchain 1.2.0-beta Upgrade" \
# --description "Sifchain 1.2.0-beta Upgrade" \
# --upgrade-height BLOCK_HEIGHT \
# --deposit 50000000000000000000000rowan \
# --from ACCOUNT \
# --keyring-backend test \
# --chain-id=sifchain-1 \
# --node https://sifchain-rpc.polkachu.com:443 \
# --broadcast-mode block \
# --fees 10000000000000000000000rowan \
# --gas 200000 \
# --yes
args = ["tx", "gov", "submit-proposal", "software-upgrade", version, "--from", from_acct, "--deposit",
cosmos.balance_format(deposit), "--upgrade-height", str(upgrade_height), "--upgrade-info", upgrade_info,
"--title", title, "--description", description] + self._home_args() + self._keyring_backend_args() + \
Expand Down

0 comments on commit 5ceb41c

Please sign in to comment.