Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: min_gas_price related change is not tested #1264

Merged
merged 26 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration_tests/configs/ibc.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ config {
chains: [
{
id: 'cronos_777-1',
max_gas: 500000,
gas_multiplier: 4,
max_gas: 1000000,
gas_multiplier: 1.1,
address_type: {
derivation: 'ethermint',
proto_type: {
Expand Down
6 changes: 0 additions & 6 deletions integration_tests/configs/ibc_rly.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@ ibc {
for i in std.range(1, 2)
],
},
relayer+: {
chains: [super.chains[0] {
max_gas: 1000000,
gas_multiplier: 1.1,
}] + super.chains[1:],
},
}
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 11 additions & 0 deletions integration_tests/configs/ibc_timeout.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ local ibc = import 'ibc.jsonnet';

ibc {
'cronos_777-1'+: {
key_name: 'signer3',
accounts: super.accounts + [{
name: 'signer3',
coins: '0basetcro',
mnemonic: '${SIGNER3_MNEMONIC}',
}],
genesis+: {
app_state+: {
cronos+: {
Expand All @@ -12,4 +18,9 @@ ibc {
},
},
},
relayer+: {
chains: [super.chains[0] {
fee_granter: 'crc16z0herz998946wr659lr84c8c556da55dc34hh', //signer1
}] + super.chains[1:],
},
}
21 changes: 21 additions & 0 deletions integration_tests/configs/min_gas_price.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
local config = import 'default.jsonnet';

config {
'cronos_777-1'+: {
validators: [validator {
gas_prices: '10000000000000basetcro',
} for validator in super.validators],
genesis+: {
app_state+: {
feemarket+: {
params+: {
base_fee_change_denominator: '300',
elasticity_multiplier: '4',
base_fee: '10000000000000',
min_gas_price: '10000000000000',
},
},
},
},
},
}
38 changes: 32 additions & 6 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,11 @@ def ibc_transfer(
amount,
channel, # src channel
target_version, # chain version number of target chain
fee,
i=0,
**kwargs,
):
default_kwargs = {
"home": self.data_dir,
}
return json.loads(
self.raw(
"tx",
Expand All @@ -835,18 +837,16 @@ def ibc_transfer(
channel,
to,
amount,
"--fees",
fee,
"-y",
# FIXME https://github.com/cosmos/cosmos-sdk/issues/8059
"--absolute-timeouts",
from_=from_,
home=self.data_dir,
node=self.node_rpc,
keyring_backend="test",
chain_id=self.chain_id,
packet_timeout_height=f"{target_version}-10000000000",
packet_timeout_timestamp=0,
**(default_kwargs | kwargs),
)
)

Expand Down Expand Up @@ -1535,7 +1535,7 @@ def pay_packet_fee(self, port_id, channel_id, packet_seq, **kwargs):
default_kwargs = {
"home": self.data_dir,
}
return json.loads(
rsp = json.loads(
self.raw(
"tx",
"ibc-fee",
Expand All @@ -1547,6 +1547,9 @@ def pay_packet_fee(self, port_id, channel_id, packet_seq, **kwargs):
**(default_kwargs | kwargs),
)
)
if rsp["code"] == 0:
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp

def query_grant(self, granter, grantee):
"query grant details by granter and grantee addresses"
Expand All @@ -1561,6 +1564,29 @@ def query_grant(self, granter, grantee):
)
)

def grant(self, granter, grantee, limit, **kwargs):
default_kwargs = self.get_default_kwargs()
rsp = json.loads(
self.raw(
"tx",
"feegrant",
"grant",
granter,
grantee,
"--period",
"60",
"--period-limit",
limit,
"-y",
home=self.data_dir,
stderr=subprocess.DEVNULL,
**(default_kwargs | kwargs),
)
)
if rsp["code"] == 0:
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp

def query_batches(self):
"query all gravity batches"
return json.loads(
Expand Down
37 changes: 26 additions & 11 deletions integration_tests/ibc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def prepare_network(
incentivized=True,
is_relay=True,
connection_only=False,
grantee=None,
relayer=cluster.Relayer.HERMES.value,
):
print("incentivized", incentivized)
Expand All @@ -149,6 +150,19 @@ def prepare_network(
Path(__file__).parent / file,
relayer=relayer,
) as cronos:
if grantee:
cli = cronos.cosmos_cli()
granter_addr = cli.address("signer1")
grantee_addr = cli.address(grantee)
max_gas = 1000000
gas_price = 10000000000000000
limit = f"{max_gas*gas_price*2}basetcro"
rsp = cli.grant(granter_addr, grantee_addr, limit)
assert rsp["code"] == 0, rsp["raw_log"]
grant_detail = cli.query_grant(granter_addr, grantee_addr)
assert grant_detail["granter"] == granter_addr
assert grant_detail["grantee"] == grantee_addr

chainmain = Chainmain(cronos.base_dir.parent / "chainmain-1")
# wait for grpc ready
wait_for_port(ports.grpc_port(chainmain.base_port(0))) # chainmain grpc
Expand Down Expand Up @@ -324,7 +338,7 @@ def ibc_incentivized_transfer(ibc):
f"{amount}{base_denom}",
src_channel,
1,
"0basecro",
fees="0basecro",
)
assert rsp["code"] == 0, rsp["raw_log"]
src_chain = ibc.cronos.cosmos_cli()
Expand All @@ -343,7 +357,6 @@ def ibc_incentivized_transfer(ibc):
from_=sender,
)
assert rsp["code"] == 0, rsp["raw_log"]
rsp = src_chain.event_query_tx_for(rsp["txhash"])
# fee is locked
assert chains[0].balance(sender, fee_denom) == old_amt_sender_fee - 30

Expand All @@ -359,10 +372,11 @@ def check_fee():
wait_for_fn("wait for relayer to receive the fee", check_fee)

# timeout fee is refunded
assert get_balances(ibc.cronos, sender) == [
actual = get_balances(ibc.cronos, sender)
assert actual == [
{"denom": base_denom, "amount": f"{old_amt_sender_base - amount}"},
{"denom": fee_denom, "amount": f"{old_amt_sender_fee - 20}"},
]
], actual
path = f"transfer/{dst_channel}/{base_denom}"
denom_hash = hashlib.sha256(path.encode()).hexdigest().upper()
assert json.loads(
Expand All @@ -387,15 +401,16 @@ def check_fee():
f"{amount}ibc/{denom_hash}",
dst_channel,
1,
f"{fee_amount}basecro",
fees=f"{fee_amount}basecro",
)
assert rsp["code"] == 0, rsp["raw_log"]

def check_balance_change():
return chains[0].balance(sender, base_denom) != old_amt_sender_base - amount

wait_for_fn("balance change", check_balance_change)
assert chains[0].balance(sender, base_denom) == old_amt_sender_base
actual = chains[0].balance(sender, base_denom)
assert actual == old_amt_sender_base, actual
assert chains[1].balance(receiver, "basecro") == old_amt_receiver_base - fee_amount
return amount

Expand Down Expand Up @@ -461,8 +476,9 @@ def check_chainmain_balance_change():
cronos_receiver = eth_to_bech32(ADDRS["signer2"])

coin = "1000" + dest_denom
fees = "100000000basecro"
rsp = chainmain_cli.ibc_transfer(
chainmain_receiver, cronos_receiver, coin, "channel-0", 1, "100000000basecro"
chainmain_receiver, cronos_receiver, coin, "channel-0", 1, fees=fees
)
assert rsp["code"] == 0, rsp["raw_log"]

Expand Down Expand Up @@ -562,8 +578,9 @@ def check_chainmain_balance_change():
cronos_receiver = eth_to_bech32(ADDRS["signer2"])

coin = f"{amount}{dest_denom}"
fees = "100000000basecro"
rsp = chainmain_cli.ibc_transfer(
chainmain_receiver, cronos_receiver, coin, "channel-0", 1, "100000000basecro"
chainmain_receiver, cronos_receiver, coin, "channel-0", 1, fees=fees
)
assert rsp["code"] == 0, rsp["raw_log"]

Expand Down Expand Up @@ -647,9 +664,7 @@ def check_status():

def register_acc(cli, connid):
print("register ica account")
rsp = cli.icaauth_register_account(
connid, from_="signer2", gas="400000", fees="100000000basetcro"
)
rsp = cli.icaauth_register_account(connid, from_="signer2", gas="400000")
_, channel_id = assert_channel_open_init(rsp)
wait_for_check_channel_ready(cli, connid, channel_id)

Expand Down
Loading
Loading