Skip to content

Commit

Permalink
chore: update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-axner committed Nov 21, 2022
1 parent 4399a42 commit 78fd0a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions modules/light-clients/07-tendermint/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

"github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
)
Expand Down Expand Up @@ -53,7 +53,7 @@ func PruneTendermintConsensusStates(ctx sdk.Context, cdc codec.BinaryCodec, stor

bz := clientStore.Get(host.ClientStateKey())
if bz == nil {
return types.ErrClientNotFound
return clienttypes.ErrClientNotFound
}

var clientState exported.ClientState
Expand All @@ -63,13 +63,13 @@ func PruneTendermintConsensusStates(ctx sdk.Context, cdc codec.BinaryCodec, stor

tmClientState, ok := clientState.(*ClientState)
if !ok {
return sdkerrors.Wrap(types.ErrInvalidClient, "client state is not tendermint even though client id contains 07-tendermint")
return sdkerrors.Wrap(clienttypes.ErrInvalidClient, "client state is not tendermint even though client id contains 07-tendermint")
}

totalPruned += PruneAllExpiredConsensusStates(ctx, clientStore, cdc, tmClientState)
}

clientLogger := ctx.Logger().With("module", "x/"+host.ModuleName+"/"+types.SubModuleName)
clientLogger := ctx.Logger().With("module", "x/"+host.ModuleName+"/"+clienttypes.SubModuleName)
clientLogger.Info("pruned expired tendermint consensus states", "total", totalPruned)

return nil
Expand Down
9 changes: 4 additions & 5 deletions modules/light-clients/07-tendermint/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package tendermint_test
import (
"time"

"github.com/cosmos/ibc-go/v6/modules/core/02-client/migrations"
"github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
Expand Down Expand Up @@ -37,7 +36,7 @@ func (suite *TendermintTestSuite) TestPruneTendermintConsensusStates() {

bz, err = suite.chainA.App.AppCodec().MarshalInterface(solomachine.ConsensusState())
suite.Require().NoError(err)
smHeight := types.NewHeight(0, 1)
smHeight := clienttypes.NewHeight(0, 1)
smClientStore.Set(host.ConsensusStateKey(smHeight), bz)

pruneHeightMap := make(map[*ibctesting.Path][]exported.Height)
Expand Down Expand Up @@ -100,7 +99,7 @@ func (suite *TendermintTestSuite) TestPruneTendermintConsensusStates() {
// This will cause the consensus states created before the first time increment
// to be expired
suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour)
err = migrations.PruneTendermintConsensusStates(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().GetKey(host.StoreKey))
err = ibctm.PruneTendermintConsensusStates(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().GetKey(host.StoreKey))
suite.Require().NoError(err)

for _, path := range paths {
Expand Down Expand Up @@ -137,7 +136,7 @@ func (suite *TendermintTestSuite) TestPruneTendermintConsensusStates() {

processedHeight, ok := ibctm.GetProcessedHeight(clientStore, height)
suite.Require().True(ok)
suite.Require().NotEqual(types.ZeroHeight(), processedHeight)
suite.Require().NotEqual(clienttypes.ZeroHeight(), processedHeight)

consKey := ibctm.GetIterationKey(clientStore, height)
suite.Require().Equal(host.ConsensusStateKey(height), consKey)
Expand Down

0 comments on commit 78fd0a3

Please sign in to comment.