-
Notifications
You must be signed in to change notification settings - Fork 134
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!: improve message validation #1460
Conversation
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.
LGTM in general.
Made some nitpick comments
return errorsmod.Wrap(ErrInvalidPacketData, "validator fields cannot be empty") | ||
func (vdt SlashPacketData) Validate() error { | ||
// vdt.Validator.Address must be a consensus address | ||
if err := sdk.VerifyAddressFormat(vdt.Validator.Address); err != nil { |
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.
if err := sdk.VerifyAddressFormat(vdt.Validator.Address); err != nil { | |
if err := sdk.ConsAddressFromBech32(string(vdt.Validator.Address)); err != nil { |
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.
This doesn't work :(
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.
Sorry, the updated suggestion should work!
Forget the suggestion.
Co-authored-by: Simon Noetzlin <[email protected]>
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.
LGTM. Great work!
Let's address the MsgSubmitConsumerDoubleVoting
validation in another PR.
* validate ValidatorSetChangePacketData * update ValidateBasic for ValidatorSetChangePacketData * update ConsumerPacketData validation * fix TestConsumerPacketSendExpiredClient * update TestOnRecvSlashPacketErrors * fix TestQueueAndSendSlashPacket * remove TODO * nit: validate MsgAssignConsumerKey * add changelog entries * fix linter * fix gosec * rename ValidateBasic to Validate (IBC packets) * Update x/ccv/types/wire.go Co-authored-by: Simon Noetzlin <[email protected]> * revert SlashPacketData address validation --------- Co-authored-by: Simon Noetzlin <[email protected]>
Description
Closes: #1370, #634
OnRecvPacket
keeper methods to return an error instead of an IBC ack.EDIT: validation of
MsgSubmitConsumerDoubleVoting
will be added in a following PRAuthor Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if state-machine breaking change (i.e., requires coordinated upgrade)CHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change