Skip to content

Commit

Permalink
chore: address linter findings in 07-tendermint (#6136)
Browse files Browse the repository at this point in the history
* Address linting issues in various modules.

* Fixed missing return

* Linting issues in 09-localhost.

* Update modules/light-clients/06-solomachine/store.go

Co-authored-by: DimitrisJim <[email protected]>

* Add newlines before return.

* Address lint issues in 07-tendermint

* Address more linter issues in 07-tendermint.

* Revert changes included in different PR

* Revert changes included in different PR.

* Revert changes.

* Revert changes.

---------

Co-authored-by: DimitrisJim <[email protected]>
Co-authored-by: Charly <[email protected]>
Co-authored-by: Damian Nolan <[email protected]>
  • Loading branch information
4 people authored Apr 15, 2024
1 parent 11a750b commit 89fdb1e
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 108 deletions.
4 changes: 3 additions & 1 deletion modules/light-clients/07-tendermint/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func (suite *TendermintTestSuite) TestHeaderValidateBasic() {
header.SignedHeader.Commit = nil
}, false},
{"trusted height is equal to header height", func() {
header.TrustedHeight = header.GetHeight().(clienttypes.Height)
var ok bool
header.TrustedHeight, ok = header.GetHeight().(clienttypes.Height)
suite.Require().True(ok)
}, false},
{"validator set nil", func() {
header.ValidatorSet = nil
Expand Down
12 changes: 8 additions & 4 deletions modules/light-clients/07-tendermint/light_client_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ func (suite *TendermintTestSuite) TestRecoverClient() {

// assert that status of subject client is now Active
clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, subjectClientID)
tmClientState := subjectPath.EndpointA.GetClientState().(*ibctm.ClientState)
tmClientState, ok := subjectPath.EndpointA.GetClientState().(*ibctm.ClientState)
suite.Require().True(ok)
suite.Require().Equal(exported.Active, tmClientState.Status(ctx, clientStore, suite.chainA.App.AppCodec()))
} else {
suite.Require().Error(err)
Expand Down Expand Up @@ -435,12 +436,14 @@ func (suite *TendermintTestSuite) TestVerifyUpgradeAndUpdateState() {
suite.Require().NoError(err)

// change upgraded client state height to be lower than current client state height
tmClient := upgradedClientState.(*ibctm.ClientState)
tmClient, ok := upgradedClientState.(*ibctm.ClientState)
suite.Require().True(ok)

newLatestheight, ok := path.EndpointA.GetClientLatestHeight().Decrement()
suite.Require().True(ok)

tmClient.LatestHeight = newLatestheight.(clienttypes.Height)
tmClient.LatestHeight, ok = newLatestheight.(clienttypes.Height)
suite.Require().True(ok)
upgradedClientStateAny, err = codectypes.NewAnyWithValue(tmClient)
suite.Require().NoError(err)

Expand All @@ -464,7 +467,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgradeAndUpdateState() {
path.SetupClients()

clientID = path.EndpointA.ClientID
clientState := path.EndpointA.GetClientState().(*ibctm.ClientState)
clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
suite.Require().True(ok)
revisionNumber := clienttypes.ParseChainID(clientState.ChainId)

newUnbondindPeriod := ubdPeriod + trustingPeriod
Expand Down
Loading

0 comments on commit 89fdb1e

Please sign in to comment.