Skip to content

Commit

Permalink
chore(tests): add case for latest height err case. (#7212)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Aug 27, 2024
1 parent 8a324c2 commit d98549b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/core/packet-server/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v9/modules/core/24-host"
"github.com/cosmos/ibc-go/v9/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v9/testing"
"github.com/cosmos/ibc-go/v9/testing/mock"
)
Expand Down Expand Up @@ -85,6 +86,21 @@ func (suite *KeeperTestSuite) TestSendPacket() {
},
clienttypes.ErrClientNotActive,
},
{
"client state zero height", func() {
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(), path.EndpointA.ClientID, cs)
},
clienttypes.ErrInvalidHeight,
},
{
"timeout elapsed", func() {
packet.TimeoutTimestamp = 1
Expand Down

0 comments on commit d98549b

Please sign in to comment.