-
Notifications
You must be signed in to change notification settings - Fork 586
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
imp: check length of slices of messages #6256
Conversation
Warning Rate Limit Exceeded@crodriguezvega has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 40 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe recent updates across various modules primarily involve adding new constants for maximum lengths and updating validation functions to enforce these limits. These changes ensure that parameters like allowed message types, client lists, and version features do not exceed predefined thresholds, enhancing system stability and security. Corresponding test cases have also been added to verify these new validations. 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 (
|
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: 1
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (7)
- modules/apps/27-interchain-accounts/host/types/params.go (2 hunks)
- modules/apps/27-interchain-accounts/host/types/params_test.go (1 hunks)
- modules/core/02-client/types/params.go (2 hunks)
- modules/core/02-client/types/params_test.go (1 hunks)
- modules/core/03-connection/types/msgs.go (1 hunks)
- modules/core/03-connection/types/msgs_test.go (1 hunks)
- modules/core/03-connection/types/version.go (2 hunks)
Additional Context Used
Path-based Instructions (7)
modules/apps/27-interchain-accounts/host/types/params_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"modules/apps/27-interchain-accounts/host/types/params.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.modules/core/02-client/types/params_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"modules/core/02-client/types/params.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.modules/core/03-connection/types/version.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.modules/core/03-connection/types/msgs.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.modules/core/03-connection/types/msgs_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
Additional comments not posted (9)
modules/apps/27-interchain-accounts/host/types/params.go (2)
13-13
: The constantMaxAllowListLength
is well-defined and appropriately used in the validation logic.
35-37
: The updated validation logic correctly checks for the maximum length constraint.modules/core/02-client/types/params_test.go (1)
43-43
: The test case effectively checks the behavior when the number of allowed clients exceeds the new limit.modules/core/02-client/types/params.go (2)
10-10
: The constantMaxAllowedClientsLength
is well-defined and appropriately used in the validation logic.
52-54
: The updated validation logic correctly checks for the maximum length constraint.modules/core/03-connection/types/version.go (2)
32-34
: The constantsMaxCounterpartyVersionsLength
andMaxFeaturesLength
are well-defined and appropriately used in the validation logic.
64-66
: The updated validation logic correctly checks for the maximum length constraint on features.modules/core/03-connection/types/msgs.go (1)
132-134
: The updatedValidateBasic
method correctly checks for the maximum length constraint onCounterpartyVersions
.modules/core/03-connection/types/msgs_test.go (1)
163-165
: The test case effectively checks the behavior when the number ofCounterpartyVersions
exceeds the new limit.
@@ -14,4 +14,5 @@ func TestValidateParams(t *testing.T) { | |||
require.Error(t, types.NewParams(true, []string{""}).Validate()) | |||
require.Error(t, types.NewParams(true, []string{" "}).Validate()) | |||
require.Error(t, types.NewParams(true, []string{"*", "/cosmos.bank.v1beta1.MsgSend"}).Validate()) | |||
require.Error(t, types.NewParams(true, make([]string, 1000)).Validate()) |
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.
Ensure the test covers the edge case where the length is exactly at the maximum allowable limit.
Would you like me to help add this test case?
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: 0
Out of diff range and nitpick comments (2)
CHANGELOG.md (2)
Line range hint
169-169
: Ensure URLs are properly formatted with descriptive text.- * [\#6193](https://github.com/cosmos/ibc-go/pull/6193) Bump Cosmos SDK to v0.50.6. + * [Bump Cosmos SDK to v0.50.6](https://github.com/cosmos/ibc-go/pull/6193).
Line range hint
184-184
: Remove trailing spaces to maintain clean and professional code documentation.- * (apps/27-interchain-accounts) [\#5533](https://github.com/cosmos/ibc-go/pull/5533) ICA host sets the host connection ID on `OnChanOpenTry`, so that ICA controller implementations are not obliged to set the value on `OnChanOpenInit` if they are not able. + * (apps/27-interchain-accounts) [\#5533](https://github.com/cosmos/ibc-go/pull/5533) ICA host sets the host connection ID on `OnChanOpenTry`, so that ICA controller implementations are not obliged to set the value on `OnChanOpenInit` if they are not able.
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (4)
- CHANGELOG.md (1 hunks)
- modules/apps/27-interchain-accounts/host/types/params_test.go (1 hunks)
- modules/core/02-client/types/params_test.go (1 hunks)
- modules/core/03-connection/types/msgs_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- modules/apps/27-interchain-accounts/host/types/params_test.go
- modules/core/02-client/types/params_test.go
- modules/core/03-connection/types/msgs_test.go
Additional Context Used
Path-based Instructions (1)
CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"
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.
As discussed previously, maximums seem somewhat arbitrary and there should be protection from cosmos-sdk max tx size limits as well as the gas costs incurred from such a large spam type message.
Approving for extra defensive parameter checks regardless 👍🏻
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: 0
Out of diff range and nitpick comments (2)
CHANGELOG.md (2)
Line range hint
170-170
: Remove the bare URL and replace it with a markdown link.- * [\#6193](https://github.com/cosmos/ibc-go/pull/6193) Bump Cosmos SDK to v0.50.6. + * [\#6193](https://github.com/cosmos/ibc-go/pull/6193) Bump Cosmos SDK to v0.50.6.
Line range hint
185-185
: Remove trailing spaces.- * (apps/27-interchain-accounts) [\#5533](https://github.com/cosmos/ibc-go/pull/5533) ICA host sets the host connection ID on `OnChanOpenTry`, so that ICA controller implementations are not obliged to set the value on `OnChanOpenInit` if they are not able. + * (apps/27-interchain-accounts) [\#5533](https://github.com/cosmos/ibc-go/pull/5533) ICA host sets the host connection ID on `OnChanOpenTry`, so that ICA controller implementations are not obliged to set the value on `OnChanOpenInit` if they are not able.
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (1)
- CHANGELOG.md (1 hunks)
Additional Context Used
Path-based Instructions (1)
CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"
Quality Gate passed for 'ibc-go'Issues Measures |
* imp: check length of slices of messages * add changelog * change test limits (cherry picked from commit 478f4c6) # Conflicts: # CHANGELOG.md # modules/apps/27-interchain-accounts/host/types/params.go # modules/apps/27-interchain-accounts/host/types/params_test.go # modules/core/02-client/types/params.go # modules/core/02-client/types/params_test.go
* imp: check length of slices of messages * add changelog * change test limits (cherry picked from commit 478f4c6) # Conflicts: # CHANGELOG.md # modules/apps/27-interchain-accounts/host/types/params.go # modules/apps/27-interchain-accounts/host/types/params_test.go
Description
Adds length checking of array fields in messages.
closes: #XXXX
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.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.Summary by CodeRabbit
New Features
Bug Fixes
Tests