diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 0e4b9e423c7..1ab1619f1cb 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -407,9 +407,9 @@ func (k Keeper) GetClientStatus(ctx sdk.Context, clientID string) exported.Statu return clientModule.Status(ctx, clientID) } -// GetLatestHeight returns the latest height of a client state for a given client identifier. If the client type is not in the allowed +// GetClientLatestHeight returns the latest height of a client state for a given client identifier. If the client type is not in the allowed // clients param field, a zero value height is returned, otherwise the client state latest height is returned. -func (k Keeper) GetLatestHeight(ctx sdk.Context, clientID string) types.Height { +func (k Keeper) GetClientLatestHeight(ctx sdk.Context, clientID string) types.Height { clientType, _, err := types.ParseClientIdentifier(clientID) if err != nil { return types.ZeroHeight() @@ -427,8 +427,8 @@ func (k Keeper) GetLatestHeight(ctx sdk.Context, clientID string) types.Height { return clientModule.LatestHeight(ctx, clientID).(types.Height) } -// GetTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height. -func (k Keeper) GetTimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) { +// GetClientTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height. +func (k Keeper) GetClientTimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) { clientType, _, err := types.ParseClientIdentifier(clientID) if err != nil { return 0, errorsmod.Wrapf(err, "clientID (%s)", clientID) diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 95bcd0b83bd..fd120c12b54 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -341,7 +341,7 @@ func (suite *KeeperTestSuite) TestIterateClientStates() { } } -func (suite *KeeperTestSuite) TestGetLatestHeight() { +func (suite *KeeperTestSuite) TestGetClientLatestHeight() { var path *ibctesting.Path cases := []struct { @@ -385,7 +385,7 @@ func (suite *KeeperTestSuite) TestGetLatestHeight() { tc.malleate() - height := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetLatestHeight(suite.chainA.GetContext(), path.EndpointA.ClientID) + height := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientLatestHeight(suite.chainA.GetContext(), path.EndpointA.ClientID) if tc.expPass { suite.Require().Equal(suite.chainB.LatestCommittedHeader.GetHeight().(types.Height), height) @@ -457,7 +457,7 @@ func (suite *KeeperTestSuite) TestGetTimestampAtHeight() { tc.malleate() - actualTimestamp, err := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetTimestampAtHeight(suite.chainA.GetContext(), path.EndpointA.ClientID, height) + actualTimestamp, err := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientTimestampAtHeight(suite.chainA.GetContext(), path.EndpointA.ClientID, height) expPass := tc.expError == nil if expPass { diff --git a/modules/core/04-channel/keeper/packet.go b/modules/core/04-channel/keeper/packet.go index e0fea9b3921..c7d12d6dfe7 100644 --- a/modules/core/04-channel/keeper/packet.go +++ b/modules/core/04-channel/keeper/packet.go @@ -68,8 +68,8 @@ func (k Keeper) SendPacket( return 0, errorsmod.Wrapf(clienttypes.ErrClientNotActive, "cannot send packet using client (%s) with status %s", connectionEnd.ClientId, status) } - latestHeight := k.clientKeeper.GetLatestHeight(ctx, connectionEnd.ClientId) - latestTimestamp, err := k.clientKeeper.GetTimestampAtHeight(ctx, connectionEnd.ClientId, latestHeight) + latestHeight := k.clientKeeper.GetClientLatestHeight(ctx, connectionEnd.ClientId) + latestTimestamp, err := k.clientKeeper.GetClientTimestampAtHeight(ctx, connectionEnd.ClientId, latestHeight) if err != nil { return 0, err } diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 4ab703036e7..0791dfdd39c 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -158,7 +158,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { sourceChannel = path.EndpointA.ChannelID connection := path.EndpointA.GetConnection() - timestamp, err := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetTimestampAtHeight(suite.chainA.GetContext(), connection.ClientId, path.EndpointA.GetClientLatestHeight()) + timestamp, err := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientTimestampAtHeight(suite.chainA.GetContext(), connection.ClientId, path.EndpointA.GetClientLatestHeight()) suite.Require().NoError(err) timeoutHeight = disabledTimeoutHeight @@ -175,7 +175,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { path.EndpointA.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { c.ClientId = path.EndpointA.ClientID }) connection := path.EndpointA.GetConnection() - timestamp, err := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetTimestampAtHeight(suite.chainA.GetContext(), connection.ClientId, path.EndpointA.GetClientLatestHeight()) + timestamp, err := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientTimestampAtHeight(suite.chainA.GetContext(), connection.ClientId, path.EndpointA.GetClientLatestHeight()) suite.Require().NoError(err) sourceChannel = path.EndpointA.ChannelID diff --git a/modules/core/04-channel/keeper/timeout.go b/modules/core/04-channel/keeper/timeout.go index b5d8b57465a..ed83e25b13a 100644 --- a/modules/core/04-channel/keeper/timeout.go +++ b/modules/core/04-channel/keeper/timeout.go @@ -63,7 +63,7 @@ func (k Keeper) TimeoutPacket( } // check that timeout height or timeout timestamp has passed on the other end - proofTimestamp, err := k.clientKeeper.GetTimestampAtHeight(ctx, connectionEnd.ClientId, proofHeight) + proofTimestamp, err := k.clientKeeper.GetClientTimestampAtHeight(ctx, connectionEnd.ClientId, proofHeight) if err != nil { return err } diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index 7039784dd0f..51f114dd457 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -745,7 +745,7 @@ func (k Keeper) ChanUpgradeTimeout( return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connection.State) } - proofTimestamp, err := k.clientKeeper.GetTimestampAtHeight(ctx, connection.ClientId, proofHeight) + proofTimestamp, err := k.clientKeeper.GetClientTimestampAtHeight(ctx, connection.ClientId, proofHeight) if err != nil { return err } diff --git a/modules/core/04-channel/types/expected_keepers.go b/modules/core/04-channel/types/expected_keepers.go index 2d2fd8b7e65..625381e475a 100644 --- a/modules/core/04-channel/types/expected_keepers.go +++ b/modules/core/04-channel/types/expected_keepers.go @@ -14,8 +14,8 @@ type ClientKeeper interface { GetClientStatus(ctx sdk.Context, clientID string) exported.Status GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) - GetLatestHeight(ctx sdk.Context, clientID string) clienttypes.Height - GetTimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) + GetClientLatestHeight(ctx sdk.Context, clientID string) clienttypes.Height + GetClientTimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) } // ConnectionKeeper expected account IBC connection keeper diff --git a/testing/chain.go b/testing/chain.go index f48dd0156d4..5b59e78fe40 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -614,7 +614,7 @@ func (chain *TestChain) GetChannelCapability(portID, channelID string) *capabili // GetClientLatestHeight returns the latest height for the client state with the given client identifier. // If an invalid client identifier is provided then a zero value height will be returned and testing wil fail. func (chain *TestChain) GetClientLatestHeight(clientID string) exported.Height { - latestHeight := chain.App.GetIBCKeeper().ClientKeeper.GetLatestHeight(chain.GetContext(), clientID) + latestHeight := chain.App.GetIBCKeeper().ClientKeeper.GetClientLatestHeight(chain.GetContext(), clientID) require.False(chain.TB, latestHeight.IsZero()) return latestHeight }