fix: superfluid log for error that should be ignored#8791
Conversation
WalkthroughThe changes in this pull request involve updates to the Changes
Possibly related PRs
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
x/superfluid/keeper/epoch.go (1)
83-88: Consider implementing the TODO for performance optimization.
Both error handling blocks contain a TODO about removing accounts from IntermediaryAccounts to avoid unnecessary iterations. This optimization could improve performance, especially with a large number of accounts.
Would you like me to create a GitHub issue to track this optimization task?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- x/superfluid/keeper/epoch.go (2 hunks)
🔇 Additional comments (3)
x/superfluid/keeper/epoch.go (2)
10-10: LGTM: Import addition is appropriate.
The addition of the stakingtypes import is necessary for the new error handling and follows proper import conventions.
84-88: LGTM: Error handling enhancement aligns with v0.50.x changes.
The addition of stakingtypes.ErrNoDelegation check properly addresses the v0.50.x error handling changes while maintaining consistent behavior. The debug log level is appropriate for this expected condition.
Let's verify that this is the only place where we need to handle this error type:
✅ Verification successful
Let me check the error handling in the other location that calls WithdrawDelegationRewards.
Let me try a different approach to check the error handling:
Error handling for stakingtypes.ErrNoDelegation is correctly implemented only where needed
The error handling change in x/superfluid/keeper/epoch.go is appropriate and sufficient. The other usage of WithdrawDelegationRewards in x/valset-pref module has different error handling requirements since:
- It operates on validated delegator-validator pairs from
GetValSetPreferencesWithDelegations - It propagates errors directly as it's part of a user-initiated transaction, unlike the superfluid module's background epoch processing
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other potential places where stakingtypes.ErrNoDelegation should be handled
rg "WithdrawDelegationRewards" --type go
Length of output: 9909
Script:
# Check error handling in valset-pref module
ast-grep --pattern 'WithdrawDelegationRewards($$$) {
$$$
}'
Length of output: 63
Script:
#!/bin/bash
# Check the implementation in valset-pref module
rg "WithdrawDelegationRewards" -A 10 x/valset-pref/validator_set.go
Length of output: 1524
CHANGELOG.md (1)
68-68: LGTM: Changelog entry properly documents the PR changes.
The changelog entry correctly captures the purpose of PR #8791 to fix superfluid logging behavior. The entry is appropriately placed under the "State Compatible" section since it's a non-state-breaking change.
What is the purpose of the change
When we call the WithdrawDelegatorRewards function, we expect there to be a certain type of error, but this error changed in v50 causing multiple info logs that should be debug logs, making it difficult to understand what's happening with the superfluid epoch.
For v0.50 a function changed to return a different error see:
https://github.com/osmosis-labs/cosmos-sdk/blob/osmo-v27/0.50.10/x/distribution/keeper/keeper.go#L107-L138
old v0.47 see:
https://github.com/osmosis-labs/cosmos-sdk/blob/osmo-v25/v0.47.5/x/distribution/keeper/keeper.go#L83-L103
Testing and Verifying
Run all go tests for superfluid
see (live debug logs):
&&