-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat: cellarfees v2 changes #289
Conversation
WalkthroughThis update introduces significant changes to the Sommelier application, focusing on the transition to cellarfees version 2 and the preparation for future upgrades, particularly version 8. It deprecates older upgrade paths by excluding them from the build and refines the integration tests to align with the new cellarfees functionality. The changes also include updates to protobuf definitions to support more specific versioned paths and enhance the auction and cellarfees modules with new functionalities and test cases. Additionally, it prepares the groundwork for handling fee token balances in USD values and streamlines query functionalities within the cellarfees module. Changes
Related issues
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 (
|
"github.com/peggyjv/sommelier/v7/x/cork/client/cli" | ||
"github.com/peggyjv/sommelier/v7/x/cork/keeper" | ||
corktypes "github.com/peggyjv/sommelier/v7/x/cork/types" | ||
v1types "github.com/peggyjv/sommelier/v7/x/cork/types/v1" | ||
types "github.com/peggyjv/sommelier/v7/x/cork/types/v2" | ||
"github.com/spf13/cobra" | ||
abci "github.com/tendermint/tendermint/abci/types" |
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.
📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [7-7]
The use of math/rand
for generating random values in blockchain or security-sensitive contexts is not recommended due to its predictability. It's advisable to use crypto/rand
instead to ensure cryptographic security.
- "math/rand"
+ "crypto/rand"
"github.com/peggyjv/sommelier/v7/x/cellarfees/client/cli" | ||
"github.com/peggyjv/sommelier/v7/x/cellarfees/keeper" | ||
"github.com/peggyjv/sommelier/v7/x/cellarfees/types" | ||
typesv2 "github.com/peggyjv/sommelier/v7/x/cellarfees/types/v2" | ||
"github.com/spf13/cobra" | ||
abci "github.com/tendermint/tendermint/abci/types" | ||
) |
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.
📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [6-6]
Similar to the previous file, the use of math/rand
is noted here. For blockchain or security-sensitive contexts, it's crucial to use crypto/rand
to ensure cryptographic security. This change is recommended to enhance the security of the module.
- "math/rand"
+ "crypto/rand"
func (p Params) String() string { | ||
out, _ := yaml.Marshal(p) | ||
return string(out) |
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.
The yaml.Marshal
function call within the String
method does not handle potential errors. It's a best practice to handle errors explicitly to avoid runtime panics or unexpected behavior. Consider adding error handling for the yaml.Marshal
call.
func (p Params) String() string {
- out, _ := yaml.Marshal(p)
+ out, err := yaml.Marshal(p)
+ if err != nil {
+ // Handle error, possibly log it or return an error message
+ }
return string(out)
}
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.
func (p Params) String() string { | |
out, _ := yaml.Marshal(p) | |
return string(out) | |
func (p Params) String() string { | |
out, err := yaml.Marshal(p) | |
if err != nil { | |
// Handle error, possibly log it or return an error message | |
} | |
return string(out) |
@@ -22,15 +22,11 @@ const ( | |||
LastRewardSupplyPeakKey | |||
|
|||
// key for storing fee accrual counts | |||
// DEPRECATED |
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.
The deprecation of FeeAccrualCountersKey
is clearly indicated, which is good practice. If this function is no longer needed due to changes in the module's functionality or data structure, consider removing the code to keep the codebase clean.
cmd.AddCommand(CmdQueryFeeTokenBalance()) | ||
cmd.AddCommand(CmdQueryFeeTokenBalances()) |
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.
Adding commands for querying APY and fee token balances (CmdQueryAPY
, CmdQueryFeeTokenBalance
, and CmdQueryFeeTokenBalances
) enhances the module's functionality and user interaction. Ensure that the underlying logic for these queries is thoroughly tested and documented.
Would you like assistance in creating additional tests or documentation for these new query commands?
Closes #283