fix(sims): skip operations that use denoms that can't be sent#20399
Conversation
WalkthroughWalkthroughThe recent updates enhance the system by introducing a mechanism to verify the sendability of coins before executing reward withdrawals and staking operations. This includes adding the 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 (
|
|
@facundomedica your pull request is missing a changelog! |
There was a problem hiding this comment.
Actionable comments posted: 1
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (4)
- x/distribution/simulation/operations.go (1 hunks)
- x/distribution/types/expected_keepers.go (1 hunks)
- x/staking/simulation/operations.go (2 hunks)
- x/staking/types/expected_keepers.go (1 hunks)
Additional Context Used
Path-based Instructions (4)
x/distribution/types/expected_keepers.go (1)
Pattern
**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/staking/types/expected_keepers.go (1)
Pattern
**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/distribution/simulation/operations.go (1)
Pattern
**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/staking/simulation/operations.go (1)
Pattern
**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (5)
x/distribution/types/expected_keepers.go (1)
34-34: Addition ofIsSendEnabledDenommethod toBankKeeperinterface looks good. Ensure that all implementations of this interface are updated accordingly.x/staking/types/expected_keepers.go (1)
43-43: Addition ofIsSendEnabledDenommethod toBankKeeperinterface looks good. Ensure that all implementations of this interface are updated accordingly.x/distribution/simulation/operations.go (1)
161-171: Good addition of checks for whether a denomination is enabled for sending before proceeding with the withdrawal operation. This ensures that only sendable denominations are processed, preventing potential errors.x/staking/simulation/operations.go (2)
453-456: Check for send-enabled denomination before undelegating.This check ensures that the undelegate operation does not proceed if the bond denomination is not enabled for sending. This is a good addition for robustness.
719-722: Check for send-enabled denomination before redelegating.This check ensures that the redelegate operation does not proceed if the bond denomination is not enabled for sending. This is a good addition for robustness.
| for _, v := range outstanding { | ||
| if !bk.IsSendEnabledDenom(ctx, v.Denom) { | ||
| return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "denom send not enabled: "+v.Denom), nil, nil | ||
| } | ||
| } |
There was a problem hiding this comment.
Consider adding a log message or metric increment here to track how often operations are skipped due to non-sendable denominations. This can help in monitoring and debugging.
+ // Log or metric increment can be added here for monitoringCommittable 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.
| for _, v := range outstanding { | |
| if !bk.IsSendEnabledDenom(ctx, v.Denom) { | |
| return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "denom send not enabled: "+v.Denom), nil, nil | |
| } | |
| } | |
| for _, v := range outstanding { | |
| if !bk.IsSendEnabledDenom(ctx, v.Denom) { | |
| // Log or metric increment can be added here for monitoring | |
| return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "denom send not enabled: "+v.Denom), nil, nil | |
| } | |
| } |
There was a problem hiding this comment.
Actionable comments posted: 0
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (3)
- testutil/mock/types_module_module.go (3 hunks)
- x/distribution/testutil/expected_keepers_mocks.go (1 hunks)
- x/staking/testutil/expected_keepers_mocks.go (1 hunks)
Additional Context Used
Path-based Instructions (3)
testutil/mock/types_module_module.go (1)
Pattern
**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/distribution/testutil/expected_keepers_mocks.go (1)
Pattern
**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/staking/testutil/expected_keepers_mocks.go (1)
Pattern
**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (5)
testutil/mock/types_module_module.go (2)
70-70: The addition of theRegisterLegacyAminoCodecmethod in theMockAppModuleBasicstruct looks good.
268-268: The addition of theRegisterLegacyAminoCodecmethod in theMockHasAminoCodecstruct looks good.x/distribution/testutil/expected_keepers_mocks.go (1)
159-171: The addition of theIsSendEnabledDenommethod in theMockBankKeeperstruct looks good.x/staking/testutil/expected_keepers_mocks.go (2)
205-211: Correct implementation of theIsSendEnabledDenommock method.
213-217: Correct implementation of theIsSendEnabledDenomrecorder method.
Description
Follow up to #20343.
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.mdReviewers 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
New Features
Improvements