Skip to content

Commit

Permalink
test: adding testcase for SendPacket client zero height
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Apr 10, 2024
1 parent aa9a5b1 commit 1f9d5b3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions modules/core/04-channel/keeper/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,24 @@ func (suite *KeeperTestSuite) TestSendPacket() {

channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)
}, false},
{"client state zero height", func() {
path.Setup()
sourceChannel = path.EndpointA.ChannelID

connection := path.EndpointA.GetConnection()
clientState := path.EndpointA.GetClientState()
cs, ok := clientState.(*ibctm.ClientState)
suite.Require().True(ok)

// force a consensus state into the store at height zero to allow client status check to pass.
consensusState := path.EndpointA.GetConsensusState(cs.LatestHeight)
path.EndpointA.SetConsensusState(consensusState, clienttypes.ZeroHeight())

cs.LatestHeight = clienttypes.ZeroHeight()
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), connection.ClientId, cs)

channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)
}, false},
{"timeout height passed", func() {
path.Setup()
sourceChannel = path.EndpointA.ChannelID
Expand Down

0 comments on commit 1f9d5b3

Please sign in to comment.