diff --git a/e2e/tests/core/04-channel/channel_test.go b/e2e/tests/core/04-channel/channel_test.go index 39be53af922..8b08a118eea 100644 --- a/e2e/tests/core/04-channel/channel_test.go +++ b/e2e/tests/core/04-channel/channel_test.go @@ -30,12 +30,11 @@ func (s *ChannelUpgradeTestSuite) TestChannelUpgrade() { rlyWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) - counterParty := channeltypes.NewCounterparty(channelA.Counterparty.PortID, channelA.Counterparty.ChannelID) - proposedUpgradeChannel := channeltypes.NewChannel(channeltypes.INITUPGRADE, channeltypes.UNORDERED, counterParty, channelA.ConnectionHops, `{"fee_version":"ics29-1","app_version":"ics20-1"}`) - t.Run("channel upgrade init", func(t *testing.T) { + upgradeTimeout := channeltypes.NewUpgradeTimeout(clienttypes.NewHeight(0, 10000), 0) + upgradeFields := channeltypes.NewUpgradeFields(channeltypes.UNORDERED, channelA.ConnectionHops, `{"fee_version":"ics29-1","app_version":"ics20-1"}`) msgChanUpgradeInit := channeltypes.NewMsgChannelUpgradeInit( - channelA.PortID, channelA.ChannelID, proposedUpgradeChannel, clienttypes.NewHeight(0, 10000), 0, rlyWallet.FormattedAddress(), + channelA.PortID, channelA.ChannelID, upgradeFields, upgradeTimeout, rlyWallet.FormattedAddress(), ) s.Require().NoError(msgChanUpgradeInit.ValidateBasic()) @@ -43,5 +42,9 @@ func (s *ChannelUpgradeTestSuite) TestChannelUpgrade() { txResp, err := s.BroadcastMessages(ctx, chainA, rlyWallet, msgChanUpgradeInit) s.Require().NoError(err) s.AssertValidTxResponse(txResp) + + channel, err := s.QueryChannel(ctx, chainA, channelA.PortID, channelA.ChannelID) + s.Require().NoError(err) + s.Require().Equal(channeltypes.INITUPGRADE, channel.State) }) } diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go index 2bd8e681d54..b733beced10 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go @@ -226,7 +226,7 @@ func (im IBCMiddleware) OnTimeoutPacket( } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, counterparty channeltypes.Counterparty, version, previousVersion string) (string, error) { +func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, version, previousVersion string) (string, error) { return icatypes.Version, nil } diff --git a/modules/apps/27-interchain-accounts/host/ibc_module.go b/modules/apps/27-interchain-accounts/host/ibc_module.go index 6a6fbfbaa7b..df12eb52304 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module.go @@ -150,7 +150,7 @@ func (im IBCModule) OnTimeoutPacket( } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, counterparty channeltypes.Counterparty, version, previousVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, version, previousVersion string) (string, error) { return "", errorsmod.Wrap(icatypes.ErrInvalidChannelFlow, "channel handshake must be initiated by controller chain") } diff --git a/modules/apps/29-fee/ibc_middleware.go b/modules/apps/29-fee/ibc_middleware.go index b4b4643de7a..71c0b2d3fcb 100644 --- a/modules/apps/29-fee/ibc_middleware.go +++ b/modules/apps/29-fee/ibc_middleware.go @@ -321,8 +321,8 @@ func (im IBCMiddleware) OnTimeoutPacket( } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, counterparty channeltypes.Counterparty, version, previousVersion string) (string, error) { - return im.app.OnChanUpgradeInit(ctx, order, connectionHops, portID, channelID, sequence, counterparty, version, previousVersion) +func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, version, previousVersion string) (string, error) { + return im.app.OnChanUpgradeInit(ctx, order, connectionHops, portID, channelID, sequence, version, previousVersion) } // OnChanUpgradeTry implement s the IBCModule interface diff --git a/modules/apps/transfer/ibc_module.go b/modules/apps/transfer/ibc_module.go index d13cc2ca3db..df74cace90b 100644 --- a/modules/apps/transfer/ibc_module.go +++ b/modules/apps/transfer/ibc_module.go @@ -302,7 +302,7 @@ func (im IBCModule) OnTimeoutPacket( } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, counterparty channeltypes.Counterparty, version, previousVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, version, previousVersion string) (string, error) { return types.Version, nil } diff --git a/modules/core/04-channel/keeper/events.go b/modules/core/04-channel/keeper/events.go index 69fe9f074a2..d8574abd73b 100644 --- a/modules/core/04-channel/keeper/events.go +++ b/modules/core/04-channel/keeper/events.go @@ -273,17 +273,18 @@ func emitChannelClosedEvent(ctx sdk.Context, packet exported.PacketI, channel ty } // emitChannelUpgradeInitEvent emits a channel upgrade init event -func emitChannelUpgradeInitEvent(ctx sdk.Context, portID string, channelID string, upgradeSequence uint64, channel types.Channel) { +func emitChannelUpgradeInitEvent(ctx sdk.Context, portID string, channelID string, currentChannel types.Channel, upgrade types.Upgrade) { ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeInit, sdk.NewAttribute(types.AttributeKeyPortID, portID), sdk.NewAttribute(types.AttributeKeyChannelID, channelID), - sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId), - sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId), - sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), - sdk.NewAttribute(types.AttributeVersion, channel.Version), - sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", upgradeSequence)), + sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId), + sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgrade.Fields.ConnectionHops[0]), + sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgrade.Fields.Version), + sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)), + sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgrade.Fields.Ordering.String()), ), sdk.NewEvent( sdk.EventTypeMessage, diff --git a/modules/core/04-channel/keeper/keeper_test.go b/modules/core/04-channel/keeper/keeper_test.go index ff6d59d4d0b..2993196ae3f 100644 --- a/modules/core/04-channel/keeper/keeper_test.go +++ b/modules/core/04-channel/keeper/keeper_test.go @@ -538,7 +538,7 @@ func (suite *KeeperTestSuite) TestUpgradeTimeoutAccessors() { suite.coordinator.SetupConnections(path) suite.coordinator.CreateChannels(path) - expUpgradeTimeout := types.UpgradeTimeout{TimeoutHeight: clienttypes.NewHeight(1, 10), TimeoutTimestamp: uint64(suite.coordinator.CurrentTime.UnixNano())} + expUpgradeTimeout := types.UpgradeTimeout{Height: clienttypes.NewHeight(1, 10), Timestamp: uint64(suite.coordinator.CurrentTime.UnixNano())} suite.Run("set upgrade timeout", func() { upgradeTimeout, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetUpgradeTimeout(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index 73569678355..3e09d707126 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -1,19 +1,11 @@ package keeper import ( - "reflect" - errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - portkeeper "github.com/cosmos/ibc-go/v7/modules/core/05-port/keeper" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" ) // ChanUpgradeInit is called by a module to initiate a channel upgrade handshake with @@ -22,115 +14,57 @@ func (k Keeper) ChanUpgradeInit( ctx sdk.Context, portID string, channelID string, - chanCap *capabilitytypes.Capability, - proposedUpgradeChannel types.Channel, - counterpartyTimeoutHeight clienttypes.Height, - counterpartyTimeoutTimestamp uint64, -) (upgradeSequence uint64, previousVersion string, err error) { + upgradeFields types.UpgradeFields, + upgradeTimeout types.UpgradeTimeout, +) (types.Upgrade, error) { channel, found := k.GetChannel(ctx, portID, channelID) if !found { - return 0, "", errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) + return types.Upgrade{}, errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) } if channel.State != types.OPEN { - return 0, "", errorsmod.Wrapf(types.ErrInvalidChannelState, "expected %s, got %s", types.OPEN, channel.State) - } - - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { - return 0, "", errorsmod.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", portID, channelID) + return types.Upgrade{}, errorsmod.Wrapf(types.ErrInvalidChannelState, "expected %s, got %s", types.OPEN, channel.State) } - // set the restore channel to the current channel and reassign channel state to INITUPGRADE, - // if the channel == proposedUpgradeChannel then fail fast as no upgradable fields have been modified. - restoreChannel := channel - channel.State = types.INITUPGRADE - if reflect.DeepEqual(channel, proposedUpgradeChannel) { - return 0, "", errorsmod.Wrap(types.ErrChannelExists, "existing channel end is identical to proposed upgrade channel end") + if err := k.ValidateUpgradeFields(ctx, upgradeFields, channel); err != nil { + return types.Upgrade{}, err } - connectionEnd, err := k.GetConnection(ctx, proposedUpgradeChannel.ConnectionHops[0]) + proposedUpgrade, err := k.constructProposedUpgrade(ctx, portID, channelID, upgradeFields, upgradeTimeout) if err != nil { - return 0, "", err - } - - if connectionEnd.GetState() != int32(connectiontypes.OPEN) { - return 0, "", errorsmod.Wrapf( - connectiontypes.ErrInvalidConnectionState, - "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(), - ) - } - - if proposedUpgradeChannel.Counterparty.PortId != channel.Counterparty.PortId || - proposedUpgradeChannel.Counterparty.ChannelId != channel.Counterparty.ChannelId { - return 0, "", errorsmod.Wrap(types.ErrInvalidCounterparty, "counterparty port ID and channel ID cannot be upgraded") + return types.Upgrade{}, errorsmod.Wrap(err, "failed to construct proposed upgrade") } - if !proposedUpgradeChannel.Ordering.SubsetOf(channel.Ordering) { - return 0, "", errorsmod.Wrap(types.ErrInvalidChannelOrdering, "channel ordering must be a subset of the new ordering") - } - - upgradeSequence = uint64(1) - if seq, found := k.GetUpgradeSequence(ctx, portID, channelID); found { - upgradeSequence = seq + 1 - } - - upgradeTimeout := types.UpgradeTimeout{ - TimeoutHeight: counterpartyTimeoutHeight, - TimeoutTimestamp: counterpartyTimeoutTimestamp, - } - - k.SetUpgradeRestoreChannel(ctx, portID, channelID, restoreChannel) - k.SetUpgradeSequence(ctx, portID, channelID, upgradeSequence) - k.SetUpgradeTimeout(ctx, portID, channelID, upgradeTimeout) + channel.UpgradeSequence++ + k.SetChannel(ctx, portID, channelID, channel) - return upgradeSequence, channel.Version, nil + return proposedUpgrade, nil } // WriteUpgradeInitChannel writes a channel which has successfully passed the UpgradeInit handshake step. // An event is emitted for the handshake step. -func (k Keeper) WriteUpgradeInitChannel( - ctx sdk.Context, - portID, - channelID string, - upgradeSequence uint64, - channelUpgrade types.Channel, -) { +func (k Keeper) WriteUpgradeInitChannel(ctx sdk.Context, portID, channelID string, currentChannel types.Channel, upgrade types.Upgrade) { defer telemetry.IncrCounter(1, "ibc", "channel", "upgrade-init") - k.SetChannel(ctx, portID, channelID, channelUpgrade) - k.Logger(ctx).Info("channel state updated", "port-id", portID, "channel-id", channelID, "previous-state", types.OPEN.String(), "new-state", types.INITUPGRADE.String()) - - emitChannelUpgradeInitEvent(ctx, portID, channelID, upgradeSequence, channelUpgrade) -} - -// RestoreChannel restores the given channel to the state prior to upgrade. -func (k Keeper) RestoreChannel(ctx sdk.Context, portID, channelID string, upgradeSequence uint64, err error) error { - errorReceipt := types.NewErrorReceipt(upgradeSequence, err) - k.SetUpgradeErrorReceipt(ctx, portID, channelID, errorReceipt) + currentChannel.State = types.INITUPGRADE - channel, found := k.GetUpgradeRestoreChannel(ctx, portID, channelID) - if !found { - return errorsmod.Wrapf(types.ErrChannelNotFound, "channel-id: %s", channelID) - } + k.SetChannel(ctx, portID, channelID, currentChannel) + k.SetUpgrade(ctx, portID, channelID, upgrade) - k.SetChannel(ctx, portID, channelID, channel) - k.DeleteUpgradeRestoreChannel(ctx, portID, channelID) - k.DeleteUpgradeTimeout(ctx, portID, channelID) - - module, _, err := k.LookupModuleByChannel(ctx, portID, channelID) - if err != nil { - return errorsmod.Wrap(err, "could not retrieve module from port-id") - } + k.Logger(ctx).Info("channel state updated", "port-id", portID, "channel-id", channelID, "previous-state", types.OPEN.String(), "new-state", types.INITUPGRADE.String()) - portKeeper, ok := k.portKeeper.(*portkeeper.Keeper) - if !ok { - panic("todo: handle this situation") - } + emitChannelUpgradeInitEvent(ctx, portID, channelID, currentChannel, upgrade) +} - cbs, found := portKeeper.Router.GetRoute(module) +// constructProposedUpgrade returns the proposed upgrade from the provided arguments. +func (k Keeper) constructProposedUpgrade(ctx sdk.Context, portID, channelID string, fields types.UpgradeFields, timeout types.UpgradeTimeout) (types.Upgrade, error) { + seq, found := k.GetNextSequenceSend(ctx, portID, channelID) if !found { - return errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + return types.Upgrade{}, types.ErrSequenceSendNotFound } - - return cbs.OnChanUpgradeRestore(ctx, portID, channelID) + return types.Upgrade{ + Fields: fields, + Timeout: timeout, + LatestSequenceSend: seq - 1, + }, nil } diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index 933c6fb7754..ca0e1b63b0f 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -3,22 +3,17 @@ package keeper_test import ( "fmt" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v7/testing" "github.com/cosmos/ibc-go/v7/testing/mock" ) func (suite *KeeperTestSuite) TestChanUpgradeInit() { var ( - path *ibctesting.Path - chanCap *capabilitytypes.Capability - channelUpgrade types.Channel - expSequence uint64 - expVersion string + path *ibctesting.Path + expSequence uint64 + upgrade *types.Upgrade ) testCases := []struct { @@ -34,34 +29,24 @@ func (suite *KeeperTestSuite) TestChanUpgradeInit() { { "success with later upgrade sequence", func() { - // set the initial sequence and expected sequence (initial sequence + 1) - suite.chainA.GetSimApp().GetIBCKeeper().ChannelKeeper.SetUpgradeSequence(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 4) - expSequence = 5 - }, - true, - }, - { - "success with alternative previous version", - func() { - expVersion = "mock-v1.1" channel := path.EndpointA.GetChannel() - channel.Version = expVersion - + channel.UpgradeSequence = 4 path.EndpointA.SetChannel(channel) + expSequence = 5 }, true, }, - { - "invalid capability", - func() { - chanCap = capabilitytypes.NewCapability(42) - }, - false, - }, { "identical upgrade channel end", func() { - channelUpgrade = types.NewChannel(types.INITUPGRADE, types.UNORDERED, types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID), []string{path.EndpointA.ConnectionID}, mock.Version) + channel := path.EndpointA.GetChannel() + upgrade = types.NewUpgrade( + types.NewUpgradeFields( + channel.Ordering, channel.ConnectionHops, channel.Version, + ), + types.NewUpgradeTimeout(path.EndpointB.Chain.GetTimeoutHeight(), 0), + 0, + ) }, false, }, @@ -83,7 +68,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeInit() { { "proposed channel connection not found", func() { - channelUpgrade.ConnectionHops = []string{"connection-100"} + upgrade.Fields.ConnectionHops = []string{"connection-100"} }, false, }, @@ -94,21 +79,14 @@ func (suite *KeeperTestSuite) TestChanUpgradeInit() { connectionEnd.State = connectiontypes.UNINITIALIZED suite.chainA.GetSimApp().GetIBCKeeper().ConnectionKeeper.SetConnection(suite.chainA.GetContext(), "connection-100", connectionEnd) - channelUpgrade.ConnectionHops = []string{"connection-100"} - }, - false, - }, - { - "invalid proposed channel counterparty", - func() { - channelUpgrade.Counterparty = types.NewCounterparty(mock.PortID, "channel-100") + upgrade.Fields.ConnectionHops = []string{"connection-100"} }, false, }, { - "invalid proposed channel upgrade ordering", + "stricter proposed channel upgrade ordering", func() { - channelUpgrade.Ordering = types.ORDERED + upgrade.Fields.Ordering = types.ORDERED }, false, }, @@ -122,92 +100,32 @@ func (suite *KeeperTestSuite) TestChanUpgradeInit() { path = ibctesting.NewPath(suite.chainA, suite.chainB) suite.coordinator.Setup(path) - chanCap, _ = suite.chainA.GetSimApp().GetScopedIBCKeeper().GetCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)) - channelUpgrade = types.NewChannel(types.INITUPGRADE, types.UNORDERED, types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID), []string{path.EndpointA.ConnectionID}, fmt.Sprintf("%s-v2", mock.Version)) - expSequence = 1 - expVersion = mock.Version - - tc.malleate() - sequence, previousVersion, err := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.ChanUpgradeInit( - suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, - chanCap, channelUpgrade, path.EndpointB.Chain.GetTimeoutHeight(), 0, + upgrade = types.NewUpgrade( + types.NewUpgradeFields( + types.UNORDERED, []string{path.EndpointA.ConnectionID}, fmt.Sprintf("%s-v2", mock.Version), + ), + types.NewUpgradeTimeout(path.EndpointB.Chain.GetTimeoutHeight(), 0), + 0, ) - if tc.expPass { - suite.Require().NoError(err) - suite.Require().Equal(expSequence, sequence) - suite.Require().Equal(expVersion, previousVersion) - } else { - suite.Require().Error(err) - } - }) - } -} - -func (suite *KeeperTestSuite) TestRestoreChannel() { - var path *ibctesting.Path - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "succeeds when restore channel is set", - func() {}, - true, - }, - { - name: "fails when no restore channel is present", - malleate: func() { - // remove the restore channel - path.EndpointA.Chain.GetSimApp().IBCKeeper.ChannelKeeper.DeleteUpgradeRestoreChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - }, - expPass: false, - }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupTest() - - upgradeSequence := uint64(1) - path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) - - path.EndpointA.ChannelConfig.Version = fmt.Sprintf("%s-v2", mock.Version) - - originalChannel := path.EndpointA.GetChannel() - - err := path.EndpointA.ChanUpgradeInit(path.EndpointB.Chain.GetTimeoutHeight(), 0) - suite.Require().NoError(err) - tc.malleate() - err = suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.RestoreChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, upgradeSequence, types.ErrInvalidChannel) - - actualChannel, ok := path.EndpointA.Chain.GetSimApp().IBCKeeper.ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - errReceipt, errReceiptPresent := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetUpgradeErrorReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) + proposedUpgrade, err := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.ChanUpgradeInit( + suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, upgrade.Fields, upgrade.Timeout, + ) if tc.expPass { + suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.WriteUpgradeInitChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointA.GetChannel(), proposedUpgrade) + channel := path.EndpointA.GetChannel() + suite.Require().NoError(err) - suite.Require().True(ok) - suite.Require().Equal(originalChannel, actualChannel) - suite.Require().True(errReceiptPresent) - suite.Require().Equal(upgradeSequence, errReceipt.Sequence) + suite.Require().Equal(expSequence, channel.UpgradeSequence) + suite.Require().Equal(mock.Version, channel.Version) + suite.Require().Equal(types.INITUPGRADE, channel.State) } else { - // channel should still be in INITUPGRADE if restore did not happen. - expectedChannel := originalChannel - expectedChannel.State = types.INITUPGRADE - suite.Require().Error(err) - suite.Require().True(ok) - suite.Require().Equal(expectedChannel, actualChannel) - suite.Require().True(errReceiptPresent) - suite.Require().Equal(upgradeSequence, errReceipt.Sequence) } }) } diff --git a/modules/core/04-channel/types/events.go b/modules/core/04-channel/types/events.go index f3b4165f80e..bd548ddbb17 100644 --- a/modules/core/04-channel/types/events.go +++ b/modules/core/04-channel/types/events.go @@ -39,7 +39,11 @@ const ( AttributeKeyChannelOrdering = "packet_channel_ordering" AttributeKeyConnection = "packet_connection" - AttributeKeyUpgradeSequence = "upgrade_sequence" + // upgrade specific keys + AttributeKeyUpgradeSequence = "upgrade_sequence" + AttributeKeyUpgradeVersion = "upgrade_version" + AttributeKeyUpgradeConnectionHops = "upgrade_connection_hops" + AttributeKeyUpgradeOrdering = "upgrade_ordering" ) // IBC channel events vars diff --git a/modules/core/04-channel/types/msgs.go b/modules/core/04-channel/types/msgs.go index 78d71436b97..bd14ccffc97 100644 --- a/modules/core/04-channel/types/msgs.go +++ b/modules/core/04-channel/types/msgs.go @@ -2,7 +2,6 @@ package types import ( "encoding/base64" - "strings" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -485,18 +484,16 @@ var _ sdk.Msg = &MsgChannelUpgradeInit{} // nolint:interfacer func NewMsgChannelUpgradeInit( portID, channelID string, - proposedUpgradeChannel Channel, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, + upgradeFields UpgradeFields, + upgradeTimeout UpgradeTimeout, signer string, ) *MsgChannelUpgradeInit { return &MsgChannelUpgradeInit{ - PortId: portID, - ChannelId: channelID, - ProposedUpgradeChannel: proposedUpgradeChannel, - TimeoutHeight: timeoutHeight, - TimeoutTimestamp: timeoutTimestamp, - Signer: signer, + PortId: portID, + ChannelId: channelID, + Fields: upgradeFields, + Timeout: upgradeTimeout, + Signer: signer, } } @@ -508,21 +505,17 @@ func (msg MsgChannelUpgradeInit) ValidateBasic() error { if !IsValidChannelID(msg.ChannelId) { return ErrInvalidChannelIdentifier } - if msg.ProposedUpgradeChannel.State != INITUPGRADE { - return errorsmod.Wrapf(ErrInvalidChannelState, "expected: %s, got: %s", INITUPGRADE, msg.ProposedUpgradeChannel.State) - } - if strings.TrimSpace(msg.ProposedUpgradeChannel.Version) == "" { - return errorsmod.Wrap(ErrInvalidChannelVersion, "channel version must not be empty") - } - if msg.TimeoutHeight.IsZero() && msg.TimeoutTimestamp == 0 { - return errorsmod.Wrap(ErrInvalidUpgradeTimeout, "timeout height and timeout timestamp cannot both be 0") - } + _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) } - return nil + if !msg.Timeout.IsValid() { + return errorsmod.Wrap(ErrInvalidUpgrade, "upgrade timeout height and upgrade timeout timestamp cannot both be 0") + } + + return msg.Fields.ValidateBasic() } // GetSigners implements sdk.Msg diff --git a/modules/core/04-channel/types/msgs_test.go b/modules/core/04-channel/types/msgs_test.go index 28630cfd4c2..af9e9df3c4e 100644 --- a/modules/core/04-channel/types/msgs_test.go +++ b/modules/core/04-channel/types/msgs_test.go @@ -458,25 +458,18 @@ func (suite *TypesTestSuite) TestMsgChannelUpgradeInitValidateBasic() { }, false, }, - { - "invalid proposed upgrade channel state", - func() { - msg.ProposedUpgradeChannel.State = types.TRYUPGRADE - }, - false, - }, { "empty proposed upgrade channel version", func() { - msg.ProposedUpgradeChannel.Version = " " + msg.Fields.Version = " " }, false, }, { "timeout height is zero && timeout timestamp is zero", func() { - msg.TimeoutHeight = clienttypes.ZeroHeight() - msg.TimeoutTimestamp = 0 + msg.Timeout.Height = clienttypes.ZeroHeight() + msg.Timeout.Timestamp = 0 }, false, }, @@ -494,9 +487,8 @@ func (suite *TypesTestSuite) TestMsgChannelUpgradeInitValidateBasic() { suite.Run(tc.name, func() { msg = types.NewMsgChannelUpgradeInit( ibctesting.MockPort, ibctesting.FirstChannelID, - types.Channel{State: types.INITUPGRADE, Version: mock.Version}, - clienttypes.NewHeight(0, 10000), - 0, + types.NewUpgradeFields(types.UNORDERED, []string{ibctesting.FirstConnectionID}, mock.Version), + types.NewUpgradeTimeout(clienttypes.NewHeight(0, 10000), timeoutTimestamp), addr, ) diff --git a/modules/core/04-channel/types/tx.pb.go b/modules/core/04-channel/types/tx.pb.go index 96ad609ae87..5158db2dda4 100644 --- a/modules/core/04-channel/types/tx.pb.go +++ b/modules/core/04-channel/types/tx.pb.go @@ -900,12 +900,11 @@ var xxx_messageInfo_MsgAcknowledgementResponse proto.InternalMessageInfo // MsgChannelUpgradeInit defines the request type for the ChannelUpgradeInit rpc type MsgChannelUpgradeInit struct { - PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - ProposedUpgradeChannel Channel `protobuf:"bytes,3,opt,name=proposed_upgrade_channel,json=proposedUpgradeChannel,proto3" json:"proposed_upgrade_channel"` - TimeoutHeight types.Height `protobuf:"bytes,4,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height"` - TimeoutTimestamp uint64 `protobuf:"varint,5,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` - Signer string `protobuf:"bytes,6,opt,name=signer,proto3" json:"signer,omitempty"` + PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + Fields UpgradeFields `protobuf:"bytes,3,opt,name=fields,proto3" json:"fields"` + Timeout UpgradeTimeout `protobuf:"bytes,4,opt,name=timeout,proto3" json:"timeout"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgChannelUpgradeInit) Reset() { *m = MsgChannelUpgradeInit{} } @@ -943,9 +942,9 @@ var xxx_messageInfo_MsgChannelUpgradeInit proto.InternalMessageInfo // MsgChannelUpgradeInitResponse defines the MsgChannelUpgradeInit response type type MsgChannelUpgradeInitResponse struct { - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - UpgradeSequence uint64 `protobuf:"varint,3,opt,name=upgrade_sequence,json=upgradeSequence,proto3" json:"upgrade_sequence,omitempty"` + ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + Upgrade Upgrade `protobuf:"bytes,2,opt,name=upgrade,proto3" json:"upgrade"` + UpgradeSequence uint64 `protobuf:"varint,3,opt,name=upgrade_sequence,json=upgradeSequence,proto3" json:"upgrade_sequence,omitempty"` } func (m *MsgChannelUpgradeInitResponse) Reset() { *m = MsgChannelUpgradeInitResponse{} } @@ -988,11 +987,11 @@ func (m *MsgChannelUpgradeInitResponse) GetChannelId() string { return "" } -func (m *MsgChannelUpgradeInitResponse) GetVersion() string { +func (m *MsgChannelUpgradeInitResponse) GetUpgrade() Upgrade { if m != nil { - return m.Version + return m.Upgrade } - return "" + return Upgrade{} } func (m *MsgChannelUpgradeInitResponse) GetUpgradeSequence() uint64 { @@ -1452,112 +1451,114 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v1/tx.proto", fileDescriptor_bc4637e0ac3fc7b7) } var fileDescriptor_bc4637e0ac3fc7b7 = []byte{ - // 1668 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xf7, 0x3a, 0xfe, 0x91, 0xbc, 0xfc, 0x5e, 0x27, 0xa9, 0xbb, 0x49, 0x6d, 0xd7, 0x5f, 0xa9, - 0x4d, 0x7f, 0xc4, 0x6e, 0xd2, 0xf6, 0x8b, 0x5a, 0x21, 0xa1, 0xd4, 0x18, 0x88, 0xd4, 0x34, 0xd1, - 0xda, 0x41, 0x02, 0x0a, 0x96, 0xb3, 0x9e, 0x3a, 0x2b, 0xc7, 0xbb, 0xdb, 0xdd, 0xb5, 0xdb, 0x20, - 0x71, 0x40, 0x08, 0x51, 0x55, 0x42, 0xe2, 0x8e, 0x2a, 0x55, 0x82, 0x0b, 0x27, 0x6e, 0x1c, 0x38, - 0x83, 0xd4, 0x63, 0x25, 0x24, 0xe0, 0x80, 0x10, 0x6a, 0x0f, 0xf0, 0x67, 0xa0, 0x9d, 0x9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0x72, 0xff, 0x31, 0x2c, 0x78, 0xd6, 0x23, 0x17, 0x03, - 0x46, 0x83, 0xd1, 0xdc, 0x95, 0x41, 0xd0, 0xd4, 0xf7, 0x8d, 0xd2, 0x93, 0x67, 0x29, 0xe6, 0xe9, - 0xb3, 0x14, 0xf3, 0xd7, 0xb3, 0x14, 0xf3, 0xd5, 0xf3, 0x54, 0xe8, 0xe9, 0xf3, 0x54, 0xe8, 0xf7, - 0xe7, 0xa9, 0xd0, 0xfb, 0xd7, 0xea, 0xa2, 0x7e, 0xd0, 0xda, 0xcf, 0x09, 0x72, 0x33, 0x2f, 0xc8, - 0x5a, 0x53, 0xd6, 0xf2, 0xe2, 0xbe, 0xb0, 0x56, 0x97, 0xf3, 0xed, 0xd7, 0xf2, 0x4d, 0xb9, 0xd6, - 0x3a, 0x44, 0x9a, 0xf9, 0x0f, 0xf5, 0x4b, 0x57, 0xd6, 0xe8, 0xff, 0xd4, 0xf5, 0x23, 0x05, 0x69, - 0xfb, 0x31, 0xfc, 0xff, 0xf4, 0xcb, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x64, 0xf7, 0xdd, 0x86, - 0x01, 0x20, 0x00, 0x00, + // 1711 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0x4b, 0x6f, 0xdb, 0xc6, + 0x16, 0x16, 0x65, 0x3d, 0xec, 0xe3, 0x37, 0x65, 0x3b, 0x0a, 0xed, 0x48, 0x8a, 0x02, 0x24, 0xce, + 0xc3, 0x52, 0xec, 0x24, 0xf7, 0x22, 0x41, 0x80, 0x7b, 0x1d, 0x5d, 0xe5, 0xd6, 0x40, 0x1c, 0x1b, + 0x94, 0x5c, 0xa0, 0x6d, 0x5a, 0x41, 0xa6, 0x26, 0x32, 0x21, 0x89, 0x64, 0x48, 0x4a, 0x89, 0x0b, + 0x74, 0xd1, 0x45, 0xd1, 0x20, 0x40, 0x81, 0xee, 0x8b, 0x00, 0x01, 0x5a, 0xa0, 0xe8, 0xaa, 0xbb, + 0x2e, 0xba, 0xee, 0x22, 0xcb, 0x00, 0x05, 0xda, 0x2e, 0x8a, 0xa2, 0x48, 0x16, 0xed, 0x4f, 0xe8, + 0xb2, 0xe0, 0x70, 0x86, 0x22, 0x29, 0x52, 0xa2, 0x22, 0x27, 0xe9, 0xca, 0xd4, 0xcc, 0x99, 0xf3, + 0xf8, 0xbe, 0x33, 0x67, 0xce, 0x8c, 0x61, 0x45, 0xdc, 0x17, 0xf2, 0x82, 0xac, 0xa2, 0xbc, 0x70, + 0x50, 0x95, 0x24, 0xd4, 0xcc, 0x77, 0xd6, 0xf3, 0xfa, 0x83, 0x9c, 0xa2, 0xca, 0xba, 0xcc, 0x26, + 0xc4, 0x7d, 0x21, 0x67, 0xcc, 0xe6, 0xc8, 0x6c, 0xae, 0xb3, 0xce, 0x2d, 0xd4, 0xe5, 0xba, 0x8c, + 0xe7, 0xf3, 0xc6, 0x97, 0x29, 0xca, 0xa5, 0xbb, 0x8a, 0x9a, 0x22, 0x92, 0x74, 0x43, 0x8f, 0xf9, + 0x45, 0x04, 0x4e, 0x7a, 0x59, 0xa2, 0x6a, 0xfb, 0x88, 0xb4, 0x95, 0xba, 0x5a, 0xad, 0x21, 0x53, + 0x24, 0xfb, 0x19, 0x03, 0xec, 0xb6, 0x56, 0x2f, 0x98, 0xf3, 0x3b, 0x0a, 0x92, 0xb6, 0x24, 0x51, + 0x67, 0x8f, 0x41, 0x5c, 0x91, 0x55, 0xbd, 0x22, 0xd6, 0x92, 0x4c, 0x86, 0x59, 0x9d, 0xe0, 0x63, + 0xc6, 0xcf, 0xad, 0x1a, 0x7b, 0x1d, 0xe2, 0x44, 0x57, 0x32, 0x9c, 0x61, 0x56, 0x27, 0x37, 0x56, + 0x72, 0x1e, 0x31, 0xe5, 0x88, 0xbe, 0x1b, 0x91, 0xa7, 0xbf, 0xa5, 0x43, 0x3c, 0x5d, 0x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, 0xf1, 0x65, 0x23, 0x84, 0x71, 0x10, 0xe2, 0x62, 0x32, 0xec, + 0x62, 0x32, 0xfb, 0x7d, 0x0f, 0x5f, 0x9b, 0x42, 0xc3, 0x9f, 0xaf, 0xfe, 0xda, 0xd8, 0x7f, 0xc1, + 0x31, 0x07, 0xb8, 0x36, 0x59, 0x33, 0x0f, 0x17, 0xed, 0xd3, 0x5d, 0x4a, 0x5f, 0x82, 0x94, 0x65, + 0x30, 0x29, 0xa8, 0xe8, 0xea, 0x21, 0xe1, 0x64, 0x1c, 0x0f, 0x18, 0xf9, 0xf6, 0x9a, 0x28, 0x59, + 0x76, 0x53, 0xb2, 0x29, 0x34, 0x28, 0x25, 0xd9, 0x1f, 0x19, 0x58, 0x74, 0xce, 0x16, 0x64, 0xe9, + 0xae, 0xa8, 0xb6, 0x5e, 0x1a, 0x5d, 0x2b, 0xe4, 0xaa, 0xd0, 0xc0, 0x78, 0xd2, 0x90, 0x0d, 0xca, + 0xdc, 0x21, 0x47, 0x46, 0x0b, 0x39, 0xea, 0x13, 0x72, 0x1a, 0x4e, 0x78, 0x06, 0x65, 0x85, 0x2d, + 0x43, 0xa2, 0x2b, 0x50, 0x68, 0xca, 0x1a, 0xea, 0x5f, 0xe7, 0x06, 0xc4, 0x3c, 0xb8, 0x90, 0x9d, + 0x80, 0x65, 0x0f, 0x83, 0x96, 0x3f, 0x3f, 0x31, 0xb0, 0xe4, 0x9a, 0x1f, 0x95, 0x07, 0x67, 0x3d, + 0x18, 0x1b, 0x54, 0x0f, 0x5e, 0x11, 0x13, 0x19, 0x48, 0x79, 0xc7, 0x65, 0x85, 0xfe, 0x2b, 0x03, + 0xd3, 0xdb, 0x5a, 0x9d, 0x47, 0x42, 0x67, 0xb7, 0x2a, 0x34, 0x90, 0xce, 0x5e, 0x85, 0x98, 0x82, + 0xbf, 0x70, 0xc0, 0x93, 0x1b, 0xcb, 0x9e, 0x95, 0xd3, 0x14, 0x26, 0x5e, 0x91, 0x05, 0xec, 0x59, + 0x98, 0x33, 0xa3, 0x12, 0xe4, 0x56, 0x4b, 0xd4, 0x5b, 0x48, 0xd2, 0x31, 0x32, 0x53, 0xfc, 0x2c, + 0x1e, 0x2f, 0x58, 0xc3, 0x3d, 0x00, 0x8c, 0x8d, 0x06, 0x40, 0xc4, 0x07, 0x80, 0x0f, 0xf0, 0xfe, + 0xea, 0x46, 0x67, 0x15, 0xc3, 0xff, 0x40, 0x4c, 0x45, 0x5a, 0xbb, 0x69, 0x46, 0x39, 0xb3, 0x71, + 0xc6, 0x33, 0x4a, 0x2a, 0xce, 0x63, 0xd1, 0xf2, 0xa1, 0x82, 0x78, 0xb2, 0xec, 0x5a, 0xc4, 0xb0, + 0x91, 0xfd, 0x34, 0x0c, 0xb0, 0xad, 0xd5, 0xcb, 0x62, 0x0b, 0xc9, 0xed, 0xa3, 0xc1, 0xae, 0x2d, + 0xa9, 0x48, 0x40, 0x62, 0x07, 0xd5, 0x1c, 0xd8, 0xed, 0x59, 0xc3, 0x47, 0x83, 0xdd, 0x05, 0x60, + 0x25, 0xf4, 0x40, 0xaf, 0x68, 0xe8, 0x5e, 0x1b, 0x49, 0x02, 0xaa, 0xa8, 0x48, 0xe8, 0x60, 0x1c, + 0x23, 0xfc, 0x9c, 0x31, 0x53, 0x22, 0x13, 0x06, 0x78, 0x01, 0x52, 0xed, 0x3d, 0xdc, 0xba, 0x10, + 0x20, 0x8e, 0x1a, 0xe6, 0x6f, 0xcd, 0x13, 0x88, 0x68, 0xdf, 0x91, 0x70, 0x2a, 0xbf, 0x26, 0xb4, + 0xd3, 0x30, 0x49, 0x92, 0xda, 0x30, 0x4a, 0xb6, 0xb2, 0xb9, 0xb9, 0x4d, 0x37, 0x8e, 0x64, 0x2f, + 0x7b, 0xd3, 0x11, 0x1d, 0x48, 0x47, 0xcc, 0x87, 0x8e, 0x7d, 0x7c, 0xec, 0x38, 0x01, 0x3b, 0x6a, + 0x56, 0x3e, 0x0e, 0x63, 0xce, 0x37, 0x85, 0x86, 0x24, 0xdf, 0x6f, 0xa2, 0x5a, 0x1d, 0xe1, 0xad, + 0x3d, 0x02, 0x2d, 0xab, 0x30, 0x5b, 0x75, 0x6a, 0xa3, 0xac, 0xb8, 0x86, 0xbb, 0xac, 0x18, 0x0b, + 0x6b, 0x0e, 0x56, 0x36, 0x8d, 0x91, 0xd7, 0x55, 0x61, 0x05, 0xdc, 0x22, 0xbb, 0x20, 0x38, 0x6a, + 0xa0, 0xff, 0x72, 0xb4, 0x09, 0x7b, 0xe6, 0x9d, 0x61, 0xa4, 0x23, 0xf3, 0xbf, 0x10, 0xbb, 0x2b, + 0xa2, 0x66, 0x4d, 0x23, 0xc5, 0x23, 0xeb, 0xe9, 0x18, 0xb1, 0x74, 0x13, 0x4b, 0x52, 0xaa, 0xcc, + 0x75, 0x6c, 0x01, 0xe2, 0xba, 0x99, 0x5d, 0x04, 0xda, 0x53, 0xfd, 0x54, 0x90, 0x44, 0xa4, 0x8d, + 0x36, 0x59, 0x19, 0x00, 0xdf, 0xaf, 0x19, 0x7b, 0x33, 0x61, 0x0b, 0x3d, 0xe8, 0x35, 0xe4, 0x3a, + 0xc4, 0xc9, 0x25, 0xab, 0xef, 0x1d, 0x89, 0x68, 0xa6, 0x0e, 0x92, 0x25, 0x46, 0x9d, 0x20, 0x9f, + 0xd6, 0xce, 0xc4, 0x88, 0x45, 0xf8, 0x59, 0x32, 0x4e, 0xf7, 0x65, 0xf6, 0xab, 0x28, 0x2c, 0xf4, + 0x78, 0xda, 0xf7, 0x62, 0x33, 0x80, 0xa3, 0x3d, 0x57, 0xc3, 0x3b, 0xfc, 0x85, 0x26, 0xe1, 0xd1, + 0x49, 0xb3, 0x97, 0xc0, 0xd1, 0x60, 0x77, 0xe3, 0x32, 0x6b, 0xbf, 0xc3, 0x26, 0x0d, 0x8e, 0xbd, + 0x03, 0x49, 0x45, 0x95, 0x15, 0x59, 0x43, 0xb5, 0x0a, 0x05, 0x84, 0xfa, 0x13, 0x0d, 0xec, 0xc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0xa2, 0x7b, 0xdd, 0x9a, 0xef, 0xc1, 0x7c, 0xef, 0x4d, 0xf5, + 0x6c, 0x30, 0x45, 0x46, 0xe1, 0x58, 0x0f, 0x2c, 0xea, 0x6f, 0xd2, 0x28, 0x1f, 0x01, 0x4d, 0x1a, + 0x15, 0x64, 0x3d, 0xb0, 0xa8, 0x65, 0xf2, 0x23, 0x58, 0xf4, 0x6e, 0x9f, 0xd7, 0x82, 0xe9, 0xa2, + 0x5b, 0xec, 0xca, 0x50, 0xe2, 0xfe, 0xe6, 0xe9, 0xa6, 0x08, 0x68, 0x9e, 0x6e, 0x91, 0x2b, 0x43, + 0x89, 0x5b, 0xe6, 0x3f, 0x84, 0x05, 0xcf, 0x7e, 0xe4, 0x42, 0xc0, 0x68, 0xb0, 0x34, 0x77, 0x79, + 0x18, 0x69, 0x6a, 0xfb, 0x46, 0xe9, 0xe9, 0xf3, 0x14, 0xf3, 0xec, 0x79, 0x8a, 0xf9, 0xfd, 0x79, + 0x8a, 0xf9, 0xfc, 0x45, 0x2a, 0xf4, 0xec, 0x45, 0x2a, 0xf4, 0xcb, 0x8b, 0x54, 0xe8, 0xdd, 0xab, + 0x75, 0x51, 0x3f, 0x68, 0xef, 0xe7, 0x04, 0xb9, 0x95, 0x17, 0x64, 0xad, 0x25, 0x6b, 0x79, 0x71, + 0x5f, 0x58, 0xab, 0xcb, 0xf9, 0xce, 0xbf, 0xf3, 0x2d, 0xb9, 0xd6, 0x6e, 0x22, 0xcd, 0xfc, 0x3f, + 0xf9, 0xc5, 0xcb, 0x6b, 0xf4, 0x5f, 0xe5, 0xfa, 0xa1, 0x82, 0xb4, 0xfd, 0x18, 0xfe, 0x37, 0xf9, + 0xa5, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x84, 0xce, 0x31, 0xd8, 0x1f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3135,15 +3136,10 @@ func (m *MsgChannelUpgradeInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Signer) i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) i-- - dAtA[i] = 0x32 - } - if m.TimeoutTimestamp != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) - i-- - dAtA[i] = 0x28 + dAtA[i] = 0x2a } { - size, err := m.TimeoutHeight.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Timeout.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3153,7 +3149,7 @@ func (m *MsgChannelUpgradeInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 { - size, err := m.ProposedUpgradeChannel.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Fields.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3204,13 +3200,16 @@ func (m *MsgChannelUpgradeInitResponse) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x18 } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintTx(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x12 + { + size, err := m.Upgrade.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.ChannelId) > 0 { i -= len(m.ChannelId) copy(dAtA[i:], m.ChannelId) @@ -4176,13 +4175,10 @@ func (m *MsgChannelUpgradeInit) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.ProposedUpgradeChannel.Size() + l = m.Fields.Size() n += 1 + l + sovTx(uint64(l)) - l = m.TimeoutHeight.Size() + l = m.Timeout.Size() n += 1 + l + sovTx(uint64(l)) - if m.TimeoutTimestamp != 0 { - n += 1 + sovTx(uint64(m.TimeoutTimestamp)) - } l = len(m.Signer) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -4200,10 +4196,8 @@ func (m *MsgChannelUpgradeInitResponse) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.Upgrade.Size() + n += 1 + l + sovTx(uint64(l)) if m.UpgradeSequence != 0 { n += 1 + sovTx(uint64(m.UpgradeSequence)) } @@ -7349,7 +7343,7 @@ func (m *MsgChannelUpgradeInit) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposedUpgradeChannel", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7376,13 +7370,13 @@ func (m *MsgChannelUpgradeInit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ProposedUpgradeChannel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Fields.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7409,30 +7403,11 @@ func (m *MsgChannelUpgradeInit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TimeoutHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Timeout.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) - } - m.TimeoutTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimeoutTimestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } @@ -7548,9 +7523,9 @@ func (m *MsgChannelUpgradeInitResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Upgrade", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -7560,23 +7535,24 @@ func (m *MsgChannelUpgradeInitResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Version = string(dAtA[iNdEx:postIndex]) + if err := m.Upgrade.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 0 { diff --git a/modules/core/04-channel/types/upgrade.go b/modules/core/04-channel/types/upgrade.go index d506f6fb99b..a9f44483e6c 100644 --- a/modules/core/04-channel/types/upgrade.go +++ b/modules/core/04-channel/types/upgrade.go @@ -30,8 +30,8 @@ func NewUpgradeFields(ordering Order, connectionHops []string, version string) U // NewUpgradeTimeout returns a new UpgradeTimeout instance. func NewUpgradeTimeout(height clienttypes.Height, timestamp uint64) UpgradeTimeout { return UpgradeTimeout{ - TimeoutHeight: height, - TimeoutTimestamp: timestamp, + Height: height, + Timestamp: timestamp, } } @@ -42,10 +42,9 @@ func (u Upgrade) ValidateBasic() error { } if !u.Timeout.IsValid() { - return errorsmod.Wrap(ErrInvalidUpgrade, "upgrade timeout cannot be empty") + return errorsmod.Wrap(ErrInvalidUpgrade, "upgrade timeout height and upgrade timeout timestamp cannot both be 0") } - // TODO: determine if last packet sequence sent can be 0? return nil } @@ -68,5 +67,5 @@ func (uf UpgradeFields) ValidateBasic() error { // IsValid returns true if either the height or timestamp is non-zero func (ut UpgradeTimeout) IsValid() bool { - return !ut.TimeoutHeight.IsZero() || ut.TimeoutTimestamp != 0 + return !ut.Height.IsZero() || ut.Timestamp != 0 } diff --git a/modules/core/04-channel/types/upgrade.pb.go b/modules/core/04-channel/types/upgrade.pb.go index 42329473de1..079809c35be 100644 --- a/modules/core/04-channel/types/upgrade.pb.go +++ b/modules/core/04-channel/types/upgrade.pb.go @@ -154,9 +154,9 @@ func (m *UpgradeFields) GetVersion() string { // must no longer proceed with the upgrade handshake. type UpgradeTimeout struct { // block height after which the upgrade times out - TimeoutHeight types.Height `protobuf:"bytes,1,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height"` + Height types.Height `protobuf:"bytes,1,opt,name=height,proto3" json:"height"` // block timestamp (in nanoseconds) after which the upgrade times out - TimeoutTimestamp uint64 `protobuf:"varint,2,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` + Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (m *UpgradeTimeout) Reset() { *m = UpgradeTimeout{} } @@ -192,16 +192,16 @@ func (m *UpgradeTimeout) XXX_DiscardUnknown() { var xxx_messageInfo_UpgradeTimeout proto.InternalMessageInfo -func (m *UpgradeTimeout) GetTimeoutHeight() types.Height { +func (m *UpgradeTimeout) GetHeight() types.Height { if m != nil { - return m.TimeoutHeight + return m.Height } return types.Height{} } -func (m *UpgradeTimeout) GetTimeoutTimestamp() uint64 { +func (m *UpgradeTimeout) GetTimestamp() uint64 { if m != nil { - return m.TimeoutTimestamp + return m.Timestamp } return 0 } @@ -273,36 +273,36 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v1/upgrade.proto", fileDescriptor_fb1cef68588848b2) } var fileDescriptor_fb1cef68588848b2 = []byte{ - // 463 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0xe3, 0x36, 0x34, 0xcd, 0x41, 0x03, 0x1c, 0x19, 0xac, 0x0c, 0x6e, 0x30, 0x03, 0x91, - 0x50, 0xed, 0xa6, 0x20, 0x10, 0x5b, 0x55, 0x04, 0x74, 0x43, 0x72, 0xca, 0xc2, 0x12, 0xc5, 0xe7, - 0x87, 0x7d, 0x92, 0x7d, 0xcf, 0xf8, 0xce, 0x96, 0xf8, 0x02, 0x0c, 0x4c, 0x7c, 0x26, 0xa6, 0x8e, - 0x1d, 0x99, 0x10, 0x4a, 0xbe, 0x08, 0xf2, 0xdd, 0xb9, 0xa5, 0x52, 0xc4, 0xe4, 0xbb, 0xf7, 0x7e, - 0xef, 0x7f, 0xff, 0xf7, 0xfc, 0xc8, 0x63, 0x1e, 0xb3, 0x90, 0x61, 0x05, 0x21, 0xcb, 0x56, 0x42, - 0x40, 0x1e, 0x36, 0xf3, 0xb0, 0x2e, 0xd3, 0x6a, 0x95, 0x40, 0x50, 0x56, 0xa8, 0x90, 0x3e, 0xe2, - 0x31, 0x0b, 0x5a, 0x24, 0xb0, 0x48, 0xd0, 0xcc, 0x27, 0xe3, 0x14, 0x53, 0xd4, 0xf9, 0xb0, 0x3d, - 0x19, 0x74, 0x72, 0x78, 0xa3, 0x96, 0x73, 0x10, 0xaa, 0x15, 0x33, 0x27, 0x0b, 0x6c, 0x7d, 0xae, - 0x93, 0xd5, 0x88, 0xff, 0xd3, 0x21, 0x83, 0x8f, 0xc6, 0x00, 0x3d, 0x25, 0x7b, 0x9f, 0x39, 0xe4, - 0x89, 0x74, 0x9d, 0xa9, 0x33, 0xbb, 0x7b, 0xe2, 0x07, 0x5b, 0xbc, 0x04, 0x96, 0x7e, 0xa7, 0xc9, - 0xb3, 0xfe, 0xe5, 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 0xd1, 0x09, 0xd9, 0xef, 0x06, - 0xaa, 0xdf, 0xef, 0x47, 0xd7, 0x77, 0x3a, 0x26, 0x77, 0xa0, 0x65, 0xb5, 0xd8, 0x30, 0x32, 0x97, - 0xb3, 0xc5, 0xe5, 0xda, 0x73, 0xae, 0xd6, 0x9e, 0xf3, 0x67, 0xed, 0x39, 0x3f, 0x36, 0x5e, 0xef, - 0x6a, 0xe3, 0xf5, 0x7e, 0x6d, 0xbc, 0xde, 0xa7, 0xd7, 0x29, 0x57, 0x59, 0x1d, 0x07, 0x0c, 0x8b, - 0x90, 0xa1, 0x2c, 0x50, 0x86, 0x3c, 0x66, 0x47, 0x29, 0x86, 0xcd, 0xab, 0xb0, 0xc0, 0xa4, 0xce, - 0x41, 0x9a, 0xcd, 0x3b, 0x7e, 0x71, 0xd4, 0x2d, 0x9f, 0xfa, 0x5a, 0x82, 0x8c, 0xf7, 0xf4, 0xe2, - 0x3d, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x00, 0xd9, 0xd4, 0x0c, 0x03, 0x00, 0x00, + // 450 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x9b, 0xad, 0xb4, 0xab, 0x81, 0x22, 0x99, 0x1e, 0xa2, 0x0a, 0x65, 0x25, 0x1c, 0xe8, + 0x65, 0xc9, 0x3a, 0x10, 0x7f, 0x6e, 0xd3, 0x10, 0x68, 0x37, 0xa4, 0x14, 0x2e, 0x5c, 0xaa, 0xc6, + 0x79, 0x49, 0x2c, 0x25, 0x7e, 0x83, 0xed, 0x44, 0xe2, 0x2b, 0x70, 0xe2, 0x33, 0x71, 0xda, 0x71, + 0x47, 0x4e, 0x08, 0xb5, 0x5f, 0x04, 0xc5, 0x4e, 0x56, 0x26, 0x55, 0xbb, 0xf9, 0xf5, 0xfb, 0x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ff, 0xff, 0x22, 0x32, 0xbd, 0xfd, 0xed, 0x02, + 0x00, 0x00, } func (m *Upgrade) Marshal() (dAtA []byte, err error) { @@ -417,13 +417,13 @@ func (m *UpgradeTimeout) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TimeoutTimestamp != 0 { - i = encodeVarintUpgrade(dAtA, i, uint64(m.TimeoutTimestamp)) + if m.Timestamp != 0 { + i = encodeVarintUpgrade(dAtA, i, uint64(m.Timestamp)) i-- dAtA[i] = 0x10 } { - size, err := m.TimeoutHeight.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -525,10 +525,10 @@ func (m *UpgradeTimeout) Size() (n int) { } var l int _ = l - l = m.TimeoutHeight.Size() + l = m.Height.Size() n += 1 + l + sovUpgrade(uint64(l)) - if m.TimeoutTimestamp != 0 { - n += 1 + sovUpgrade(uint64(m.TimeoutTimestamp)) + if m.Timestamp != 0 { + n += 1 + sovUpgrade(uint64(m.Timestamp)) } return n } @@ -854,7 +854,7 @@ func (m *UpgradeTimeout) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -881,15 +881,15 @@ func (m *UpgradeTimeout) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TimeoutHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Height.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } - m.TimeoutTimestamp = 0 + m.Timestamp = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUpgrade @@ -899,7 +899,7 @@ func (m *UpgradeTimeout) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TimeoutTimestamp |= uint64(b&0x7F) << shift + m.Timestamp |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/modules/core/05-port/types/module.go b/modules/core/05-port/types/module.go index c1c5a93a3dd..d9d4c0a6a31 100644 --- a/modules/core/05-port/types/module.go +++ b/modules/core/05-port/types/module.go @@ -116,7 +116,6 @@ type UpgradableModule interface { connectionHops []string, portID, channelID string, sequence uint64, - counterparty channeltypes.Counterparty, version, previousVersion string, ) (string, error) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 4a1fcefe8e6..fa727003b82 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -699,43 +699,53 @@ func (k Keeper) Acknowledgement(goCtx context.Context, msg *channeltypes.MsgAckn func (k Keeper) ChannelUpgradeInit(goCtx context.Context, msg *channeltypes.MsgChannelUpgradeInit) (*channeltypes.MsgChannelUpgradeInitResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - module, chanCap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) + module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) if err != nil { - ctx.Logger().Error("channel upgrade init callback failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) + ctx.Logger().Error("channel upgrade init failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") } cbs, ok := k.Router.GetRoute(module) if !ok { - ctx.Logger().Error("channel upgrade init callback failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) + ctx.Logger().Error("channel upgrade init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } - upgradeSequence, previousVersion, err := k.ChannelKeeper.ChanUpgradeInit(ctx, msg.PortId, msg.ChannelId, chanCap, msg.ProposedUpgradeChannel, msg.TimeoutHeight, msg.TimeoutTimestamp) + proposedUpgrade, err := k.ChannelKeeper.ChanUpgradeInit(ctx, msg.PortId, msg.ChannelId, msg.Fields, msg.Timeout) if err != nil { - ctx.Logger().Error("channel upgrade init callback failed", "error", errorsmod.Wrap(err, "channel handshake upgrade init failed")) + ctx.Logger().Error("channel upgrade init failed", "error", errorsmod.Wrap(err, "channel handshake upgrade init failed")) return nil, errorsmod.Wrap(err, "channel handshake upgrade init failed") } - version, err := cbs.OnChanUpgradeInit(ctx, msg.ProposedUpgradeChannel.Ordering, msg.ProposedUpgradeChannel.ConnectionHops, - msg.PortId, msg.ChannelId, upgradeSequence, msg.ProposedUpgradeChannel.Counterparty, msg.ProposedUpgradeChannel.Version, - previousVersion, + channel, found := k.ChannelKeeper.GetChannel(ctx, msg.PortId, msg.ChannelId) + if !found { + return nil, errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", msg.PortId, msg.ChannelId) + } + + proposedVersion, err := cbs.OnChanUpgradeInit( + ctx, + proposedUpgrade.Fields.Ordering, + proposedUpgrade.Fields.ConnectionHops, + msg.PortId, + msg.ChannelId, + channel.UpgradeSequence, + proposedUpgrade.Fields.Version, + channel.Version, ) if err != nil { ctx.Logger().Error("channel upgrade init callback failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", err.Error()) return nil, errorsmod.Wrapf(err, "channel upgrade init callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } - msg.ProposedUpgradeChannel.Version = version - - k.ChannelKeeper.WriteUpgradeInitChannel(ctx, msg.PortId, msg.ChannelId, upgradeSequence, msg.ProposedUpgradeChannel) + proposedUpgrade.Fields.Version = proposedVersion + k.ChannelKeeper.WriteUpgradeInitChannel(ctx, msg.PortId, msg.ChannelId, channel, proposedUpgrade) - ctx.Logger().Info("channel upgrade init callback succeeded", "channel-id", msg.ChannelId, "version", version) + ctx.Logger().Info("channel upgrade init callback succeeded", "channel-id", msg.ChannelId, "version", proposedVersion) return &channeltypes.MsgChannelUpgradeInitResponse{ ChannelId: msg.ChannelId, - Version: version, - UpgradeSequence: upgradeSequence, + Upgrade: proposedUpgrade, + UpgradeSequence: channel.UpgradeSequence, }, nil } diff --git a/proto/ibc/core/channel/v1/tx.proto b/proto/ibc/core/channel/v1/tx.proto index 62c63483312..a76ef7dcc6b 100644 --- a/proto/ibc/core/channel/v1/tx.proto +++ b/proto/ibc/core/channel/v1/tx.proto @@ -261,19 +261,18 @@ message MsgChannelUpgradeInit { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string port_id = 1; - string channel_id = 2; - Channel proposed_upgrade_channel = 3 [(gogoproto.nullable) = false]; - ibc.core.client.v1.Height timeout_height = 4 [(gogoproto.nullable) = false]; - uint64 timeout_timestamp = 5; - string signer = 6; + string port_id = 1; + string channel_id = 2; + UpgradeFields fields = 3 [(gogoproto.nullable) = false]; + UpgradeTimeout timeout = 4 [(gogoproto.nullable) = false]; + string signer = 5; } // MsgChannelUpgradeInitResponse defines the MsgChannelUpgradeInit response type message MsgChannelUpgradeInitResponse { - string channel_id = 1; - string version = 2; - uint64 upgrade_sequence = 3; + string channel_id = 1; + Upgrade upgrade = 2 [(gogoproto.nullable) = false]; + uint64 upgrade_sequence = 3; } // MsgChannelUpgradeTry defines the request type for the ChannelUpgradeTry rpc @@ -363,4 +362,4 @@ message MsgChannelUpgradeCancel { } // MsgChannelUpgradeCancelResponse defines the MsgChannelUpgradeCancel response type -message MsgChannelUpgradeCancelResponse {} \ No newline at end of file +message MsgChannelUpgradeCancelResponse {} diff --git a/proto/ibc/core/channel/v1/upgrade.proto b/proto/ibc/core/channel/v1/upgrade.proto index b54cd644113..1584651e3b0 100644 --- a/proto/ibc/core/channel/v1/upgrade.proto +++ b/proto/ibc/core/channel/v1/upgrade.proto @@ -30,9 +30,9 @@ message UpgradeFields { // must no longer proceed with the upgrade handshake. message UpgradeTimeout { // block height after which the upgrade times out - ibc.core.client.v1.Height timeout_height = 1 [(gogoproto.nullable) = false]; + ibc.core.client.v1.Height height = 1 [(gogoproto.nullable) = false]; // block timestamp (in nanoseconds) after which the upgrade times out - uint64 timeout_timestamp = 2; + uint64 timestamp = 2; } // ErrorReceipt defines a type which encapsulates the upgrade sequence and error associated with the diff --git a/testing/endpoint.go b/testing/endpoint.go index 51fa630cf5e..1705940c741 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -565,12 +565,11 @@ func (endpoint *Endpoint) TimeoutOnClose(packet channeltypes.Packet) error { } func (endpoint *Endpoint) ChanUpgradeInit(timeoutHeight clienttypes.Height, timeoutTimestamp uint64) error { - counterparty := channeltypes.NewCounterparty(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID) - channelUpgrade := channeltypes.NewChannel(channeltypes.INITUPGRADE, endpoint.ChannelConfig.Order, counterparty, []string{endpoint.ConnectionID}, endpoint.ChannelConfig.Version) - msg := channeltypes.NewMsgChannelUpgradeInit( - endpoint.ChannelConfig.PortID, endpoint.ChannelID, - channelUpgrade, timeoutHeight, timeoutTimestamp, + endpoint.ChannelConfig.PortID, + endpoint.ChannelID, + channeltypes.NewUpgradeFields(endpoint.ChannelConfig.Order, []string{endpoint.ConnectionID}, endpoint.ChannelConfig.Version), + channeltypes.NewUpgradeTimeout(timeoutHeight, timeoutTimestamp), endpoint.Chain.SenderAccount.GetAddress().String(), ) diff --git a/testing/mock/ibc_module.go b/testing/mock/ibc_module.go index 93f633cccc1..c126ec6bf7c 100644 --- a/testing/mock/ibc_module.go +++ b/testing/mock/ibc_module.go @@ -163,7 +163,7 @@ func (im IBCModule) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, counterparty channeltypes.Counterparty, version, previousVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, sequence uint64, version, previousVersion string) (string, error) { return Version, nil }