-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
refactor(x/bank): check send enabled on coins #20343
Conversation
WalkthroughWalkthroughThe recent updates focus on enhancing parameter setting for 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 (2)
- x/bank/keeper/keeper.go (1 hunks)
- x/bank/keeper/keeper_test.go (1 hunks)
Additional Context Used
Path-based Instructions (2)
x/bank/keeper/keeper.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/bank/keeper/keeper_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"
x/bank/keeper/keeper.go
Outdated
if err := k.IsSendEnabledCoins(ctx, amt...); err != nil { | ||
return err | ||
} |
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.
Add a comment explaining the purpose of the IsSendEnabledCoins
check.
+ // Check if sending coins is enabled for the specified amounts
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.
if err := k.IsSendEnabledCoins(ctx, amt...); err != nil { | |
return err | |
} | |
if err := k.IsSendEnabledCoins(ctx, amt...); err != nil { | |
// Check if sending coins is enabled for the specified amounts | |
return err | |
} |
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.
Can we get a changelog?
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
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- x/bank/keeper/keeper.go (1 hunks)
- x/bank/keeper/keeper_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- x/bank/keeper/keeper.go
- x/bank/keeper/keeper_test.go
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
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- baseapp/baseapp.go (1 hunks)
- x/bank/keeper/keeper_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/bank/keeper/keeper_test.go
Additional Context Used
Path-based Instructions (1)
baseapp/baseapp.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (1)
baseapp/baseapp.go (1)
725-725
: Change in function signature to ignore input parameter.Verification successful
The review of the
beginBlock
function inbaseapp/baseapp.go
shows that the function signature correctly marks the parameter as unused with an underscore, and the function is called inbaseapp/abci.go
. There is no evidence from the current codebase that this change negatively impacts the functionality. It appears that the function signature change is handled appropriately, and the parameter is intentionally marked as unused.
- Location of the function call:
baseapp/abci.go
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the change in function signature of `beginBlock` does not affect its functionality. # Test: Search for usage of `beginBlock` in the codebase. Expect: No direct usage of the parameter. rg --type go $'func \\(.*BaseApp\\) beginBlock\\(_ \\*abci.FinalizeBlockRequest\\)'Length of output: 185
Script:
#!/bin/bash # Description: Search for calls to `beginBlock` within the codebase to understand its usage context. # Search for calls to `beginBlock` and analyze the context in which it is used. rg --type go 'app.beginBlock\('Length of output: 89
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
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- x/bank/keeper/genesis_test.go (2 hunks)
- x/bank/keeper/keeper_test.go (6 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/bank/keeper/keeper_test.go
Additional Context Used
Path-based Instructions (1)
x/bank/keeper/genesis_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 (1)
x/bank/keeper/genesis_test.go (1)
24-26
: The changes to set default send parameters align with the PR's objectives to enhance checks on coin sending. Ensure integration with other modules is verified.Verification successful
The review of the integration of the
DefaultSendEnabled
parameter across various modules and components within the Cosmos SDK's bank module indicates a thorough and consistent implementation. The parameter is actively used and tested across multiple layers, including simulation, keeper logic, and API responses, ensuring its functionality is integral to the module's operations.
- Genesis and Simulation Tests: The parameter is tested under various scenarios to ensure its default and modified states behave as expected.
- Keeper and API Layers: Critical for transaction permissions, the parameter's value is consistently retrieved and used in transaction validations and API responses.
This comprehensive integration aligns with the PR's objectives to enhance checks on coin sending, confirming the changes are correctly implemented.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify integration of default send parameters with other modules. # Test: Search for usage of `DefaultSendEnabled` in other modules. Expect: Proper integration. rg --type go $'DefaultSendEnabled'Length of output: 5449
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 (1)
- x/bank/CHANGELOG.md (1 hunks)
Additional Context Used
LanguageTool (11)
x/bank/CHANGELOG.md (11)
Near line 30: Unpaired symbol: ‘[’ seems to be missing
Context: ...## [Unreleased] ### Features * [#17569](https://github.com/cosmos/cosmos-sdk/pu...
Near line 31: Unpaired symbol: ‘[’ seems to be missing
Context: ...ype,MsgBurn
, to burn coins. * [#20014](https://github.com/cosmos/cosmos-sdk/pu...
Near line 35: Unpaired symbol: ‘[’ seems to be missing
Context: ...rictionFn`. ### Improvements * [#18636](https://github.com/cosmos/cosmos-sdk/pu...
Near line 35: The verb form ‘does’ does not seem to match the subject ‘accounts’.
Context: ...ead of panicking if any module accounts does not exist or unauthorized. ### API Bre...
Near line 39: Unpaired symbol: ‘[’ seems to be missing
Context: ...ed. ### API Breaking Changes * [#19954](https://github.com/cosmos/cosmos-sdk/pu...
Near line 44: Unpaired symbol: ‘[’ seems to be missing
Context: ...lances` also returns an error. * [#17569](https://github.com/cosmos/cosmos-sdk/pu...
Near line 45: Unpaired symbol: ‘[’ seems to be missing
Context: ...dress instead of a module name * [#19477](https://github.com/cosmos/cosmos-sdk/pu...
Near line 46: Unpaired symbol: ‘[’ seems to be missing
Context: ... is passed to bankNewKeeper
* [#19627](https://github.com/cosmos/cosmos-sdk/pu...
Near line 47: Unpaired symbol: ‘[’ seems to be missing
Context: ... matchappmodule.HasGenesis
. * [#19740](https://github.com/cosmos/cosmos-sdk/pu...
Near line 51: Unpaired symbol: ‘[’ seems to be missing
Context: ...## Consensus Breaking Changes * [#19188](https://github.com/cosmos/cosmos-sdk/pu...
Near line 52: Unpaired symbol: ‘[’ seems to be missing
Context: ...an account that does not exist * [#20343](https://github.com/cosmos/cosmos-sdk/pu...
Path-based Instructions (1)
x/bank/CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"
@@ -49,3 +49,4 @@ Ref: https://keepachangelog.com/en/1.0.0/ | |||
### Consensus Breaking Changes | |||
|
|||
* [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist | |||
* [#20343](https://github.com/cosmos/cosmos-sdk/pull/20343) Add a check in send moduleaccount to account to prevent module accounts from sending disabled tokens to accounts |
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.
Correct the grammatical error in the changelog entry.
- * [#20343](https://github.com/cosmos/cosmos-sdk/pull/20343) Add a check in send moduleaccount to account to prevent module accounts from sending disabled tokens to accounts
+ * [#20343](https://github.com/cosmos/cosmos-sdk/pull/20343) Add a check in send module account to account to prevent module accounts from sending disabled tokens to accounts
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.
* [#20343](https://github.com/cosmos/cosmos-sdk/pull/20343) Add a check in send moduleaccount to account to prevent module accounts from sending disabled tokens to accounts | |
* [#20343](https://github.com/cosmos/cosmos-sdk/pull/20343) Add a check in send module account to account to prevent module accounts from sending disabled tokens to accounts |
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
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (8)
- tests/integration/bank/keeper/deterministic_test.go (1 hunks)
- tests/integration/distribution/keeper/msg_server_test.go (1 hunks)
- tests/integration/evidence/keeper/infraction_test.go (1 hunks)
- tests/integration/gov/keeper/keeper_test.go (1 hunks)
- tests/integration/slashing/keeper/keeper_test.go (1 hunks)
- tests/integration/staking/keeper/common_test.go (1 hunks)
- tests/integration/staking/keeper/deterministic_test.go (1 hunks)
- tests/integration/types/pagination_test.go (1 hunks)
Files not reviewed due to errors (1)
- tests/integration/staking/keeper/deterministic_test.go (no review received)
Additional Context Used
Path-based Instructions (8)
tests/integration/gov/keeper/keeper_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"tests/integration/staking/keeper/common_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"tests/integration/types/pagination_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"tests/integration/bank/keeper/deterministic_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"tests/integration/evidence/keeper/infraction_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"tests/integration/slashing/keeper/keeper_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"tests/integration/staking/keeper/deterministic_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"tests/integration/distribution/keeper/msg_server_test.go (3)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
Additional comments not posted (6)
tests/integration/gov/keeper/keeper_test.go (1)
103-104
: Setting default parameters for the bank keeper ensures consistent initial conditions for tests.tests/integration/staking/keeper/common_test.go (1)
162-163
: Setting default parameters for the bank keeper ensures consistent initial conditions for tests.tests/integration/types/pagination_test.go (1)
87-88
: Setting default parameters for the bank keeper ensures consistent initial conditions for tests.tests/integration/bank/keeper/deterministic_test.go (1)
110-111
: Setting default parameters for the bank keeper ensures consistent initial conditions for tests.tests/integration/evidence/keeper/infraction_test.go (1)
140-140
: Ensure consistent parameter setting across tests.This line sets the default parameters for the
bankKeeper
, which aligns with the PR's objective to standardize test setups across modules by ensuring consistent financial conditions.tests/integration/slashing/keeper/keeper_test.go (1)
109-109
: Ensure consistent parameter setting across tests.This line sets the default parameters for the
bankKeeper
, which is crucial for ensuring that all tests operate under consistent financial conditions. This change is part of the PR's broader goal to standardize test setups across different modules.
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
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- tests/integration/staking/keeper/deterministic_test.go (2 hunks)
- tests/integration/types/filtered_pagination_test.go (2 hunks)
Files skipped from review due to trivial changes (1)
- tests/integration/types/filtered_pagination_test.go
Files skipped from review as they are similar to previous changes (1)
- tests/integration/staking/keeper/deterministic_test.go
Description
this was reported as an issue, while the path to get here would involve lots of overhead its worth adding the check
Author 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...
!
in the type prefix if API or client breaking changeCHANGELOG.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...
Summary by CodeRabbit