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: added deprecated proposal, compatible history #622

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

zakir-code
Copy link
Contributor

@zakir-code zakir-code commented Aug 5, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new message type, MsgUpdateParams, to enhance governance parameter updates.
    • Added support for handling legacy message types in the governance module.
  • Bug Fixes

    • Updated test assertions to reflect an increase in registered interfaces, ensuring accurate validation.
  • Documentation

    • Enhanced CHANGELOG with clarity on compatibility fixes and changes related to governance messages.

Copy link

coderabbitai bot commented Aug 5, 2024

Walkthrough

The recent changes introduce a new governance message type, MsgUpdateParams, which enhances functionality related to parameter updates in a blockchain context. The modifications span several files, adding clarity to the changelog, adjusting tests, and expanding the codec capabilities to accommodate legacy message formats. Overall, these updates improve the system's interoperability and ensure robust governance processes.

Changes

File Path Summary
CHANGELOG.md Added entry for v7.4.0-rc5, documenting a compatibility fix; previous version remains unchanged.
app/encoding_test.go Adjusted expected assertion value in TestMakeEncodingConfig_RegisterInterfaces from 298 to 299.
app/interface_registry.json Introduced "/fx.gov.v1.MsgUpdateParams" to enhance governance parameter updates.
proto/fx/gov/v1/legacy.proto Defined MsgUpdateParams and LegacyParams schemas for governance messages; marked as deprecated.
x/gov/legacy/legacy_msg.go Added MsgUpdateParams with routing, signing, and validation methods for governance updates.
x/gov/types/codec.go Imported legacy package and registered legacy.MsgUpdateParams in the codec interface.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Governance
    participant Legacy
    User->>Governance: Request Update with MsgUpdateParams
    Governance->>Legacy: Validate Authority and Parameters
    Legacy-->>Governance: Return Validation Result
    Governance-->>User: Confirm Update
Loading

🐰 In the fields where the bunnies play,
New messages hop in, brightening the day!
Params are updated, the code's a delight,
With each little change, our future is bright!
Let's dance in the meadows, with joy we'll proclaim,
For every new feature, let’s cheer and exclaim! 🌼✨


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

Copy link

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

Caution

Inline review comments failed to post

Actionable comments posted: 2

Outside diff range, codebase verification and nitpick comments (2)
proto/fx/gov/v1/legacy.proto (2)

12-17: Make the deprecation warning more prominent.

The MsgUpdateParams message is marked as deprecated. Consider making the deprecation warning more prominent to ensure developers avoid using it.

-// Deprecated: Do not use.
+// DEPRECATED: Do not use this message. It will be removed in future versions.

19-67: Make the deprecation warning more prominent and review comments for clarity.

The LegacyParams message is marked as deprecated. Consider making the deprecation warning more prominent to ensure developers avoid using it. Additionally, review the comments for clarity and consistency.

-// Deprecated: Do not use.
+// DEPRECATED: Do not use this message. It will be removed in future versions.

-//  The ratio representing the proportion of the deposit value that must be
-//  paid at proposal submission.
+// The ratio representing the proportion of the deposit value that must be
+// paid at proposal submission.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 36821cd and 5586071.

Files ignored due to path filters (1)
  • x/gov/legacy/legacy.pb.go is excluded by !**/*.pb.go
Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • app/encoding_test.go (1 hunks)
  • app/interface_registry.json (3 hunks)
  • proto/fx/gov/v1/legacy.proto (1 hunks)
  • x/gov/legacy/legacy_msg.go (1 hunks)
  • x/gov/types/codec.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
Additional comments not posted (8)
x/gov/legacy/legacy_msg.go (3)

11-12: LGTM!

The Route method correctly returns the module name.


23-26: LGTM!

The GetSigners method correctly returns the expected signers.


28-33: LGTM!

The ValidateBasic method correctly validates the Authority field and returns an appropriate error if validation fails.

x/gov/types/codec.go (1)

32-32: LGTM!

The RegisterInterfaces method correctly registers the new message type MsgUpdateParams from the legacy package, enhancing the module's interoperability and compatibility with legacy message formats.

app/encoding_test.go (1)

47-47: LGTM!

The modified assertion correctly reflects the addition of the new interface, ensuring the test accurately validates the current state of the system.

app/interface_registry.json (3)

198-198: LGTM!

The addition of "/fx.gov.v1.MsgUpdateParams" in the TypeURLMap section is correct and consistent with the existing entries.


415-415: LGTM!

The addition of "/fx.gov.v1.MsgUpdateParams" in the Msgs section is correct and consistent with the existing entries.


503-503: LGTM!

The addition of "/fx.gov.v1.MsgUpdateParams" in the ProposalMsgs section is correct and consistent with the existing entries.

Comments failed to post (2)
x/gov/legacy/legacy_msg.go

14-15: Return a non-empty string for the message type.

The Type method should return a meaningful string representing the message type instead of an empty string.

-  return ""
+  return "update_params"
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.

// Type returns the MsgUpdateParams message type.
func (m *MsgUpdateParams) Type() string { return "update_params" }

17-21: Return the correct sign bytes.

The GetSignBytes method should return the raw bytes that need to be signed, not an empty byte array.

-  return []byte{}
+  bz, err := json.Marshal(m)
+  if err != nil {
+    panic(err)
+  }
+  return sdk.MustSortJSON(bz)
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.

// GetSignBytes returns the raw bytes for a MsgUpdateParams message that
// the expected signer needs to sign.
func (m *MsgUpdateParams) GetSignBytes() []byte {
  bz, err := json.Marshal(m)
  if err != nil {
    panic(err)
  }
  return sdk.MustSortJSON(bz)
}

@zakir-code zakir-code merged commit 909b01b into main Aug 5, 2024
10 checks passed
@zakir-code zakir-code deleted the nulnut/fix-gov-migrations branch August 5, 2024 04:26
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