Skip to content

Commit 8beca27

Browse files
authored
Problem: no handler exists for proposal type when update-client (#945) (#958)
1 parent 5caafe5 commit 8beca27

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- https://github.com/crypto-org-chain/ethermint/pull/233
1515
- update cosmos-sdk to include one bug fix
1616
- https://github.com/cosmos/cosmos-sdk/pull/15667
17+
* [#945](https://github.com/crypto-org-chain/cronos/pull/945) Fix no handler exists for proposal type error when update-client due to wrong ibc route.
1718

1819
*Mar 16, 2023*
1920

app/app.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ import (
100100
ibc "github.com/cosmos/ibc-go/v5/modules/core"
101101
ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client"
102102
ibcclientclient "github.com/cosmos/ibc-go/v5/modules/core/02-client/client"
103+
ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
103104
porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types"
104105
ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host"
105106
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
@@ -515,7 +516,7 @@ func New(
515516
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
516517
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
517518
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
518-
AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
519+
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
519520
AddRoute(cronostypes.RouterKey, cronos.NewTokenMappingChangeProposalHandler(app.CronosKeeper))
520521

521522
govConfig := govtypes.DefaultConfig()

integration_tests/cosmoscli.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,31 @@ def gov_propose_token_mapping_change(
11081108
)
11091109
)
11101110

1111+
def gov_propose_update_client_legacy(self, proposal, **kwargs):
1112+
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
1113+
kwargs.setdefault("gas", 600000)
1114+
return json.loads(
1115+
self.raw(
1116+
"tx",
1117+
"gov",
1118+
"submit-legacy-proposal",
1119+
"update-client",
1120+
proposal.get("subject_client_id"),
1121+
proposal.get("substitute_client_id"),
1122+
"-y",
1123+
from_=proposal.get("from"),
1124+
keyring_backend="test",
1125+
# content
1126+
title=proposal.get("title"),
1127+
description=proposal.get("description"),
1128+
deposit=proposal.get("deposit"),
1129+
chain_id=self.chain_id,
1130+
home=self.data_dir,
1131+
stderr=subprocess.DEVNULL,
1132+
**kwargs,
1133+
)
1134+
)
1135+
11111136
def update_token_mapping(self, denom, contract, symbol, decimals, **kwargs):
11121137
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
11131138
return json.loads(
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import subprocess
2+
import time
3+
4+
import pytest
5+
6+
from .ibc_utils import prepare_network
7+
8+
9+
@pytest.fixture(scope="module")
10+
def ibc(request, tmp_path_factory):
11+
"prepare-network"
12+
name = "ibc"
13+
path = tmp_path_factory.mktemp(name)
14+
network = prepare_network(path, name)
15+
yield from network
16+
17+
18+
def test_ibc_update_client(ibc):
19+
"""
20+
test update expire subject client with new active client
21+
"""
22+
cmd = [
23+
"hermes",
24+
"--config",
25+
ibc.hermes.configpath,
26+
"create",
27+
"client",
28+
"--host-chain",
29+
"cronos_777-1",
30+
"--reference-chain",
31+
"chainmain-1",
32+
]
33+
subprocess.check_call(cmd + ["--trusting-period", "1s"])
34+
time.sleep(1)
35+
subprocess.check_call(cmd)
36+
cli = ibc.cronos.cosmos_cli()
37+
rsp = cli.gov_propose_update_client_legacy(
38+
{
39+
"subject_client_id": "07-tendermint-1",
40+
"substitute_client_id": "07-tendermint-2",
41+
"from": "validator",
42+
"title": "update-client-title",
43+
"description": "update-client-description",
44+
"deposit": "1basetcro",
45+
},
46+
)
47+
assert rsp["code"] == 0, rsp["raw_log"]

0 commit comments

Comments
 (0)