diff --git a/CHANGELOG.md b/CHANGELOG.md index cf37396300c..3d94e357b2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core/04-channel) [\#5991](https://github.com/cosmos/ibc-go/pull/5991) The client CLI `QueryLatestConsensusState` has been removed. * (light-clients/06-solomachine) [\#6037](https://github.com/cosmos/ibc-go/pull/6037) Remove `Initialize` function from `ClientState` and move logic to `Initialize` function of `LightClientModule`. * (core/02-client) [\#6084](https://github.com/cosmos/ibc-go/pull/6084) Removed `stakingKeeper` as an argument to `NewKeeper` and replaced with a `ConsensusHost` implementation. +* (testing) [\#6070](https://github.com/cosmos/ibc-go/pull/6070) Remove `AssertEventsLegacy` function. * (core) [\#6138](https://github.com/cosmos/ibc-go/pull/6138) Remove `Router` reference from IBC core keeper and use instead the router on the existing `PortKeeper` reference. ### State Machine Breaking diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index 75a2bcfe80b..b2c0380e3e5 100644 --- a/docs/docs/05-migrations/13-v8-to-v9.md +++ b/docs/docs/05-migrations/13-v8-to-v9.md @@ -46,6 +46,22 @@ Please use the new functions `path.Setup`, `path.SetupClients`, `path.SetupConne - The `mock.PV` type has been removed in favour of [`cmttypes.MockPV`](https://github.com/cometbft/cometbft/blob/v0.38.5/types/priv_validator.go#L50) ([#5709](https://github.com/cosmos/ibc-go/pull/5709)). - Functions `ConstructUpdateTMClientHeader` and `ConstructUpdateTMClientHeaderWithTrustedHeight` of `TestChain` type have been replaced with `IBCClientHeader`. This function will construct a `07-tendermint` header to update the light client on the counterparty chain. The trusted height must be passed in as a non-zero height. - `GetValsAtHeight` has been renamed to `GetTrustedValidators` +- `AssertEventsLegacy` function of `ibctesting` package (alias for `"github.com/cosmos/ibc-go/v9/testing"`) has been removed and `AssertEvents` function should be used instead (ref: [#6070](https://github.com/cosmos/ibc-go/pull/6070)). + +```diff +// testing/events.go +- func AssertEventsLegacy( +- suite *testifysuite.Suite, +- expected EventsMap, +- actual []abci.Event, +- ) + +func AssertEvents( + suite *testifysuite.Suite, + expected []abci.Event, + actual []abci.Event, +) +``` ### IBC core diff --git a/modules/apps/callbacks/types/events_test.go b/modules/apps/callbacks/types/events_test.go index 17cd920e211..99b5a530f8e 100644 --- a/modules/apps/callbacks/types/events_test.go +++ b/modules/apps/callbacks/types/events_test.go @@ -3,6 +3,8 @@ package types_test import ( sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/ibc-go/modules/apps/callbacks/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -10,41 +12,13 @@ import ( ) func (s *CallbacksTypesTestSuite) TestEvents() { - constEvents := func() ibctesting.EventsMap { - return ibctesting.EventsMap{ - types.EventTypeSourceCallback: { - sdk.AttributeKeyModule: types.ModuleName, - types.AttributeKeyCallbackType: string(types.CallbackTypeAcknowledgementPacket), - types.AttributeKeyCallbackAddress: ibctesting.TestAccAddress, - types.AttributeKeyCallbackGasLimit: "100000", - types.AttributeKeyCallbackCommitGasLimit: "200000", - types.AttributeKeyCallbackSourcePortID: ibctesting.MockPort, - types.AttributeKeyCallbackSourceChannelID: ibctesting.FirstChannelID, - types.AttributeKeyCallbackSequence: "1", - types.AttributeKeyCallbackResult: types.AttributeValueCallbackSuccess, - }, - types.EventTypeDestinationCallback: { - sdk.AttributeKeyModule: types.ModuleName, - types.AttributeKeyCallbackType: string(types.CallbackTypeReceivePacket), - types.AttributeKeyCallbackAddress: ibctesting.TestAccAddress, - types.AttributeKeyCallbackGasLimit: "100000", - types.AttributeKeyCallbackCommitGasLimit: "200000", - types.AttributeKeyCallbackDestPortID: ibctesting.MockFeePort, - types.AttributeKeyCallbackDestChannelID: ibctesting.InvalidID, - types.AttributeKeyCallbackSequence: "1", - types.AttributeKeyCallbackResult: types.AttributeValueCallbackSuccess, - }, - } - } - - var expEvents ibctesting.EventsMap testCases := []struct { - name string - packet channeltypes.Packet - callbackType types.CallbackType - callbackData types.CallbackData - callbackError error - malleate func() + name string + packet channeltypes.Packet + callbackType types.CallbackType + callbackData types.CallbackData + callbackError error + expectedEvents func() []abci.Event }{ { "success: ack callback", @@ -59,7 +33,22 @@ func (s *CallbacksTypesTestSuite) TestEvents() { CommitGasLimit: 200_000, }, nil, - func() {}, + func() []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeSourceCallback, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyCallbackType, string(types.CallbackTypeAcknowledgementPacket)), + sdk.NewAttribute(types.AttributeKeyCallbackAddress, ibctesting.TestAccAddress), + sdk.NewAttribute(types.AttributeKeyCallbackGasLimit, "100000"), + sdk.NewAttribute(types.AttributeKeyCallbackCommitGasLimit, "200000"), + sdk.NewAttribute(types.AttributeKeyCallbackSourcePortID, ibctesting.MockPort), + sdk.NewAttribute(types.AttributeKeyCallbackSourceChannelID, ibctesting.FirstChannelID), + sdk.NewAttribute(types.AttributeKeyCallbackSequence, "1"), + sdk.NewAttribute(types.AttributeKeyCallbackResult, types.AttributeValueCallbackSuccess), + ), + }.ToABCIEvents() + }, }, { "success: send packet callback", @@ -74,8 +63,21 @@ func (s *CallbacksTypesTestSuite) TestEvents() { CommitGasLimit: 200_000, }, nil, - func() { - expEvents[types.EventTypeSourceCallback][types.AttributeKeyCallbackType] = string(types.CallbackTypeSendPacket) + func() []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeSourceCallback, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyCallbackType, string(types.CallbackTypeSendPacket)), + sdk.NewAttribute(types.AttributeKeyCallbackAddress, ibctesting.TestAccAddress), + sdk.NewAttribute(types.AttributeKeyCallbackGasLimit, "100000"), + sdk.NewAttribute(types.AttributeKeyCallbackCommitGasLimit, "200000"), + sdk.NewAttribute(types.AttributeKeyCallbackSourcePortID, ibctesting.MockPort), + sdk.NewAttribute(types.AttributeKeyCallbackSourceChannelID, ibctesting.FirstChannelID), + sdk.NewAttribute(types.AttributeKeyCallbackSequence, "1"), + sdk.NewAttribute(types.AttributeKeyCallbackResult, types.AttributeValueCallbackSuccess), + ), + }.ToABCIEvents() }, }, { @@ -91,8 +93,21 @@ func (s *CallbacksTypesTestSuite) TestEvents() { CommitGasLimit: 200_000, }, nil, - func() { - expEvents[types.EventTypeSourceCallback][types.AttributeKeyCallbackType] = string(types.CallbackTypeTimeoutPacket) + func() []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeSourceCallback, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyCallbackType, string(types.CallbackTypeTimeoutPacket)), + sdk.NewAttribute(types.AttributeKeyCallbackAddress, ibctesting.TestAccAddress), + sdk.NewAttribute(types.AttributeKeyCallbackGasLimit, "100000"), + sdk.NewAttribute(types.AttributeKeyCallbackCommitGasLimit, "200000"), + sdk.NewAttribute(types.AttributeKeyCallbackSourcePortID, ibctesting.MockPort), + sdk.NewAttribute(types.AttributeKeyCallbackSourceChannelID, ibctesting.FirstChannelID), + sdk.NewAttribute(types.AttributeKeyCallbackSequence, "1"), + sdk.NewAttribute(types.AttributeKeyCallbackResult, types.AttributeValueCallbackSuccess), + ), + }.ToABCIEvents() }, }, { @@ -108,7 +123,22 @@ func (s *CallbacksTypesTestSuite) TestEvents() { CommitGasLimit: 200_000, }, nil, - func() {}, + func() []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeDestinationCallback, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyCallbackType, string(types.CallbackTypeReceivePacket)), + sdk.NewAttribute(types.AttributeKeyCallbackAddress, ibctesting.TestAccAddress), + sdk.NewAttribute(types.AttributeKeyCallbackGasLimit, "100000"), + sdk.NewAttribute(types.AttributeKeyCallbackCommitGasLimit, "200000"), + sdk.NewAttribute(types.AttributeKeyCallbackDestPortID, ibctesting.MockFeePort), + sdk.NewAttribute(types.AttributeKeyCallbackDestChannelID, ibctesting.InvalidID), + sdk.NewAttribute(types.AttributeKeyCallbackSequence, "1"), + sdk.NewAttribute(types.AttributeKeyCallbackResult, types.AttributeValueCallbackSuccess), + ), + }.ToABCIEvents() + }, }, { "success: unknown callback", @@ -123,8 +153,21 @@ func (s *CallbacksTypesTestSuite) TestEvents() { CommitGasLimit: 200_000, }, nil, - func() { - expEvents[types.EventTypeSourceCallback][types.AttributeKeyCallbackType] = "something" + func() []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeSourceCallback, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyCallbackType, "something"), + sdk.NewAttribute(types.AttributeKeyCallbackAddress, ibctesting.TestAccAddress), + sdk.NewAttribute(types.AttributeKeyCallbackGasLimit, "100000"), + sdk.NewAttribute(types.AttributeKeyCallbackCommitGasLimit, "200000"), + sdk.NewAttribute(types.AttributeKeyCallbackSourcePortID, ibctesting.MockPort), + sdk.NewAttribute(types.AttributeKeyCallbackSourceChannelID, ibctesting.FirstChannelID), + sdk.NewAttribute(types.AttributeKeyCallbackSequence, "1"), + sdk.NewAttribute(types.AttributeKeyCallbackResult, types.AttributeValueCallbackSuccess), + ), + }.ToABCIEvents() }, }, { @@ -140,9 +183,22 @@ func (s *CallbacksTypesTestSuite) TestEvents() { CommitGasLimit: 200_000, }, types.ErrNotPacketDataProvider, - func() { - expEvents[types.EventTypeSourceCallback][types.AttributeKeyCallbackResult] = types.AttributeValueCallbackFailure - expEvents[types.EventTypeSourceCallback][types.AttributeKeyCallbackError] = types.ErrNotPacketDataProvider.Error() + func() []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeSourceCallback, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyCallbackType, string(types.CallbackTypeAcknowledgementPacket)), + sdk.NewAttribute(types.AttributeKeyCallbackAddress, ibctesting.TestAccAddress), + sdk.NewAttribute(types.AttributeKeyCallbackGasLimit, "100000"), + sdk.NewAttribute(types.AttributeKeyCallbackCommitGasLimit, "200000"), + sdk.NewAttribute(types.AttributeKeyCallbackSourcePortID, ibctesting.MockPort), + sdk.NewAttribute(types.AttributeKeyCallbackSourceChannelID, ibctesting.FirstChannelID), + sdk.NewAttribute(types.AttributeKeyCallbackSequence, "1"), + sdk.NewAttribute(types.AttributeKeyCallbackResult, types.AttributeValueCallbackFailure), + sdk.NewAttribute(types.AttributeKeyCallbackError, types.ErrNotPacketDataProvider.Error()), + ), + }.ToABCIEvents() }, }, } @@ -150,28 +206,25 @@ func (s *CallbacksTypesTestSuite) TestEvents() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - expEvents = constEvents() - tc.malleate() newCtx := sdk.Context{}.WithEventManager(sdk.NewEventManager()) - switch tc.callbackType { case types.CallbackTypeReceivePacket: - delete(expEvents, types.EventTypeSourceCallback) types.EmitCallbackEvent( newCtx, tc.packet.GetDestPort(), tc.packet.GetDestChannel(), tc.packet.GetSequence(), tc.callbackType, tc.callbackData, tc.callbackError, ) default: - delete(expEvents, types.EventTypeDestinationCallback) types.EmitCallbackEvent( newCtx, tc.packet.GetSourcePort(), tc.packet.GetSourceChannel(), tc.packet.GetSequence(), tc.callbackType, tc.callbackData, tc.callbackError, ) } - events := newCtx.EventManager().Events().ToABCIEvents() - ibctesting.AssertEventsLegacy(&s.Suite, expEvents, events) + actualEvents := newCtx.EventManager().Events().ToABCIEvents() + expectedEvents := tc.expectedEvents() + + ibctesting.AssertEvents(&s.Suite, expectedEvents, actualEvents) }) } } diff --git a/modules/apps/transfer/keeper/msg_server_test.go b/modules/apps/transfer/keeper/msg_server_test.go index 55bc27a8a89..dfca09ceabb 100644 --- a/modules/apps/transfer/keeper/msg_server_test.go +++ b/modules/apps/transfer/keeper/msg_server_test.go @@ -106,26 +106,27 @@ func (suite *KeeperTestSuite) TestMsgTransfer() { res, err := suite.chainA.GetSimApp().TransferKeeper.Transfer(ctx, msg) // Verify events - events := ctx.EventManager().Events().ToABCIEvents() - expEvents := ibctesting.EventsMap{ - "ibc_transfer": { - "sender": suite.chainA.SenderAccount.GetAddress().String(), - "receiver": suite.chainB.SenderAccount.GetAddress().String(), - "amount": coin.Amount.String(), - "denom": coin.Denom, - "memo": "memo", - }, - } + actualEvents := ctx.EventManager().Events().ToABCIEvents() + expectedEvents := sdk.Events{ + sdk.NewEvent( + types.EventTypeTransfer, + sdk.NewAttribute(sdk.AttributeKeySender, suite.chainA.SenderAccount.GetAddress().String()), + sdk.NewAttribute(types.AttributeKeyReceiver, suite.chainB.SenderAccount.GetAddress().String()), + sdk.NewAttribute(types.AttributeKeyAmount, coin.Amount.String()), + sdk.NewAttribute(types.AttributeKeyDenom, coin.Denom), + sdk.NewAttribute(types.AttributeKeyMemo, "memo"), + ), + }.ToABCIEvents() if tc.expPass { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().NotEqual(res.Sequence, uint64(0)) - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + ibctesting.AssertEvents(&suite.Suite, expectedEvents, actualEvents) } else { suite.Require().Error(err) suite.Require().Nil(res) - suite.Require().Len(events, 0) + suite.Require().Len(actualEvents, 0) } }) } diff --git a/modules/core/02-client/keeper/events_test.go b/modules/core/02-client/keeper/events_test.go index 26252de916e..a07cd9c3dc0 100644 --- a/modules/core/02-client/keeper/events_test.go +++ b/modules/core/02-client/keeper/events_test.go @@ -20,6 +20,7 @@ func (suite *KeeperTestSuite) TestMsgCreateClientEvents() { height, ok := path.EndpointA.Counterparty.Chain.LatestCommittedHeader.GetHeight().(clienttypes.Height) suite.Require().True(ok) + clientState := ibctm.NewClientState( path.EndpointA.Counterparty.Chain.ChainID, tmConfig.TrustLevel, tmConfig.TrustingPeriod, tmConfig.UnbondingPeriod, tmConfig.MaxClockDrift, height, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath) @@ -59,6 +60,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateClientEvents() { clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState) suite.Require().True(ok) + trustedHeight := clientState.LatestHeight header, err := suite.chainB.IBCClientHeader(suite.chainB.LatestCommittedHeader, trustedHeight) suite.Require().NoError(err) diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 91cf13337ae..0a5c04eb082 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -7,6 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/cometbft/cometbft/abci/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" @@ -866,7 +868,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { name string malleate func() expResult func(commitment []byte, err error) - expEvents func(path *ibctesting.Path) map[string]map[string]string + expEvents func(path *ibctesting.Path) []abci.Event }{ { name: "success on ordered channel", @@ -973,19 +975,21 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { suite.Require().True(found) suite.Require().Equal(uint64(1), nextSequenceAck, "sequence incremented for UNORDERED channel") }, - expEvents: func(path *ibctesting.Path) map[string]map[string]string { - return ibctesting.EventsMap{ - types.EventTypeChannelFlushComplete: { - types.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - types.AttributeKeyChannelID: path.EndpointA.ChannelID, - types.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - types.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - types.AttributeKeyChannelState: path.EndpointA.GetChannel().State.String(), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: types.AttributeValueCategory, - }, - } + expEvents: func(path *ibctesting.Path) []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelFlushComplete, + sdk.NewAttribute(types.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(types.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(types.AttributeKeyChannelState, path.EndpointA.GetChannel().State.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }.ToABCIEvents() }, }, { @@ -1339,7 +1343,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { expEvents := tc.expEvents(path) - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + ibctesting.AssertEvents(&suite.Suite, expEvents, events) } }) } diff --git a/modules/core/04-channel/keeper/timeout_test.go b/modules/core/04-channel/keeper/timeout_test.go index b86d1b905c5..44aca2f33ce 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -8,6 +8,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/cometbft/cometbft/abci/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" @@ -247,7 +249,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { msg string malleate func() expResult func(packetCommitment []byte, err error) - expEvents func(path *ibctesting.Path) map[string]map[string]string + expEvents func(path *ibctesting.Path) []abci.Event }{ { "success ORDERED", @@ -333,19 +335,21 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { channel := path.EndpointA.GetChannel() suite.Require().Equal(types.FLUSHCOMPLETE, channel.State, "channel state should still be set to FLUSHCOMPLETE") }, - func(path *ibctesting.Path) map[string]map[string]string { - return ibctesting.EventsMap{ - types.EventTypeChannelFlushComplete: { - types.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - types.AttributeKeyChannelID: path.EndpointA.ChannelID, - types.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - types.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - types.AttributeKeyChannelState: path.EndpointA.GetChannel().State.String(), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: types.AttributeValueCategory, - }, - } + func(path *ibctesting.Path) []abci.Event { + return sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelFlushComplete, + sdk.NewAttribute(types.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(types.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(types.AttributeKeyChannelState, path.EndpointA.GetChannel().State.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }.ToABCIEvents() }, }, { @@ -523,7 +527,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { expEvents := tc.expEvents(path) - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + ibctesting.AssertEvents(&suite.Suite, expEvents, events) } }) } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index b213c22fa13..4ff6133b631 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -936,19 +936,21 @@ func (suite *KeeperTestSuite) TestChannelUpgradeInit() { suite.Require().Equal(uint64(1), res.UpgradeSequence) channel := path.EndpointA.GetChannel() - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeInit: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeInit, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1075,19 +1077,21 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { suite.Require().Equal(channeltypes.FLUSHING, channel.State) suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeTry: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeTry, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1120,22 +1124,23 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { suite.Require().Equal(uint64(99), errorReceipt.Sequence) channel := path.EndpointB.GetChannel() - - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "counterparty upgrade sequence < current upgrade sequence (1 < 99): invalid upgrade sequence", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "counterparty upgrade sequence < current upgrade sequence (1 < 99): invalid upgrade sequence"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1257,19 +1262,21 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { suite.Require().Equal(channeltypes.FLUSHCOMPLETE, channel.State) suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeAck: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeAck, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1289,19 +1296,17 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { suite.Require().Equal(channeltypes.FLUSHING, channel.State) suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeAck: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeAck, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1356,22 +1361,23 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { suite.Require().Equal(uint64(1), errorReceipt.Sequence) channel := path.EndpointB.GetChannel() - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "expected upgrade ordering (ORDER_NONE_UNSPECIFIED) to match counterparty upgrade ordering (ORDER_UNORDERED): incompatible counterparty upgrade", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "expected upgrade ordering (ORDER_NONE_UNSPECIFIED) to match counterparty upgrade ordering (ORDER_UNORDERED): incompatible counterparty upgrade"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1401,22 +1407,23 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { suite.Require().False(store.Has([]byte("foo"))) channel := path.EndpointB.GetChannel() - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "mock app callback failed", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "mock app callback failed"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1547,29 +1554,31 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { suite.Require().Equal(channeltypes.OPEN, channel.State) suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeConfirm: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyChannelState: channeltypes.FLUSHCOMPLETE.String(), - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - channeltypes.EventTypeChannelUpgradeOpen: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyChannelState: channeltypes.OPEN.String(), - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeConfirm, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelState, channeltypes.FLUSHCOMPLETE.String()), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeOpen, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelState, channeltypes.OPEN.String()), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1626,18 +1635,18 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { suite.Require().Equal(channeltypes.FLUSHCOMPLETE, channel.State) suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeConfirm: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyChannelState: channeltypes.FLUSHCOMPLETE.String(), - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - } - - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeConfirm, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelState, channeltypes.FLUSHCOMPLETE.String()), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1655,18 +1664,18 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { suite.Require().Equal(channeltypes.FLUSHING, channel.State) suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeConfirm: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyChannelState: channeltypes.FLUSHING.String(), - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - } - - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeConfirm, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelState, channeltypes.FLUSHING.String()), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1734,22 +1743,23 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { channel := path.EndpointB.GetChannel() - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "counterparty upgrade timeout elapsed: current timestamp: 1578269010000000000, timeout timestamp 1578268995000000000: timeout elapsed", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "counterparty upgrade timeout elapsed: current timestamp: 1578269010000000000, timeout timestamp 1578268995000000000: timeout elapsed"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1845,20 +1855,22 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() { channel := path.EndpointA.GetChannel() suite.Require().Equal(channeltypes.OPEN, channel.State) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeOpen: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyChannelState: channeltypes.OPEN.String(), - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeOpen, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelState, channeltypes.OPEN.String()), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -1888,20 +1900,22 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() { channel := path.EndpointA.GetChannel() suite.Require().Equal(channeltypes.OPEN, channel.State) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeOpen: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyChannelState: channeltypes.OPEN.String(), - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeOpen, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelState, channeltypes.OPEN.String()), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -2028,28 +2042,30 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { // Upgrade sequence should be changed to match sequence on error receipt. suite.Require().Equal(uint64(2), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeCancel: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "invalid upgrade", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeCancel, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "invalid upgrade"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -2072,28 +2088,27 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { // Upgrade sequence should be changed to match initial upgrade sequence. suite.Require().Equal(uint64(3), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeCancel: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeCancel, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "invalid upgrade", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "invalid upgrade"), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -2117,28 +2132,31 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { // Upgrade sequence should be changed to match initial upgrade sequence. suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeCancel: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeCancel, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "invalid upgrade", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "invalid upgrade"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -2162,28 +2180,31 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { // Upgrade sequence should be changed to match initial upgrade sequence. suite.Require().Equal(uint64(1), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeCancel: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeCancel, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "invalid upgrade", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "invalid upgrade"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -2206,28 +2227,32 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { // Upgrade sequence should not be changed. suite.Require().Equal(uint64(2), channel.UpgradeSequence) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeCancel: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeCancel, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "invalid upgrade", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "invalid upgrade"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute( + sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { @@ -2378,30 +2403,34 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTimeout() { // use the timeout we set in the malleate function timeout := channeltypes.NewTimeout(clienttypes.ZeroHeight(), 1) - expEvents := ibctesting.EventsMap{ - channeltypes.EventTypeChannelUpgradeTimeout: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeTimeoutHeight: timeout.Height.String(), - channeltypes.AttributeKeyUpgradeTimeoutTimestamp: fmt.Sprintf("%d", timeout.Timestamp), - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - channeltypes.EventTypeChannelUpgradeError: { - channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID, - channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), + + expEvents := sdk.Events{ + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeTimeout, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeTimeoutHeight, timeout.Height.String()), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeTimeoutTimestamp, fmt.Sprintf("%d", timeout.Timestamp)), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), + ), + sdk.NewEvent( + channeltypes.EventTypeChannelUpgradeError, + sdk.NewAttribute(channeltypes.AttributeKeyPortID, path.EndpointA.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, path.EndpointA.ChannelID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyPortID, path.EndpointB.ChannelConfig.PortID), + sdk.NewAttribute(channeltypes.AttributeCounterpartyChannelID, path.EndpointB.ChannelID), + sdk.NewAttribute(channeltypes.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", channel.UpgradeSequence)), // need to manually insert this because the errorReceipt is a string constant as it is written into state - channeltypes.AttributeKeyErrorReceipt: "upgrade timed-out", - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, - }, - } - ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) + sdk.NewAttribute(channeltypes.AttributeKeyErrorReceipt, "upgrade timed-out"), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, channeltypes.AttributeValueCategory), + ), + }.ToABCIEvents() + ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, { diff --git a/testing/events.go b/testing/events.go index 9ebe7af9c90..96b9063759a 100644 --- a/testing/events.go +++ b/testing/events.go @@ -14,8 +14,6 @@ import ( channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) -type EventsMap map[string]map[string]string - // ParseClientIDFromEvents parses events emitted from a MsgCreateClient and returns the // client identifier. func ParseClientIDFromEvents(events []abci.Event) (string, error) { @@ -167,36 +165,6 @@ func ParseProposalIDFromEvents(events []abci.Event) (uint64, error) { return 0, fmt.Errorf("proposalID event attribute not found") } -// AssertEventsLegacy asserts that expected events are present in the actual events. -// Expected map needs to be a subset of actual events to pass. -func AssertEventsLegacy( - suite *testifysuite.Suite, - expected EventsMap, - actual []abci.Event, -) { - hasEvents := make(map[string]bool) - for eventType := range expected { - hasEvents[eventType] = false - } - - for _, event := range actual { - expEvent, eventFound := expected[event.Type] - if eventFound { - hasEvents[event.Type] = true - suite.Require().Len(event.Attributes, len(expEvent)) - for _, attr := range event.Attributes { - expValue, found := expEvent[attr.Key] - suite.Require().True(found) - suite.Require().Equal(expValue, attr.Value) - } - } - } - - for eventName, hasEvent := range hasEvents { - suite.Require().True(hasEvent, "event: %s was not found in events", eventName) - } -} - // AssertEvents asserts that expected events are present in the actual events. func AssertEvents( suite *testifysuite.Suite,