Skip to content

Commit 8241df2

Browse files
authored
fix: add missing light clients routes to IBC client keeper (#4587)
* fix: add missing routes to IBC client keeper * add changelog * remove unused scaffold code for relayer integration tests * remove unused scaffold types and bump hermes app * rollback removed changes * bump relayer version * use random chain name
1 parent c314a7c commit 8241df2

File tree

4 files changed

+51
-43
lines changed

4 files changed

+51
-43
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- [#4577](https://github.com/ignite/cli/pull/4577) Add proto version to query path.
1818
- [#4579](https://github.com/ignite/cli/pull/4579) Fix empty params response.
1919
- [#4585](https://github.com/ignite/cli/pull/4585) Fix faucet cmd issue.
20+
- [#4587](https://github.com/ignite/cli/pull/4587) Add missing light clients routes to IBC client keeper.
2021

2122
## [`v29.0.0-beta.1`](https://github.com/ignite/cli/releases/tag/v29.0.0-beta.1)
2223

ignite/cmd/plugin_default.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type defaultPlugin struct {
1818
const (
1919
PluginNetworkVersion = "v0.2.2"
2020
PluginNetworkPath = "github.com/ignite/cli-plugin-network@" + PluginNetworkVersion
21-
PluginRelayerVersion = "hermes/v0.2.4"
21+
PluginRelayerVersion = "hermes/v0.2.8"
2222
PluginRelayerPath = "github.com/ignite/apps/hermes@" + PluginRelayerVersion
2323
)
2424

ignite/templates/app/files/app/ibc.go.plush

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,14 @@ func (app *App) registerIBCModules(appOpts servertypes.AppOptions) error {
115115

116116
app.IBCKeeper.SetRouter(ibcRouter)
117117

118-
storeProvider := app.IBCKeeper.ClientKeeper.GetStoreProvider()
118+
clientKeeper := app.IBCKeeper.ClientKeeper
119+
storeProvider := clientKeeper.GetStoreProvider()
120+
119121
tmLightClientModule := ibctm.NewLightClientModule(app.appCodec, storeProvider)
122+
clientKeeper.AddRoute(ibctm.ModuleName, &tmLightClientModule)
123+
120124
soloLightClientModule := solomachine.NewLightClientModule(app.appCodec, storeProvider)
125+
clientKeeper.AddRoute(solomachine.ModuleName, &soloLightClientModule)
121126

122127
// register IBC modules
123128
if err := app.RegisterModules(

integration/relayer/cmd_relayer_test.go

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/ignite/cli/v29/ignite/pkg/cmdrunner/step"
2727
"github.com/ignite/cli/v29/ignite/pkg/errors"
2828
"github.com/ignite/cli/v29/ignite/pkg/goanalysis"
29+
"github.com/ignite/cli/v29/ignite/pkg/randstr"
2930
"github.com/ignite/cli/v29/ignite/pkg/xyaml"
3031
envtest "github.com/ignite/cli/v29/integration"
3132
)
@@ -35,8 +36,8 @@ const (
3536
)
3637

3738
var (
38-
bobName = "bob"
39-
marsConfig = v1.Config{
39+
bobName = "bob"
40+
refChainConfig = v1.Config{
4041
Config: base.Config{
4142
Version: 1,
4243
Accounts: []base.Account{
@@ -61,7 +62,7 @@ var (
6162
Coins: []string{"500token", "100000000stake"},
6263
Host: ":4501",
6364
},
64-
Genesis: xyaml.Map{"chain_id": "mars-1"},
65+
Genesis: xyaml.Map{"chain_id": randstr.Runes(12)},
6566
},
6667
Validators: []v1.Validator{
6768
{
@@ -77,11 +78,11 @@ var (
7778
"p2p": xyaml.Map{"laddr": ":26658"},
7879
"rpc": xyaml.Map{"laddr": ":26658", "pprof_laddr": ":6061"},
7980
},
80-
Home: "$HOME/.mars",
81+
Home: filepath.Join(os.TempDir(), randstr.Runes(5)),
8182
},
8283
},
8384
}
84-
earthConfig = v1.Config{
85+
hostChainConfig = v1.Config{
8586
Config: base.Config{
8687
Version: 1,
8788
Accounts: []base.Account{
@@ -106,7 +107,7 @@ var (
106107
Coins: []string{"500token", "100000000stake"},
107108
Host: ":4500",
108109
},
109-
Genesis: xyaml.Map{"chain_id": "earth-1"},
110+
Genesis: xyaml.Map{"chain_id": randstr.Runes(12)},
110111
},
111112
Validators: []v1.Validator{
112113
{
@@ -122,7 +123,7 @@ var (
122123
"p2p": xyaml.Map{"laddr": ":26656"},
123124
"rpc": xyaml.Map{"laddr": ":26656", "pprof_laddr": ":6060"},
124125
},
125-
Home: "$HOME/.earth",
126+
Home: filepath.Join(os.TempDir(), randstr.Runes(5)),
126127
},
127128
},
128129
}
@@ -384,12 +385,12 @@ func TestBlogIBC(t *testing.T) {
384385
availableport.WithMaxPort(5000),
385386
)
386387
require.NoError(t, err)
387-
earthAPI, earthRPC, earthGRPC, earthFaucet := runChain(ctx, t, env, app, earthConfig, tmpDir, ports[:7])
388-
earthChainID := earthConfig.Genesis["chain_id"].(string)
389-
earthHome := earthConfig.Validators[0].Home
390-
marsAPI, marsRPC, marsGRPC, marsFaucet := runChain(ctx, t, env, app, marsConfig, tmpDir, ports[7:])
391-
marsChainID := marsConfig.Genesis["chain_id"].(string)
392-
marsHome := marsConfig.Validators[0].Home
388+
hostChainAPI, hostChainRPC, hostChainGRPC, hostChainFaucet := runChain(ctx, t, env, app, hostChainConfig, tmpDir, ports[:7])
389+
hostChainChainID := hostChainConfig.Genesis["chain_id"].(string)
390+
hostChainHome := hostChainConfig.Validators[0].Home
391+
refChainAPI, refChainRPC, refChainGRPC, refChainFaucet := runChain(ctx, t, env, app, refChainConfig, tmpDir, ports[7:])
392+
refChainChainID := refChainConfig.Genesis["chain_id"].(string)
393+
refChainHome := refChainConfig.Validators[0].Home
393394

394395
// check the chains is up
395396
stepsCheckChains := step.NewSteps(
@@ -400,10 +401,10 @@ func TestBlogIBC(t *testing.T) {
400401
"output", "json",
401402
),
402403
step.PreExec(func() error {
403-
if err := env.IsAppServed(ctx, earthAPI); err != nil {
404+
if err := env.IsAppServed(ctx, hostChainAPI); err != nil {
404405
return err
405406
}
406-
return env.IsAppServed(ctx, marsAPI)
407+
return env.IsAppServed(ctx, refChainAPI)
407408
}),
408409
),
409410
)
@@ -417,7 +418,7 @@ func TestBlogIBC(t *testing.T) {
417418
"install",
418419
"-g",
419420
// filepath.Join(goenv.GoPath(), "src/github.com/ignite/apps/hermes"), // Local path for test proposals
420-
"github.com/ignite/apps/hermes@hermes/v0.2.2",
421+
"github.com/ignite/apps/hermes@hermes/v0.2.8",
421422
),
422423
)),
423424
))
@@ -428,14 +429,14 @@ func TestBlogIBC(t *testing.T) {
428429
"relayer",
429430
"hermes",
430431
"configure",
431-
earthChainID,
432-
earthRPC,
433-
earthGRPC,
434-
marsChainID,
435-
marsRPC,
436-
marsGRPC,
437-
"--chain-a-faucet", earthFaucet,
438-
"--chain-b-faucet", marsFaucet,
432+
hostChainChainID,
433+
hostChainRPC,
434+
hostChainGRPC,
435+
refChainChainID,
436+
refChainRPC,
437+
refChainGRPC,
438+
"--chain-a-faucet", hostChainFaucet,
439+
"--chain-b-faucet", refChainFaucet,
439440
"--generate-wallets",
440441
"--overwrite-config",
441442
),
@@ -445,7 +446,13 @@ func TestBlogIBC(t *testing.T) {
445446
go func() {
446447
env.Must(env.Exec("run the hermes relayer",
447448
step.NewSteps(step.New(
448-
step.Exec(envtest.IgniteApp, "relayer", "hermes", "start", earthChainID, marsChainID),
449+
step.Exec(envtest.IgniteApp, "relayer", "hermes", "start", hostChainChainID, refChainChainID),
450+
step.PostExec(func(execErr error) error {
451+
if execErr != nil {
452+
return execErr
453+
}
454+
return nil
455+
}),
449456
)),
450457
envtest.ExecCtx(ctx),
451458
))
@@ -465,7 +472,7 @@ func TestBlogIBC(t *testing.T) {
465472
"ibc",
466473
"channel",
467474
"channels",
468-
"--node", earthRPC,
475+
"--node", hostChainRPC,
469476
"--log_format", "json",
470477
"--output", "json",
471478
),
@@ -493,7 +500,7 @@ func TestBlogIBC(t *testing.T) {
493500
receiverAddr = "cosmos1nrksk5swk6lnmlq670a8kwxmsjnu0ezqts39sa"
494501
txOutput = &bytes.Buffer{}
495502
txResponse struct {
496-
Code int
503+
Code int `json:"code"`
497504
RawLog string `json:"raw_log"`
498505
TxHash string `json:"txhash"`
499506
}
@@ -512,9 +519,9 @@ func TestBlogIBC(t *testing.T) {
512519
receiverAddr,
513520
"100000stake",
514521
"--from", sender,
515-
"--node", earthRPC,
516-
"--home", earthHome,
517-
"--chain-id", earthChainID,
522+
"--node", hostChainRPC,
523+
"--home", hostChainHome,
524+
"--chain-id", hostChainChainID,
518525
"--output", "json",
519526
"--log_format", "json",
520527
"--keyring-backend", "test",
@@ -533,9 +540,9 @@ func TestBlogIBC(t *testing.T) {
533540
"q",
534541
"tx",
535542
txResponse.TxHash,
536-
"--node", earthRPC,
537-
"--home", earthHome,
538-
"--chain-id", earthChainID,
543+
"--node", hostChainRPC,
544+
"--home", hostChainHome,
545+
"--chain-id", hostChainChainID,
539546
"--output", "json",
540547
"--log_format", "json",
541548
),
@@ -576,9 +583,9 @@ func TestBlogIBC(t *testing.T) {
576583
"bank",
577584
"balances",
578585
receiverAddr,
579-
"--node", marsRPC,
580-
"--home", marsHome,
581-
"--chain-id", marsChainID,
586+
"--node", refChainRPC,
587+
"--home", refChainHome,
588+
"--chain-id", refChainChainID,
582589
"--log_format", "json",
583590
"--output", "json",
584591
),
@@ -604,9 +611,4 @@ func TestBlogIBC(t *testing.T) {
604611
),
605612
)
606613
env.Must(env.Exec("check ibc balance", steps, envtest.ExecRetry()))
607-
608-
// TODO test ibc using the blog post methods:
609-
// step.Exec(app.Binary(), "tx", "blog", "send-ibc-post", "transfer", "channel-0", "Hello", "Hello_Mars-Alice_from_Earth", "--chain-id", earthChainID, "--from", "alice", "--node", earthGRPC, "--output", "json", "--log_format", "json", "--yes")
610-
// TODO test ibc using the hermes ft-transfer:
611-
// step.Exec(envtest.IgniteApp, "hermes", "exec", "--", "--config", earthConfig, "tx", "ft-transfer", "--timeout-seconds", "1000", "--dst-chain", earthChainID, "--src-chain", marsChainID, "--src-port", "transfer", "--src-channel", "channel-0", "--amount", "100000", "--denom", "stake", "--output", "json", "--log_format", "json", "--yes")
612614
}

0 commit comments

Comments
 (0)