self height uses GTE in self client check (#7945)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
f962f3a28c
commit
e93b18e60e
@ -220,9 +220,9 @@ func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientS
|
||||
}
|
||||
|
||||
selfHeight := types.NewHeight(version, uint64(ctx.BlockHeight()))
|
||||
if tmClient.LatestHeight.GT(selfHeight) {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client has LatestHeight %d greater than chain height %d",
|
||||
tmClient.LatestHeight, ctx.BlockHeight())
|
||||
if tmClient.LatestHeight.GTE(selfHeight) {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client has LatestHeight %d greater than or equal to chain height %d",
|
||||
tmClient.LatestHeight, selfHeight)
|
||||
}
|
||||
|
||||
expectedProofSpecs := commitmenttypes.GetSDKSpecs()
|
||||
|
||||
@ -152,7 +152,7 @@ func (suite *KeeperTestSuite) TestSetClientConsensusState() {
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
testClientHeight := types.NewHeight(0, uint64(suite.chainA.GetContext().BlockHeight()))
|
||||
testClientHeight := types.NewHeight(0, uint64(suite.chainA.GetContext().BlockHeight()-1))
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
@ -186,7 +186,7 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
},
|
||||
{
|
||||
"invalid client height",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.NewHeight(0, testClientHeight.VersionHeight+10), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.NewHeight(0, uint64(suite.chainA.GetContext().BlockHeight())), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user