Skip to content
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

Merged
merged 28 commits into from
Mar 18, 2024
Merged

feat: cellarfees v2 changes #289

merged 28 commits into from
Mar 18, 2024

Conversation

cbrit
Copy link
Member

@cbrit cbrit commented Mar 4, 2024

Closes #283

Copy link

coderabbitai bot commented Mar 11, 2024

Walkthrough

This 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

File Path Change Summary
app/.../app.go, proto/..., x/cellarfees/..., integration_tests/... Transition to cellarfees v2, update protobuf paths, refine integration tests.
app/upgrades/... Added build constraints to exclude older upgrades from the build.
x/auction/... Updated auction module functionalities and tests. Removed unnecessary imports and checks.
x/cellarfees/... Enhanced cellarfees module with new keeper functionalities, updated query services, and refined tests.

Related issues

  • Sommelier v8 #287: The transition to cellarfees v2 and the preparation for future upgrades, including the removal of fee accrual counters in favor of fee token USD value thresholds, directly contribute to addressing objectives listed in this issue.

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

Note: Auto-reply has been disabled for this repository by the repository owner. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Comment on lines 16 to 21
"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"
Copy link

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"

Comment on lines 15 to 21
"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"
)
Copy link

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"

Comment on lines +6 to +8
func (p Params) String() string {
out, _ := yaml.Marshal(p)
return string(out)
Copy link

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.

Suggested change
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
Copy link

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.

Comment on lines +31 to +32
cmd.AddCommand(CmdQueryFeeTokenBalance())
cmd.AddCommand(CmdQueryFeeTokenBalances())
Copy link

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?

@cbrit cbrit merged commit 01ad6c8 into main Mar 18, 2024
10 checks passed
@cbrit cbrit mentioned this pull request Jul 22, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants