Skip to content

Commit

Permalink
fix: tests and interface signature
Browse files Browse the repository at this point in the history
  • Loading branch information
technicallyty committed Nov 12, 2021
1 parent fd69c7a commit ae5b01e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions modules/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ func (suite KeeperTestSuite) TestGetConsensusState() {

for i, tc := range cases {
tc := tc
cs, found := suite.keeper.GetSelfConsensusState(suite.ctx, tc.height)
cs, err := suite.keeper.GetSelfConsensusState(suite.ctx, tc.height)
if tc.expPass {
suite.Require().True(found, "Case %d should have passed: %s", i, tc.name)
suite.Require().NoError(err, "Case %d should have passed: %s", i, tc.name)
suite.Require().NotNil(cs, "Case %d should have passed: %s", i, tc.name)
} else {
suite.Require().False(found, "Case %d should have failed: %s", i, tc.name)
suite.Require().Error(err, "Case %d should have failed: %s", i, tc.name)
suite.Require().Nil(cs, "Case %d should have failed: %s", i, tc.name)
}
}
Expand Down
12 changes: 6 additions & 6 deletions modules/core/03-connection/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ func (k Keeper) ConnOpenTry(
return "", err
}

expectedConsensusState, found := k.clientKeeper.GetSelfConsensusState(ctx, consensusHeight)
if !found {
return "", sdkerrors.Wrap(clienttypes.ErrSelfConsensusStateNotFound, consensusHeight.String())
expectedConsensusState, err := k.clientKeeper.GetSelfConsensusState(ctx, consensusHeight)
if err != nil{
return "", clienttypes.ErrSelfConsensusStateNotFound.Wrapf(err.Error(), consensusHeight.String())
}

// expectedConnection defines Chain A's ConnectionEnd
Expand Down Expand Up @@ -250,9 +250,9 @@ func (k Keeper) ConnOpenAck(
}

// Retrieve chainA's consensus state at consensusheight
expectedConsensusState, found := k.clientKeeper.GetSelfConsensusState(ctx, consensusHeight)
if !found {
return clienttypes.ErrSelfConsensusStateNotFound
expectedConsensusState, err := k.clientKeeper.GetSelfConsensusState(ctx, consensusHeight)
if err != nil {
return clienttypes.ErrSelfConsensusStateNotFound.Wrap(err.Error())
}

prefix := k.GetCommitmentPrefix()
Expand Down
6 changes: 3 additions & 3 deletions modules/core/03-connection/keeper/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() {

proof, consensusHeight := suite.chainB.QueryConsensusStateProof(path.EndpointB.ClientID)
proofHeight := clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()-1))
consensusState, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetSelfConsensusState(suite.chainA.GetContext(), consensusHeight)
suite.Require().True(found)
consensusState, err := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetSelfConsensusState(suite.chainA.GetContext(), consensusHeight)
suite.Require().NoError(err)

err := suite.chainA.App.GetIBCKeeper().ConnectionKeeper.VerifyClientConsensusState(
err = suite.chainA.App.GetIBCKeeper().ConnectionKeeper.VerifyClientConsensusState(
suite.chainA.GetContext(), connection,
malleateHeight(proofHeight, heightDiff), consensusHeight, proof, consensusState,
)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/03-connection/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
type ClientKeeper interface {
GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool)
GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, bool)
GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, error)
ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error
IterateClients(ctx sdk.Context, cb func(string, exported.ClientState) bool)
ClientStore(ctx sdk.Context, clientID string) sdk.KVStore
Expand Down

0 comments on commit ae5b01e

Please sign in to comment.