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: update gov default params #906

Merged
merged 1 commit into from
Jan 16, 2025
Merged

feat: update gov default params #906

merged 1 commit into from
Jan 16, 2025

Conversation

zakir-code
Copy link
Contributor

@zakir-code zakir-code commented Jan 15, 2025

Summary by CodeRabbit

  • New Features

    • Updated governance module parameters
    • Adjusted minimum deposit and deposit ratio settings
  • Chores

    • Migrated governance parameters during upgrade process
    • Streamlined governance module configuration
  • Tests

    • Updated test cases with reduced deposit amounts for governance module

Copy link

coderabbitai bot commented Jan 15, 2025

Walkthrough

The pull request introduces significant changes to the governance module's configuration across multiple files. The modifications primarily focus on adjusting governance parameters, including minimum deposit amounts, deposit ratios, and expedited deposit requirements. The changes span the genesis configuration, upgrade process, and test cases, reflecting a comprehensive update to the governance module's initialization and parameter management.

Changes

File Change Summary
app/genesis.go Streamlined newDefAppGenesisByDenom function with direct assignments of governance parameters
app/genesis.json Updated governance parameters: increased min deposit, modified deposit ratios, changed expedited deposit denomination
app/upgrades/v8/upgrade.go Added migrateGovDefaultParams function, updated governance keeper type, integrated parameter migration
x/gov/keeper/keeper_test.go Reduced deposit amounts in test cases from 1000 to 10 and 9000 to 90 coins

Sequence Diagram

sequenceDiagram
    participant Genesis as Genesis Initialization
    participant Upgrade as Upgrade Process
    participant GovKeeper as Governance Keeper
    
    Genesis->>GovKeeper: Set Initial Governance Parameters
    Upgrade->>GovKeeper: Migrate Default Parameters
    GovKeeper-->>Upgrade: Update MinDeposit
    GovKeeper-->>Upgrade: Update ExpeditedMinDeposit
    GovKeeper-->>Upgrade: Update Deposit Ratios
Loading

Possibly related PRs

Poem

🐰 Governance hops with new delight,
Parameters dancing, shining bright
Deposits shift, ratios realign
A rabbit's code, now more divine!
Upgrade complete, the system sings 🎉


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc7ebab and d86cecd.

📒 Files selected for processing (4)
  • app/genesis.go (1 hunks)
  • app/genesis.json (1 hunks)
  • app/upgrades/v8/upgrade.go (5 hunks)
  • x/gov/keeper/keeper_test.go (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🔇 Additional comments (5)
app/genesis.go (1)

78-82: LGTM! Clear and consistent parameter initialization.

The governance parameters are initialized with well-defined values:

  • MinDeposit: 30 PUNDIAI
  • ExpeditedMinDeposit: 150 PUNDIAI (5x MinDeposit)
  • MinInitialDepositRatio: 33%
  • MinDepositRatio: 0%
x/gov/keeper/keeper_test.go (1)

85-85: Verify test deposit amounts against new governance parameters.

The test uses 10 + 90 = 100 coins total deposit, but this exceeds the new MinDeposit of 30 coins. Consider adjusting the test values to better test the boundary conditions:

  • Initial deposit: 5 coins (below MinInitialDepositRatio of 33% * 30 = 10 coins)
  • Second deposit: 25 coins (reaches MinDeposit of 30 coins)
-	firstCoins := helpers.NewStakingCoins(10, 18)
+	firstCoins := helpers.NewStakingCoins(5, 18)
-	secondCoins := helpers.NewStakingCoins(90, 18)
+	secondCoins := helpers.NewStakingCoins(25, 18)
-	initCoins := helpers.NewStakingCoins(10, 18)
+	initCoins := helpers.NewStakingCoins(5, 18)

Also applies to: 100-100, 115-115

app/upgrades/v8/upgrade.go (2)

533-547: LGTM! Consistent parameter migration.

The migration function correctly sets the new governance parameters, maintaining consistency with the genesis configuration.


82-84: LGTM! Proper upgrade flow integration.

The governance parameter migration is correctly integrated into the testnet upgrade process.

app/genesis.json (1)

341-341: LGTM! Consistent genesis configuration.

The governance parameters in genesis.json align perfectly with the values set in the code:

  • min_deposit: 30 PUNDIAI
  • min_initial_deposit_ratio: 0.33
  • expedited_min_deposit: 150 PUNDIAI
  • min_deposit_ratio: 0

Also applies to: 349-349, 356-357, 363-363

Finishing Touches

  • 📝 Generate Docstrings (Beta)

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@fx0x55 fx0x55 merged commit 70587c2 into main Jan 16, 2025
13 checks passed
@fx0x55 fx0x55 deleted the nulnut/update-gov-params branch January 16, 2025 01:31
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.

3 participants