-
Notifications
You must be signed in to change notification settings - Fork 158
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
fix!: add check for the height of evidence #2007
Conversation
WalkthroughThe recent changes introduce validation checks for equivocation evidence in the ICS consumer module to improve overall correctness and robustness. Enhancements include adding missing minimum height checks for evidence, updating related tests for better coverage, and ensuring proper validation and error handling during evidence processing and misbehavior checks. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
.changelog/v4.3.0/bug-fixes/provider/xxx-evidence-min-height-filter
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 2
@@ -4,6 +4,7 @@ import ( | |||
"bytes" | |||
"encoding/binary" | |||
"fmt" | |||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" |
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.
Sort imports according to the Uber Golang style guide.
The imports should be sorted according to the Uber Golang style guide.
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/cosmos/cosmos-sdk/types/errors"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | |
"github.com/cosmos/cosmos-sdk/types/errors" |
Tools
golangci-lint
7-7: File is not
gci
-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos/interchain-security) --custom-order(gci)
// the misbehaviour is for a light client attack and not a time violation, | ||
// see ibc-go/modules/light-clients/07-tendermint/types/misbehaviour_handle.go | ||
if !misbehaviour.Header1.GetHeight().EQ(misbehaviour.Header2.GetHeight()) { | ||
return sdkerrors.Wrap(ibcclienttypes.ErrInvalidMisbehaviour, "headers are not at same height") |
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.
Replace deprecated sdkerrors.Wrap.
sdkerrors.Wrap
is deprecated. Use errorsmod.Wrap
instead.
- return sdkerrors.Wrap(ibcclienttypes.ErrInvalidMisbehaviour, "headers are not at same height")
+ return errorsmod.Wrap(ibcclienttypes.ErrInvalidMisbehaviour, "headers are not at same height")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
return sdkerrors.Wrap(ibcclienttypes.ErrInvalidMisbehaviour, "headers are not at same height") | |
return errorsmod.Wrap(ibcclienttypes.ErrInvalidMisbehaviour, "headers are not at same height") |
Tools
golangci-lint
314-314: SA1019: sdkerrors.Wrap is deprecated: functionality of this package has been moved to it's own module:
(staticcheck)
* init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry * update changelog entries --------- Co-authored-by: insumity <[email protected]>
* init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry --------- Co-authored-by: insumity <[email protected]> (cherry picked from commit de9db96)
* init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry --------- Co-authored-by: insumity <[email protected]> (cherry picked from commit de9db96)
fix!: add check for the height of evidence (#2007) * init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry --------- Co-authored-by: insumity <[email protected]> (cherry picked from commit de9db96) Co-authored-by: Simon Noetzlin <[email protected]>
fix!: add check for the height of evidence (#2007) * init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry --------- Co-authored-by: insumity <[email protected]> (cherry picked from commit de9db96) Co-authored-by: Simon Noetzlin <[email protected]>
* init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry * update changelog entries --------- Co-authored-by: insumity <[email protected]>
* chore!: prepare changelog for v4.2.1 release * update changelog * revert changelog v4.2.0 removal * fix changes * update changelog * clean unreleased folder * fix!: add check for min height of evidence (backport #2007) (#2008) * init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry * update changelog entries --------- Co-authored-by: insumity <[email protected]> --------- Co-authored-by: insumity <[email protected]>
* init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry --------- Co-authored-by: insumity <[email protected]> (cherry picked from commit de9db96)
* fix!: add check for the height of evidence (#2007) * init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry --------- Co-authored-by: insumity <[email protected]> (cherry picked from commit de9db96) * fix errors from merge * add fix entry to changelog * fix changelog entry * fix changelog 2 --------- Co-authored-by: Simon Noetzlin <[email protected]>
* init commit * added check, setting, and deleting of the equivocation min height * update changelog entry * remove unwwanted changelog entry --------- Co-authored-by: insumity <[email protected]>
Please go to the
Preview
tab and select the appropriate sub-template:fix
,feat
, andrefactor
.Summary by CodeRabbit
Bug Fixes
Tests
New Features