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

fix(inflation): fix default inflation allocation params #1688

Merged
merged 4 commits into from
Dec 3, 2023

Conversation

matthiasmatt
Copy link
Contributor

@matthiasmatt matthiasmatt commented Dec 1, 2023

Description

Make it follow tokenomics

Purpose

Why is this PR important?

Summary by CodeRabbit

  • New Features

    • Updated the inflation distribution to new percentages for Community Pool, Staking Rewards, and Strategic Reserves.
  • Bug Fixes

    • Fixed an issue related to default inflation allocation to ensure accurate distribution according to the new percentages.
  • Tests

    • Removed unnecessary print statements and checks in test functions to streamline testing procedures.
    • Updated test expectations to align with the new inflation distribution logic.

@matthiasmatt matthiasmatt requested a review from a team as a code owner December 1, 2023 14:46
Copy link
Contributor

coderabbitai bot commented Dec 1, 2023

Walkthrough

The codebase underwent a significant update to the inflation distribution parameters, altering the percentages allocated to the Community Pool, Staking Rewards, and Strategic Reserves. This change is reflected in both the constants and the expected values within test functions, indicating a shift in the inflation logic that could affect dependent systems. Additionally, some cleanup was performed in test files, removing unnecessary print statements and related checks.

Changes

File Path Change Summary
x/inflation/types/params.go Updated DefaultInflationDistribution constants for CommunityPool, StakingRewards, and StrategicReserves.
CHANGELOG.md Added entries for fixes and modifications related to default inflation allocation.
x/inflation/keeper/hooks_test.go Removed print statements and checks for tc.periodChanges, newProvision, expectedProvision, and originalProvision in TestPeriodChangesSkippedEpochsAfterEpochEnd.
x/inflation/keeper/inflation_test.go Updated expected coin amounts for various balances in TestMintAndAllocateInflation function.

🐇
In the code where numbers dance,
A rabbit tweaked the finance stance.
Inflation's new tune,
Under the codebase moon,
A hop, a skip, in the balance prance. 🌙
🐇


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 33b27f5 and dc8c759.
Files selected for processing (1)
  • x/inflation/types/params.go (1 hunks)

Comment on lines +31 to +33
CommunityPool: sdk.NewDecWithPrec(35_159141, 8), // 35.159141%
StakingRewards: sdk.NewDecWithPrec(27_757217, 8), // 27.757217%
StrategicReserves: sdk.NewDecWithPrec(37_083642, 8), // 37.083642%
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sum of the new percentage values for CommunityPool, StakingRewards, and StrategicReserves exceeds 100%. This is not valid for a distribution where the total should be exactly 100%. Please correct the values to ensure they sum up to 100%.

-		CommunityPool:     sdk.NewDecWithPrec(35_159141, 8), // 35.159141%
-		StakingRewards:    sdk.NewDecWithPrec(27_757217, 8), // 27.757217%
-		StrategicReserves: sdk.NewDecWithPrec(37_083642, 8), // 37.083642%
+		CommunityPool:     sdk.NewDecWithPrec(<correct_value>, 8), // <correct_percentage>%
+		StakingRewards:    sdk.NewDecWithPrec(<correct_value>, 8), // <correct_percentage>%
+		StrategicReserves: sdk.NewDecWithPrec(<correct_value>, 8), // <correct_percentage>%

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
CommunityPool: sdk.NewDecWithPrec(35_159141, 8), // 35.159141%
StakingRewards: sdk.NewDecWithPrec(27_757217, 8), // 27.757217%
StrategicReserves: sdk.NewDecWithPrec(37_083642, 8), // 37.083642%
CommunityPool: sdk.NewDecWithPrec(<correct_value>, 8), // <correct_percentage>%
StakingRewards: sdk.NewDecWithPrec(<correct_value>, 8), // <correct_percentage>%
StrategicReserves: sdk.NewDecWithPrec(<correct_value>, 8), // <correct_percentage>%

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between dc8c759 and 36b9b72.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional comments: 1
CHANGELOG.md (1)
  • 87-90: The changelog correctly documents the significant change to the default inflation allocation as per the pull request.

@@ -87,6 +87,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#1659](https://github.com/NibiruChain/nibiru/pull/1659) - refactor(oracle): curate oracle default whitelist
* [#1679](https://github.com/NibiruChain/nibiru/pull/1679) - test(perp): add more tests for perp module msg server
* [#1686](https://github.com/NibiruChain/nibiru/pull/1686) - test(perp): add more tests for perp module msg server for DnR
* [#1688](https://github.com/NibiruChain/nibiru/pull/1688) - fix(inflation): make default inflation allocation follow tokenomics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same entry for the fix related to default inflation allocation appears twice in the changelog, which seems to be an oversight and should be consolidated into a single entry.

@Unique-Divine Unique-Divine changed the title fix: fix default inflation allocation fix(inflation): fix default inflation allocation params Dec 3, 2023
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 36b9b72 and 605152d.
Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • x/inflation/keeper/hooks_test.go (1 hunks)
  • x/inflation/keeper/inflation_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md
Additional comments: 5
x/inflation/keeper/hooks_test.go (2)
  • 161-180: The changes in the test function TestPeriodChangesSkippedEpochsAfterEpochEnd correctly reflect the removal of debug print statements and related conditional logic as described in the summary. The remaining assertions and logic appear to be intact and relevant to the test's purpose.

  • 161-180: The test modifications align with the PR's objective to adjust inflation allocation parameters. The assertions in the test are checking the expected behavior of the inflation logic after epoch changes, which is crucial for validating the new tokenomics.

x/inflation/keeper/inflation_test.go (3)
  • 37-47: The updated expected values in the test case reflect the new allocation percentages for the Community Pool, Staking Rewards, and Strategic Reserves as per the PR objective. This ensures that the test will validate the correct distribution of inflation.

  • 59-69: The test case without a root account specified correctly reflects the scenario where the strategic reserves should remain in the module account, and the expected values are updated accordingly.

  • 37-48: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [37-69]

The summary provided matches the changes in the hunks, indicating that the expected values for coin amounts in the TestMintAndAllocateInflation function have been updated to reflect the new inflation distribution parameters.

Copy link

codecov bot commented Dec 3, 2023

Codecov Report

Merging #1688 (605152d) into master (33b27f5) will increase coverage by 0.06%.
Report is 1 commits behind head on master.
The diff coverage is 87.58%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1688      +/-   ##
==========================================
+ Coverage   74.19%   74.26%   +0.06%     
==========================================
  Files         193      193              
  Lines       15444    15476      +32     
==========================================
+ Hits        11459    11493      +34     
+ Misses       3324     3318       -6     
- Partials      661      665       +4     
Files Coverage Δ
app/genesis.go 19.51% <100.00%> (+2.01%) ⬆️
app/keepers.go 99.21% <100.00%> (ø)
wasmbinding/exec_perp.go 84.89% <ø> (-2.15%) ⬇️
wasmbinding/message_plugin.go 86.30% <ø> (-2.21%) ⬇️
x/inflation/types/params.go 63.46% <ø> (ø)
x/perp/v2/keeper/msg_server.go 100.00% <100.00%> (ø)
x/perp/v2/types/amm.go 80.32% <100.00%> (ø)
x/perp/v2/types/codec.go 100.00% <100.00%> (ø)
x/sudo/keeper/keeper.go 74.41% <100.00%> (ø)
x/common/constants.go 0.00% <0.00%> (ø)
... and 3 more

... and 1 file with indirect coverage changes

Copy link
Member

@Unique-Divine Unique-Divine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Unique-Divine Unique-Divine merged commit 39b5570 into master Dec 3, 2023
17 checks passed
@Unique-Divine Unique-Divine deleted the mat/fix-inflation-allocation branch December 3, 2023 19:25
k-yang pushed a commit that referenced this pull request Dec 8, 2023
* fix: fix default inflation allocation

* chore: changelog

* fix: fix tests

---------

Co-authored-by: Unique Divine <[email protected]>
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