Skip to content

Commit 2b9e9af

Browse files
timlindmergify-bot
authored and
mergify-bot
committed
fix: classify client states without consensus states as expired (#941)
## Description closes: #850 --- Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing) - [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`) - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). - [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [ ] Re-reviewed `Files changed` in the Github PR explorer - [ ] Review `Codecov Report` in the comment section below once CI passes (cherry picked from commit d48f576)
1 parent 32c935e commit 2b9e9af

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

modules/core/02-client/keeper/grpc_query_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func (suite *KeeperTestSuite) TestQueryClientStatus() {
452452
ClientId: path.EndpointA.ClientID,
453453
}
454454
},
455-
true, exported.Unknown.String(),
455+
true, exported.Expired.String(),
456456
},
457457
{
458458
"Frozen client status",

modules/light-clients/07-tendermint/types/client_state.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ func (cs ClientState) Status(
7878
// get latest consensus state from clientStore to check for expiry
7979
consState, err := GetConsensusState(clientStore, cdc, cs.GetLatestHeight())
8080
if err != nil {
81-
return exported.Unknown
81+
// if the client state does not have an associated consensus state for its latest height
82+
// then it must be expired
83+
return exported.Expired
8284
}
8385

8486
if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) {

modules/light-clients/07-tendermint/types/client_state_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ func (suite *TendermintTestSuite) TestStatus() {
4747
clientState.FrozenHeight = clienttypes.NewHeight(0, 1)
4848
path.EndpointA.SetClientState(clientState)
4949
}, exported.Frozen},
50-
{"client status is unknown", func() {
50+
{"client status without consensus state", func() {
5151
clientState.LatestHeight = clientState.LatestHeight.Increment().(clienttypes.Height)
5252
path.EndpointA.SetClientState(clientState)
53-
}, exported.Unknown},
53+
}, exported.Expired},
5454
{"client status is expired", func() {
5555
suite.coordinator.IncrementTimeBy(clientState.TrustingPeriod)
5656
}, exported.Expired},

0 commit comments

Comments
 (0)