Skip to content

Commit

Permalink
Merge PR strangelove-ventures#493: Fix issues with hermes client, cha…
Browse files Browse the repository at this point in the history
…nnel creation and channel queries

* Fix channel endpoints when querying for channels.

* During creation, pass channel version, ordering to channels and trusting period to clients.
  • Loading branch information
DimitrisJim authored and aljo242 committed Apr 24, 2023
1 parent 2826f77 commit e80e607
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions relayer/hermes/hermes_commander.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ func (c commander) ParseGetChannelsOutput(stdout, stderr string) ([]ibc.ChannelO
State: r.ChannelEnd.State,
Ordering: r.ChannelEnd.Ordering,
Counterparty: ibc.ChannelCounterparty{
PortID: r.CounterPartyChannelEnd.Remote.PortID,
ChannelID: r.CounterPartyChannelEnd.Remote.ChannelID,
PortID: r.ChannelEnd.Remote.PortID,
ChannelID: r.ChannelEnd.Remote.ChannelID,
},
ConnectionHops: r.ChannelEnd.ConnectionHops,
Version: r.ChannelEnd.Version,
PortID: r.ChannelEnd.Remote.PortID,
ChannelID: r.ChannelEnd.Remote.ChannelID,
PortID: r.CounterPartyChannelEnd.Remote.PortID,
ChannelID: r.CounterPartyChannelEnd.Remote.ChannelID,
})
}

Expand Down
11 changes: 10 additions & 1 deletion relayer/hermes/hermes_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ func (r *Relayer) LinkPath(ctx context.Context, rep ibc.RelayerExecReporter, pat

func (r *Relayer) CreateChannel(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, opts ibc.CreateChannelOptions) error {
pathConfig := r.paths[pathName]
cmd := []string{hermes, "--json", "create", "channel", "--a-chain", pathConfig.chainA.chainID, "--a-port", opts.SourcePortName, "--b-port", opts.DestPortName, "--a-connection", pathConfig.chainA.connectionID}
cmd := []string{hermes, "--json", "create", "channel", "--order", opts.Order.String(), "--a-chain", pathConfig.chainA.chainID, "--a-port", opts.SourcePortName, "--b-port", opts.DestPortName, "--a-connection", pathConfig.chainA.connectionID}
if opts.Version != "" {
cmd = append(cmd, "--channel-version", opts.Version)
}
res := r.Exec(ctx, rep, cmd, nil)
if res.Err != nil {
return res.Err
Expand Down Expand Up @@ -161,6 +164,9 @@ func (r *Relayer) UpdateClients(ctx context.Context, rep ibc.RelayerExecReporter
func (r *Relayer) CreateClients(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, opts ibc.CreateClientOptions) error {
pathConfig := r.paths[pathName]
chainACreateClientCmd := []string{hermes, "--json", "create", "client", "--host-chain", pathConfig.chainA.chainID, "--reference-chain", pathConfig.chainB.chainID}
if opts.TrustingPeriod != "0" {
chainACreateClientCmd = append(chainACreateClientCmd, "--trusting-period", opts.TrustingPeriod)
}
res := r.Exec(ctx, rep, chainACreateClientCmd, nil)
if res.Err != nil {
return res.Err
Expand All @@ -173,6 +179,9 @@ func (r *Relayer) CreateClients(ctx context.Context, rep ibc.RelayerExecReporter
pathConfig.chainA.clientID = chainAClientId

chainBCreateClientCmd := []string{hermes, "--json", "create", "client", "--host-chain", pathConfig.chainB.chainID, "--reference-chain", pathConfig.chainA.chainID}
if opts.TrustingPeriod != "0" {
chainBCreateClientCmd = append(chainBCreateClientCmd, "--trusting-period", opts.TrustingPeriod)
}
res = r.Exec(ctx, rep, chainBCreateClientCmd, nil)
if res.Err != nil {
return res.Err
Expand Down

0 comments on commit e80e607

Please sign in to comment.