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

chore: reduce default inflation #20606

Merged
merged 5 commits into from
Jun 11, 2024
Merged

chore: reduce default inflation #20606

merged 5 commits into from
Jun 11, 2024

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Jun 10, 2024

Description

This pr is more of a nit. It reduces default mint parameters to 0-5%. chains should figure out what to set but they should aim for below 5% and seeing 5% may make them think that way


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Documentation

    • Updated README.md for x/mint module to reflect new inflation range of 0%-5% and maximum annual rate change of 5%.
  • Bug Fixes

    • Clarified encoding process for google.protobuf.Duration and google.protobuf.Timestamp values to ensure proper lexicographical order.
  • Tests

    • Adjusted test cases in x/mint/types/minter_test.go for inflation calculations to align with new inflation ranges and bonded ratios.
  • Refactor

    • Updated default inflation parameters in x/mint/types/params.go to new values: InflationMax set to 5% and InflationMin set to 0%.

@tac0turtle tac0turtle requested a review from a team as a code owner June 10, 2024 08:30
Copy link
Contributor

coderabbitai bot commented Jun 10, 2024

Warning

Rate limit exceeded

@tac0turtle has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 34 minutes and 39 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between e93c39d and bb15f49.

Walkthrough

The changes primarily involve refining encoding processes and updating inflation rate calculations. Specifically, encoding clarifications for DurationCodec and TimestampCodec were made, and the x/mint module's inflation logic was adjusted to lower the inflation range from 7%-20% to 0%-5%. Corresponding test cases were updated to reflect these new inflation parameters.

Changes

Files/Paths Change Summaries
orm/encoding/ormfield/duration.go Clarified encoding process for google.protobuf.Duration values to ensure lexicographical order.
orm/encoding/ormfield/timestamp.go Updated comments to clarify encoding of google.protobuf.Timestamp values.
x/mint/README.md Adjusted annual inflation range from 7%-20% to 0%-5% and max rate change from 13% to 5% per year.
x/mint/types/minter_test.go Modified test cases for inflation calculations to reflect new inflation rates and bonded ratios.
x/mint/types/params.go Changed InflationMax from 20 to 5 and InflationMin from 7 to 0 in DefaultParams function.

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 testing code 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 testing code 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 testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

Actionable comments posted: 2

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e799965 and b747e1a.

Files selected for processing (5)
  • orm/encoding/ormfield/duration.go (1 hunks)
  • orm/encoding/ormfield/timestamp.go (1 hunks)
  • x/mint/README.md (1 hunks)
  • x/mint/types/minter_test.go (1 hunks)
  • x/mint/types/params.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • orm/encoding/ormfield/duration.go
  • orm/encoding/ormfield/timestamp.go
Additional context used
Path-based instructions (3)
x/mint/types/minter_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

x/mint/types/params.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/mint/README.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

LanguageTool
x/mint/README.md

[typographical] ~98-~98: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence. (HOWEVER_SENTENCE)
Context: ...e possible is defined to be 13% per year, however, the annual inflation is capped as betwe...

Markdownlint
x/mint/README.md

10-10: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


11-11: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


13-13: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


14-14: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


15-15: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


18-18: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


20-20: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


21-21: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


22-22: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


66-66: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


103-103: Column: 1 (MD010, no-hard-tabs)
Hard tabs


104-104: Column: 1 (MD010, no-hard-tabs)
Hard tabs


106-106: Column: 1 (MD010, no-hard-tabs)
Hard tabs


107-107: Column: 1 (MD010, no-hard-tabs)
Hard tabs


108-108: Column: 1 (MD010, no-hard-tabs)
Hard tabs


109-109: Column: 1 (MD010, no-hard-tabs)
Hard tabs


110-110: Column: 1 (MD010, no-hard-tabs)
Hard tabs


111-111: Column: 1 (MD010, no-hard-tabs)
Hard tabs


112-112: Column: 1 (MD010, no-hard-tabs)
Hard tabs


113-113: Column: 1 (MD010, no-hard-tabs)
Hard tabs


115-115: Column: 1 (MD010, no-hard-tabs)
Hard tabs


126-126: Column: 1 (MD010, no-hard-tabs)
Hard tabs


135-135: Column: 1 (MD010, no-hard-tabs)
Hard tabs


136-136: Column: 1 (MD010, no-hard-tabs)
Hard tabs


49-49: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


139-139: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


155-155: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


169-169: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines

Additional comments not posted (3)
x/mint/types/minter_test.go (1)

26-26: Ensure the test cases accurately reflect the new inflation parameters.

The updated test cases correctly reflect the changes in inflation parameters from 7%-20% to 0%-5%. This is crucial for ensuring the system behaves as expected under the new settings.

Also applies to: 31-31, 37-37, 42-43, 46-47, 50-50

x/mint/types/params.go (1)

31-32: Updated inflation parameters align with PR objectives.

The changes to InflationMax and InflationMin in the DefaultParams function correctly implement the new desired range of 0%-5% for inflation, supporting the PR's goal of encouraging lower inflation rates.

x/mint/README.md (1)

99-99: Documentation accurately reflects the new inflation cap.

The documentation update correctly states the new inflation cap of 0%-5%, aligning with the changes made in the codebase.

x/mint/types/minter_test.go Outdated Show resolved Hide resolved
x/mint/README.md Outdated Show resolved Hide resolved
Copy link
Member

@facundomedica facundomedica left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

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.

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b747e1a and b9584e5.

Files selected for processing (1)
  • x/mint/README.md (1 hunks)
Additional context used
Path-based instructions (1)
x/mint/README.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

LanguageTool
x/mint/README.md

[uncategorized] ~97-~97: Possible missing preposition found. (AI_HYDRA_LEO_MISSING_OF)
Context: ...e desired ratio (67%). The maximum rate change possible is defined to be 5% per year, ...


[typographical] ~98-~98: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence. (HOWEVER_SENTENCE)
Context: ...ge possible is defined to be 5% per year, however, the annual inflation is capped between ...

Markdownlint
x/mint/README.md

10-10: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


11-11: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


13-13: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


14-14: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


15-15: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


18-18: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


20-20: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


21-21: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


22-22: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


66-66: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


102-102: Column: 1 (MD010, no-hard-tabs)
Hard tabs


103-103: Column: 1 (MD010, no-hard-tabs)
Hard tabs


105-105: Column: 1 (MD010, no-hard-tabs)
Hard tabs


106-106: Column: 1 (MD010, no-hard-tabs)
Hard tabs


107-107: Column: 1 (MD010, no-hard-tabs)
Hard tabs


108-108: Column: 1 (MD010, no-hard-tabs)
Hard tabs


109-109: Column: 1 (MD010, no-hard-tabs)
Hard tabs


110-110: Column: 1 (MD010, no-hard-tabs)
Hard tabs


111-111: Column: 1 (MD010, no-hard-tabs)
Hard tabs


112-112: Column: 1 (MD010, no-hard-tabs)
Hard tabs


114-114: Column: 1 (MD010, no-hard-tabs)
Hard tabs


125-125: Column: 1 (MD010, no-hard-tabs)
Hard tabs


134-134: Column: 1 (MD010, no-hard-tabs)
Hard tabs


135-135: Column: 1 (MD010, no-hard-tabs)
Hard tabs


49-49: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


138-138: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


154-154: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


168-168: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines

@@ -95,8 +95,7 @@ type InflationCalculationFn func(ctx sdk.Context, minter Minter, params Params,
The target annual inflation rate is recalculated each block.
The inflation is also subject to a rate change (positive or negative)
depending on the distance from the desired ratio (67%). The maximum rate change
possible is defined to be 13% per year, however, the annual inflation is capped
as between 7% and 20%.
possible is defined to be 5% per year, however, the annual inflation is capped between 0% and 5%.
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the grammatical structure around "however".

- possible is defined to be 5% per year, however, the annual inflation is capped between 0% and 5%.
+ possible is defined to be 5% per year; however, the annual inflation is capped between 0% and 5%.
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
possible is defined to be 5% per year, however, the annual inflation is capped between 0% and 5%.
possible is defined to be 5% per year; however, the annual inflation is capped between 0% and 5%.
Tools
LanguageTool

[typographical] ~98-~98: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence. (HOWEVER_SENTENCE)
Context: ...ge possible is defined to be 5% per year, however, the annual inflation is capped between ...

@tac0turtle tac0turtle enabled auto-merge June 10, 2024 15:28
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.

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
x/mint/types/minter_test.go (1)

26-26: Update the comment to reflect the new inflation parameters.

The comment mentions "0% bonded atom supply the inflation should increase by InflationRateChange," but it should explicitly reflect the new inflation parameters for clarity.

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b9584e5 and e93c39d.

Files selected for processing (1)
  • x/mint/types/minter_test.go (1 hunks)
Additional context used
Path-based instructions (1)
x/mint/types/minter_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

Additional comments not posted (3)
x/mint/types/minter_test.go (3)

31-31: Ensure test cases align with new inflation parameters.

The test cases have been updated to reflect the new inflation parameters accurately. This includes the expected changes in inflation based on different bonded ratios. Good job on updating these to maintain test relevance with the new business logic.

Also applies to: 37-37, 42-42, 46-46, 50-50


43-43: Check for potential edge cases in inflation calculations.

#!/bin/bash
# Description: Verify edge cases for inflation calculations.

# Test: Search for additional test cases handling edge values.
rg --type go 'NextInflationRate' x/mint/types/minter_test.go

Consider adding more test cases to cover potential edge cases, especially where inflation might hit the exact boundary values of 0% and 5%.


47-47: Verify the handling of large decimal values in inflation calculations.

#!/bin/bash
# Description: Verify handling of large decimal values.

# Test: Search for handling of large decimals in inflation calculations.
rg --type go 'math.LegacyNewDecWithPrec(499999999, 10)' x/mint/types/minter_test.go

Ensure that the handling of large decimal values in inflation calculations is robust and does not introduce precision errors.

@tac0turtle tac0turtle added this pull request to the merge queue Jun 11, 2024
Merged via the queue into main with commit 76a28ad Jun 11, 2024
63 of 65 checks passed
@tac0turtle tac0turtle deleted the marko/mint_defaults branch June 11, 2024 09:40
alpe added a commit that referenced this pull request Jun 12, 2024
* main:
  refactor(x/auth): Fix system test (#20531)
  feat(crypto): add blst (#20296)
  docs: Update high level overview and introduction (#20535)
  refactor(x/core): remove test (#20624)
  feat(x/mint)!: Replace InflationCalculationFn with MintFn + simple epoch minting (#20363)
  docs: remove duplicate words (#20622)
  feat: prep for errors v2 (#20539)
  chore: reduce default inflation (#20606)
  refactor(store): add miss defer (#20602)
  chore: use comet api pkg instead of comet alias (#20614)
  chore: write gentx info to cmd.ErrOrStderr (#20616)
  docs: ADR 073: update to accepted and add to README.md (#20619)
  chore(proto): change future extracted modules version from v1.0.0 to v0.2.0 (#20600)
  fix: remove some duplicate words (#20605)
  feat(stf): port simappv2 changes (#20587)
  chore: bring patch changelogs to main (#20599)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants