-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure latest height revision number matches chain id revision number #241
Changes from 3 commits
a1d5b33
08b9af4
84e341f
49bfa8a
53ad6f4
2d070b6
1be3f11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,8 +122,14 @@ func (cs ClientState) Validate() error { | |
if cs.MaxClockDrift == 0 { | ||
return sdkerrors.Wrap(ErrInvalidMaxClockDrift, "max clock drift cannot be zero") | ||
} | ||
|
||
// the latest height revision number must match the chain id revision number | ||
if cs.LatestHeight.RevisionNumber != clienttypes.ParseChainID(cs.ChainId) { | ||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, | ||
"latest height revision number must match chain id revision number (%d != %d)", cs.LatestHeight.RevisionNumber, clienttypes.ParseChainID(cs.ChainId)) | ||
} | ||
if cs.LatestHeight.RevisionHeight == 0 { | ||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "tendermint revision height cannot be zero") | ||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "latest height revision height cannot be zero") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say this should remain. No tendermint height should start at 0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can add back the tendermint part but the latest height makes things more specific since the frozen height also contains a revision height |
||
} | ||
if cs.TrustingPeriod >= cs.UnbondingPeriod { | ||
return sdkerrors.Wrapf( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you create the variable for these tests as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, there was only 2 of them so didn't feel as necessary