-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: require gas in relayer precompile is higher than consumed (#…
…1232) * Problem: require gas in relayer precompile is higher than consumed Update CHANGELOG.md Signed-off-by: mmsqe <mavis@crypto.com> * fix balance change in timeout test * fix test * simplify event test * fix recvPacket * add missing channel close * fix build * Update x/cronos/keeper/precompiles/relayer.go Co-authored-by: yihuang <huang@crypto.com> Signed-off-by: mmsqe <mavis@crypto.com> * Update x/cronos/keeper/precompiles/relayer.go Co-authored-by: yihuang <huang@crypto.com> Signed-off-by: mmsqe <mavis@crypto.com> * Update x/cronos/keeper/precompiles/relayer.go Co-authored-by: yihuang <huang@crypto.com> Signed-off-by: mmsqe <mavis@crypto.com> --------- Signed-off-by: mmsqe <mavis@crypto.com> Co-authored-by: yihuang <huang@crypto.com>
- Loading branch information
Showing
12 changed files
with
181 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
local ibc = import 'ibc.jsonnet'; | ||
|
||
ibc { | ||
'chainmain-1'+: { | ||
validators: [ | ||
{ | ||
coins: '987870000000000000cro', | ||
staked: '20000000000000cro', | ||
mnemonic: '${VALIDATOR' + i + '_MNEMONIC}', | ||
client_config: { | ||
'broadcast-mode': 'block', | ||
}, | ||
base_port: 26800 + i * 10, | ||
} | ||
for i in std.range(1, 2) | ||
], | ||
}, | ||
relayer+: { | ||
chains: [super.chains[0] { | ||
precompiled_contract_address: '0x0000000000000000000000000000000000000065', | ||
max_gas: 1000000, | ||
gas_multiplier: 1.2, | ||
}] + super.chains[1:], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
local ibc = import 'ibc_rly.jsonnet'; | ||
|
||
ibc { | ||
relayer+: { | ||
chains: [super.chains[0] { | ||
precompiled_contract_address: '0x0000000000000000000000000000000000000065', | ||
}] + super.chains[1:], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
from pystarport import cluster | ||
|
||
from .ibc_utils import log_gas_records, prepare_network, rly_transfer | ||
from .utils import wait_for_new_blocks | ||
|
||
|
||
@pytest.fixture(scope="module", params=["ibc_rly", "ibc_rly_evm"]) | ||
def ibc(request, tmp_path_factory): | ||
"prepare-network" | ||
name = request.param | ||
path = tmp_path_factory.mktemp(name) | ||
yield from prepare_network(path, name, relayer=cluster.Relayer.RLY.value) | ||
|
||
|
||
records = [] | ||
|
||
|
||
def test_ibc(ibc): | ||
# chainmain-1 relayer -> cronos_777-1 signer2 | ||
cli = ibc.cronos.cosmos_cli() | ||
wait_for_new_blocks(cli, 1) | ||
rly_transfer(ibc) | ||
diff = 0.5 | ||
record = log_gas_records(cli) | ||
if record: | ||
records.append(record) | ||
if len(records) == 2: | ||
for e1, e2 in zip(*records): | ||
res = e2 / e1 | ||
assert 1 - diff <= res <= 1 + diff, res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.