osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

feat(x/incentives): min value param for epoch distribution

Open czarcas7ic opened this issue 1 year ago • 1 comments
trafficstars

Closes: #7610

What is the purpose of the change

Completes https://www.mintscan.io/osmosis/proposals/733

Adds a min value to trigger epoch incentive distributions and sets to 0.01 OSMO.

If the underlying token being distributed does not have a path registered in protorev OR the underlying being distributed is less than the new min value parameter, the distribution for that is skipped.

Summary by CodeRabbit

  • New Features
    • Introduced a new parameter to set a minimum value for distribution eligibility in the incentives module.
    • Added caching for minimum distribution values to optimize performance.
  • Enhancements
    • Implemented a new keeper for protocol revisions.
    • Enhanced distribution logic to handle non-base denomination rewards and insufficient rewards scenarios.
  • Tests
    • Expanded test coverage to include checks for the new minimum value for distribution, non-base denomination rewards handling, and user lock configurations.
  • Documentation
    • Updated CHANGELOG.md to reflect new parameter addition for epoch distribution minimum value.

czarcas7ic avatar Feb 26 '24 05:02 czarcas7ic

Walkthrough

The changes implement a new parameter to limit epoch calculations and distributions to small positions in classic pools, as proposed in Proposal 733. This includes adding a minimum value for distribution, updating keeper structures and functions to support this new parameter, and ensuring tests validate the new functionality. The modifications span across several files, setting up a mechanism to filter out positions that would receive an insignificant amount of incentives, thereby optimizing the calculation process.

Changes

File Path Change Summary
CHANGELOG.md Added a new parameter for epoch distribution minimum value.
app/keepers/keepers.go, app/upgrades/v24/upgrades.go, app/upgrades/v24/upgrades_test.go, x/incentives/keeper/keeper.go, x/incentives/keeper/keeper_test.go, x/superfluid/keeper/keeper_test.go Introduced changes to support the new minimum value for distribution in the incentives module, including new keepers and parameters setup.
proto/osmosis/incentives/params.proto Added min_value_for_distribution field to specify the minimum token value for distribution eligibility.
x/incentives/keeper/distribute.go, x/incentives/keeper/distribute_test.go Implemented and tested the logic for filtering out small positions based on the new minimum value for distribution.
x/incentives/types/..., x/cosmwasmpool/cosmwasm/msg/transmuter/transmuter_test.go Updated types and tests to align with the new incentives distribution mechanism.

Assessment against linked issues

Objective Addressed Explanation
Limit Epoch Calculations to Small Positions [Proposal 733] (#7610)

🐇 To the pools of classic, we now say, "Small rewards, we'll filter away." A threshold so bright, in the code takes its place, Ensuring the epoch's a more efficient space. 🌟 For progress, we hop, with each line we compose, In the garden of code, where the blockchain rose. 🌹

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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.

coderabbitai[bot] avatar Mar 12 '24 16:03 coderabbitai[bot]