Skip to content

Commit

Permalink
Problem: estimate gas in evm tx is not accurate in relayer
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 16, 2023
1 parent f48d42e commit ddf6e8d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
6 changes: 4 additions & 2 deletions integration_tests/ibc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class IBCNetwork(NamedTuple):
chainmain: Chainmain
hermes: Hermes | None
incentivized: bool
proc: subprocess.Popen[bytes] | None


def call_hermes_cmd(
Expand Down Expand Up @@ -163,6 +164,7 @@ def prepare_network(
else:
call_rly_cmd(path, connection_only, version)

proc = None
if incentivized:
# register fee payee
src_chain = cronos.cosmos_cli()
Expand All @@ -183,7 +185,7 @@ def prepare_network(
cronos.supervisorctl("start", "relayer-demo")
port = hermes.port
else:
subprocess.Popen(
proc = subprocess.Popen(
[
"rly",
"start",
Expand All @@ -194,7 +196,7 @@ def prepare_network(
preexec_fn=os.setsid,
)
port = 5183
yield IBCNetwork(cronos, chainmain, hermes, incentivized)
yield IBCNetwork(cronos, chainmain, hermes, incentivized, proc)
if port:
wait_for_port(port)

Expand Down
30 changes: 23 additions & 7 deletions integration_tests/test_ibc_rly.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
import os
import signal
import subprocess

import pytest
Expand Down Expand Up @@ -42,13 +44,27 @@
@pytest.fixture(scope="module")
def ibc(request, tmp_path_factory):
"prepare-network"
name = "ibc_rly"
path = tmp_path_factory.mktemp(name)
yield from prepare_network(
path,
name,
relayer=cluster.Relayer.RLY.value,
)
path = tmp_path_factory.mktemp("ibc_rly")
procs = []
try:
for network in prepare_network(
path,
"ibc_rly",
relayer=cluster.Relayer.RLY.value,
):
if network.proc:
procs.append(network.proc)
print("append:", network.proc)
yield network
finally:
print("finally:", procs)
for proc in procs:
try:
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
except ProcessLookupError:
pass
# proc.terminate()
proc.wait()


def rly_transfer(ibc):
Expand Down
10 changes: 5 additions & 5 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@
"relayer": {
"branch": "main",
"description": "An IBC relayer for ibc-go",
"homepage": "https://github.com/crypto-org-chain/relayer",
"owner": "crypto-org-chain",
"homepage": "https://github.com/mmsqe/relayer",
"owner": "mmsqe",
"repo": "relayer",
"rev": "f202a264463e9d5829398f6be50bff990421b483",
"sha256": "08x4bhwglx12rp78gs4hzgp2cywzqwr7gghk1kxasmvy9z0qxp92",
"rev": "723e4785841a5e2e274929d6a8c2bebd8d4d2760",
"sha256": "0ghf98vmaz80nr519n559b4snwgz3kvds9b2wvzdj02cyprbrfhv",
"type": "tarball",
"url": "https://github.com/crypto-org-chain/relayer/archive/f202a264463e9d5829398f6be50bff990421b483.tar.gz",
"url": "https://github.com/mmsqe/relayer/archive/723e4785841a5e2e274929d6a8c2bebd8d4d2760.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

0 comments on commit ddf6e8d

Please sign in to comment.