-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imp: add passthrough handlers for callbacks mw module #5376
Changes from all commits
2376567
69f95db
5093acc
26de95f
72f9ded
176fe1d
9d92010
73d5481
0665746
117b6df
ebc8199
61b8e93
1d16e96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import ( | |
var ( | ||
_ porttypes.Middleware = (*IBCMiddleware)(nil) | ||
_ porttypes.PacketDataUnmarshaler = (*IBCMiddleware)(nil) | ||
_ porttypes.UpgradableModule = (*IBCMiddleware)(nil) | ||
) | ||
|
||
// IBCMiddleware implements the ICS26 callbacks for the ibc-callbacks middleware given | ||
|
@@ -364,28 +365,53 @@ func (im IBCMiddleware) OnChanCloseConfirm(ctx sdk.Context, portID, channelID st | |
} | ||
|
||
// OnChanUpgradeInit implements the IBCModule interface | ||
func (IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { | ||
panic("implement me") | ||
func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { | ||
cbs, ok := im.app.(porttypes.UpgradableModule) | ||
if !ok { | ||
return "", errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: these err messages seem slightly off structurally wise? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how so? what would you expect them to look like? I think this is how I structured them in the initial PR for core and other mods like fee etc, I'm open to suggestions if you want to open a PR and address all of them together after this then go ahead! |
||
} | ||
|
||
return cbs.OnChanUpgradeInit(ctx, portID, channelID, order, connectionHops, version) | ||
} | ||
|
||
// OnChanUpgradeTry implements the IBCModule interface | ||
func (IBCMiddleware) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, counterpartyVersion string) (string, error) { | ||
panic("implement me") | ||
func (im IBCMiddleware) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, counterpartyVersion string) (string, error) { | ||
cbs, ok := im.app.(porttypes.UpgradableModule) | ||
if !ok { | ||
return "", errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") | ||
} | ||
|
||
return cbs.OnChanUpgradeTry(ctx, portID, channelID, order, connectionHops, counterpartyVersion) | ||
} | ||
|
||
// OnChanUpgradeAck implements the IBCModule interface | ||
func (IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { | ||
panic("implement me") | ||
func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { | ||
cbs, ok := im.app.(porttypes.UpgradableModule) | ||
if !ok { | ||
return errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") | ||
} | ||
|
||
return cbs.OnChanUpgradeAck(ctx, portID, channelID, counterpartyVersion) | ||
} | ||
|
||
// OnChanUpgradeOpen implements the IBCModule interface | ||
func (IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) { | ||
panic("implement me") | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) { | ||
cbs, ok := im.app.(porttypes.UpgradableModule) | ||
if !ok { | ||
panic(errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack")) | ||
} | ||
|
||
cbs.OnChanUpgradeOpen(ctx, portID, channelID, order, connectionHops, version) | ||
} | ||
|
||
// OnChanUpgradeRestore implements the IBCModule interface | ||
func (IBCMiddleware) OnChanUpgradeRestore(ctx sdk.Context, portID, channelID string) { | ||
panic("implement me") | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
func (im IBCMiddleware) OnChanUpgradeRestore(ctx sdk.Context, portID, channelID string) { | ||
cbs, ok := im.app.(porttypes.UpgradableModule) | ||
if !ok { | ||
panic(errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack")) | ||
} | ||
|
||
cbs.OnChanUpgradeRestore(ctx, portID, channelID) | ||
} | ||
|
||
// GetAppVersion implements the ICS4Wrapper interface. Callbacks has no version, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume its intensional that we never added an app upgrade callback for
chanUpgradeConfirm
, its been so long that I don't really remember, but I think it wasThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is intentional. I think there's nothing to do in that step since it is just acknowledging that the counterparty set your timeout timer