Skip to content

Commit

Permalink
ChanUpgradeOpen callback should not return an error. (#3899)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Jun 19, 2023
1 parent ccb00fc commit dc69cd5
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,7 @@ func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, cou
}

// OnChanUpgradeOpen implements the IBCModule interface
func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) error {
return errorsmod.Wrap(icatypes.ErrInvalidChannelFlow, "channel handshake must be initiated by controller chain")
}
func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) {}

// OnChanUpgradeRestore implements the IBCModule interface
func (im IBCMiddleware) OnChanUpgradeRestore(ctx sdk.Context, portID, channelID string) error {
Expand Down
4 changes: 1 addition & 3 deletions modules/apps/27-interchain-accounts/host/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ func (im IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counter
}

// OnChanUpgradeOpen implements the IBCModule interface
func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) error {
return nil
}
func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) {}

// OnChanUpgradeRestore implements the IBCModule interface
func (im IBCModule) OnChanUpgradeRestore(ctx sdk.Context, portID, channelID string) error {
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, cou
}

// OnChanUpgradeOpen implements the IBCModule interface
func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) error {
return im.app.OnChanUpgradeOpen(ctx, portID, channelID)
func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) {
im.app.OnChanUpgradeOpen(ctx, portID, channelID)
}

// OnChanUpgradeRestore implements the IBCModule interface
Expand Down
4 changes: 1 addition & 3 deletions modules/apps/transfer/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ func (im IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counter
}

// OnChanUpgradeOpen implements the IBCModule interface
func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) error {
return nil
}
func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) {}

// OnChanUpgradeRestore implements the IBCModule interface
func (im IBCModule) OnChanUpgradeRestore(ctx sdk.Context, portID, channelID string) error {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/05-port/types/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ type UpgradableModule interface {
ctx sdk.Context,
portID,
channelID string,
) error
)

// OnChanUpgradeRestore TODO
OnChanUpgradeRestore(
Expand Down
2 changes: 1 addition & 1 deletion testing/mock/ibc_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type IBCApp struct {
ctx sdk.Context,
portID,
channelID string,
) error
)

OnChanUpgradeRestore func(
ctx sdk.Context,
Expand Down
6 changes: 2 additions & 4 deletions testing/mock/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,10 @@ func (im IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counter
}

// OnChanUpgradeOpen implements the IBCModule interface
func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) error {
func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string) {
if im.IBCApp.OnChanUpgradeOpen != nil {
return im.IBCApp.OnChanUpgradeOpen(ctx, portID, channelID)
im.IBCApp.OnChanUpgradeOpen(ctx, portID, channelID)
}

return nil
}

// OnChanUpgradeRestore implements the IBCModule interface
Expand Down

0 comments on commit dc69cd5

Please sign in to comment.