Skip to content

Commit

Permalink
update test acrroding
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdv2429 committed Mar 27, 2024
1 parent b5840a0 commit ced7b32
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions modules/core/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeInit() {
suite.Require().NoError(err)
suite.Require().NotNil(res)
suite.Require().Equal(uint64(1), res.UpgradeSequence)

upgrade := path.EndpointA.GetChannelUpgrade()
channel := path.EndpointA.GetChannel()

expEvents := ibctesting.EventsMap{
Expand All @@ -942,9 +940,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeInit() {
channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID,
channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID,
channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID,
channeltypes.AttributeKeyConnectionHops: upgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: upgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: upgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
sdk.EventTypeMessage: {
Expand Down Expand Up @@ -1078,17 +1073,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() {
suite.Require().Equal(channeltypes.FLUSHING, channel.State)
suite.Require().Equal(uint64(1), channel.UpgradeSequence)

upgrade := path.EndpointB.GetChannelUpgrade()

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.AttributeKeyConnectionHops: upgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: upgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: upgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
sdk.EventTypeMessage: {
Expand Down Expand Up @@ -1265,17 +1255,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() {
suite.Require().Equal(channeltypes.FLUSHCOMPLETE, channel.State)
suite.Require().Equal(uint64(1), channel.UpgradeSequence)

upgrade := path.EndpointA.GetChannelUpgrade()

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.AttributeKeyConnectionHops: upgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: upgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: upgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
sdk.EventTypeMessage: {
Expand All @@ -1302,17 +1287,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() {
suite.Require().Equal(channeltypes.FLUSHING, channel.State)
suite.Require().Equal(uint64(1), channel.UpgradeSequence)

upgrade := path.EndpointA.GetChannelUpgrade()

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.AttributeKeyConnectionHops: upgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: upgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: upgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
sdk.EventTypeMessage: {
Expand Down Expand Up @@ -1580,9 +1560,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() {
channeltypes.AttributeCounterpartyPortID: path.EndpointA.ChannelConfig.PortID,
channeltypes.AttributeCounterpartyChannelID: path.EndpointA.ChannelID,
channeltypes.AttributeKeyChannelState: channeltypes.OPEN.String(),
channeltypes.AttributeKeyConnectionHops: channel.ConnectionHops[0],
channeltypes.AttributeKeyVersion: channel.Version,
channeltypes.AttributeKeyOrdering: channel.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
sdk.EventTypeMessage: {
Expand Down Expand Up @@ -1873,9 +1850,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() {
channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID,
channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID,
channeltypes.AttributeKeyChannelState: channeltypes.OPEN.String(),
channeltypes.AttributeKeyConnectionHops: channel.ConnectionHops[0],
channeltypes.AttributeKeyVersion: channel.Version,
channeltypes.AttributeKeyOrdering: channel.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
sdk.EventTypeMessage: {
Expand Down Expand Up @@ -1919,9 +1893,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() {
channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID,
channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID,
channeltypes.AttributeKeyChannelState: channeltypes.OPEN.String(),
channeltypes.AttributeKeyConnectionHops: channel.ConnectionHops[0],
channeltypes.AttributeKeyVersion: channel.Version,
channeltypes.AttributeKeyOrdering: channel.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
sdk.EventTypeMessage: {
Expand Down Expand Up @@ -2055,17 +2026,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() {
// Upgrade sequence should be changed to match sequence on error receipt.
suite.Require().Equal(uint64(2), channel.UpgradeSequence)

// we need to find the event values from the proposed upgrade as the actual upgrade has been deleted.
proposedUpgrade := path.EndpointA.GetProposedUpgrade()
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.AttributeKeyConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
channeltypes.EventTypeChannelUpgradeError: {
Expand Down Expand Up @@ -2104,17 +2070,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() {
// Upgrade sequence should be changed to match initial upgrade sequence.
suite.Require().Equal(uint64(3), channel.UpgradeSequence)

// we need to find the event values from the proposed upgrade as the actual upgrade has been deleted.
proposedUpgrade := path.EndpointA.GetProposedUpgrade()
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.AttributeKeyConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
channeltypes.EventTypeChannelUpgradeError: {
Expand Down Expand Up @@ -2154,17 +2115,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() {
// Upgrade sequence should be changed to match initial upgrade sequence.
suite.Require().Equal(uint64(1), channel.UpgradeSequence)

// we need to find the event values from the proposed upgrade as the actual upgrade has been deleted.
proposedUpgrade := path.EndpointA.GetProposedUpgrade()
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.AttributeKeyConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
channeltypes.EventTypeChannelUpgradeError: {
Expand Down Expand Up @@ -2204,17 +2160,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() {
// Upgrade sequence should be changed to match initial upgrade sequence.
suite.Require().Equal(uint64(1), channel.UpgradeSequence)

// we need to find the event values from the proposed upgrade as the actual upgrade has been deleted.
proposedUpgrade := path.EndpointA.GetProposedUpgrade()
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.AttributeKeyConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
channeltypes.EventTypeChannelUpgradeError: {
Expand Down Expand Up @@ -2253,17 +2204,12 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() {
// Upgrade sequence should not be changed.
suite.Require().Equal(uint64(2), channel.UpgradeSequence)

// we need to find the event values from the proposed upgrade as the actual upgrade has been deleted.
proposedUpgrade := path.EndpointA.GetProposedUpgrade()
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.AttributeKeyConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
channeltypes.EventTypeChannelUpgradeError: {
Expand Down Expand Up @@ -2428,8 +2374,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTimeout() {
suite.Require().True(found)
suite.Require().Equal(uint64(1), errorReceipt.Sequence)

// we need to find the event values from the proposed upgrade as the actual upgrade has been deleted.
proposedUpgrade := path.EndpointA.GetProposedUpgrade()
// use the timeout we set in the malleate function
timeout := channeltypes.NewTimeout(clienttypes.ZeroHeight(), 1)
expEvents := ibctesting.EventsMap{
Expand All @@ -2438,9 +2382,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTimeout() {
channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID,
channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID,
channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID,
channeltypes.AttributeKeyConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeTimeoutHeight: timeout.Height.String(),
channeltypes.AttributeKeyUpgradeTimeoutTimestamp: fmt.Sprintf("%d", timeout.Timestamp),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
Expand Down

0 comments on commit ced7b32

Please sign in to comment.