osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

fix: state export for gov module constitution

Open PaddyMc opened this issue 1 year ago • 1 comments

What is the purpose of the change

Currently the export of Osmosis to genesis state isn't working as expected because of the export of gov is missing a gov collection key.

see: https://github.com/cosmos/cosmos-sdk/issues/21887

Testing and Verifying

Unit test:

  • cd ./app/upgrades/v27
  • go test ./...

in-place-testnet:

  • do the in-place-testnet dance
  • osmosisd export --modules-to-export "gov"

BUG:

panic: collections: not found: key 'no_key' of type string

goroutine 4433 [running]:
github.com/cosmos/cosmos-sdk/x/gov.AppModule.ExportGenesis({{{0x6283970, 0xc000fae690}, {0x0, 0x0, 0x0}, {0x6200fc8, 0xc00217ee40}}, 0xc0043a8408, {0x6241700, 0xc000356500}, ...}, ...)
	github.com/cosmos/[email protected]/x/gov/module.go:310 +0xbf
github.com/cosmos/cosmos-sdk/types/module.(*Manager).ExportGenesisForModules.func2({0x789e1f0e1468, 0xc0043ccfc0}, 0xc063aa9260)
	github.com/cosmos/[email protected]/types/module/module.go:578 +0x12d
created by github.com/cosmos/cosmos-sdk/types/module.(*Manager).ExportGenesisForModules in goroutine 1
	github.com/cosmos/[email protected]/types/module/module.go:576 +0x770

Documentation and Release Note

  • [ ] Does this pull request introduce a new feature or user-facing behavior changes?
  • [ ] Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • [ ] Specification (x/{module}/README.md)
  • [ ] Osmosis documentation site
  • [ ] Code comments?
  • [ ] N/A

PaddyMc avatar Oct 15 '24 20:10 PaddyMc

Walkthrough

The pull request introduces updates to the CHANGELOG.md file, enhancing its structure and adding entries for various releases of the Osmosis project, including a bug fix for the governance module. Additionally, it modifies the app/upgrades/v27/upgrades.go file to improve the upgrade handler functionality by adding a new function for initializing a constitution collection. A new test suite is also introduced in upgrades_test.go to validate the upgrade logic and governance module behavior for version 27.

Changes

File Change Summary
CHANGELOG.md Updated format and added entries under "Unreleased" for state breaking, config, and bug fixes.
Updated entries for versions v26.0.1 and v26.0.0 detailing features, improvements, and bug fixes.
app/upgrades/v27/upgrades.go Added import for govkeeper, updated CreateUpgradeHandler to initialize constitution collection, and defined InitializeConstitutionCollection function.
app/upgrades/v27/upgrades_test.go Introduced a test suite with methods to validate upgrade logic and governance module behavior.

Possibly related PRs

  • #8686: This PR adds a missing changelog entry related to additional queries in the x/gauges module, which is relevant to the updates made in the main PR regarding the changelog.
  • #8698: This PR updates the changelog to reflect various modifications, including a chore to bump the cosmwasm-optimizer, which is also documented in the main PR's changelog updates.
  • #8751: This PR addresses supply offsets for the osmo token, which is mentioned in the changelog updates of the main PR, indicating a direct connection to the changes made.
  • #8779: This PR updates the changelog to include entries for the bump of the cometbft/cosmos-sdk versions, which aligns with the systematic approach to documenting changes in the main PR's updates to the changelog.

Suggested reviewers

  • czarcas7ic
  • nicolaslara
  • AlpinYukseloglu

📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 113687107c8a5c4771945bcd9c0953ee4b30a7c7 and 460563b3af8bc3a375d688888cedf7faa3d65ed8.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • app/upgrades/v27/upgrades.go (2 hunks)
  • app/upgrades/v27/upgrades_test.go (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • CHANGELOG.md
  • app/upgrades/v27/upgrades.go
  • app/upgrades/v27/upgrades_test.go

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

coderabbitai[bot] avatar Oct 17 '24 14:10 coderabbitai[bot]