From 97963c71dfe58e56e57f20ec2efe154a9c5ca787 Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Thu, 5 Nov 2020 14:46:00 +0100 Subject: [PATCH] ibc: remove GetClientConsensusStateLTE (#7812) --- x/ibc/core/02-client/keeper/keeper.go | 16 ---------------- x/ibc/core/02-client/keeper/keeper_test.go | 5 ----- 2 files changed, 21 deletions(-) diff --git a/x/ibc/core/02-client/keeper/keeper.go b/x/ibc/core/02-client/keeper/keeper.go index 68220db8a..8af73dd75 100644 --- a/x/ibc/core/02-client/keeper/keeper.go +++ b/x/ibc/core/02-client/keeper/keeper.go @@ -156,22 +156,6 @@ func (k Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string) return k.GetClientConsensusState(ctx, clientID, clientState.GetLatestHeight()) } -// GetClientConsensusStateLTE will get the latest ConsensusState of a particular client at the latest height -// less than or equal to the given height -// It will only search for heights within the same version -func (k Keeper) GetClientConsensusStateLTE(ctx sdk.Context, clientID string, maxHeight exported.Height) (exported.ConsensusState, bool) { - h := maxHeight - ok := true - for ok { - found := k.HasClientConsensusState(ctx, clientID, h) - if found { - return k.GetClientConsensusState(ctx, clientID, h) - } - h, ok = h.Decrement() - } - return nil, false -} - // GetSelfConsensusState introspects the (self) past historical info at a given height // and returns the expected consensus state at that height. // For now, can only retrieve self consensus states for the current version diff --git a/x/ibc/core/02-client/keeper/keeper_test.go b/x/ibc/core/02-client/keeper/keeper_test.go index 11db64a4d..24675f4e9 100644 --- a/x/ibc/core/02-client/keeper/keeper_test.go +++ b/x/ibc/core/02-client/keeper/keeper_test.go @@ -340,11 +340,6 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() { latest, ok := suite.keeper.GetLatestClientConsensusState(suite.ctx, testClientID) suite.Require().True(ok) suite.Require().Equal(nextState, latest, "Latest client not returned correctly") - - // Should return existing consensusState at latestClientHeight - lte, ok := suite.keeper.GetClientConsensusStateLTE(suite.ctx, testClientID, types.NewHeight(0, height+3)) - suite.Require().True(ok) - suite.Require().Equal(suite.consensusState, lte, "LTE helper function did not return latest client state below height: %d", height+3) } // 2 clients in total are created on chainA. The first client is updated so it contains an initial consensus state