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

Add UpdateParams to attribute module #1987

Merged

Conversation

nullpointer0x00
Copy link
Contributor

@nullpointer0x00 nullpointer0x00 commented May 21, 2024

Description

Added UpdateParams rpc end point and a cli command.

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

Summary by CodeRabbit

  • New Features

    • Introduced an UpdateParams endpoint and CLI for the attribute module, enabling users to update attribute parameters via governance proposals.
    • Added new message types and RPC methods to support the UpdateParams functionality.
    • Enhanced the system with event emission for updated attribute parameters.
  • Documentation

    • Updated documentation to include MsgUpdateParamsResponse definition and descriptions for the new UpdateParams endpoint.
  • Tests

    • Implemented various test cases to validate the UpdateParams functionality and authority management.

Copy link
Contributor

coderabbitai bot commented May 21, 2024

Walkthrough

This update brings a significant enhancement to the project by introducing an UpdateParams endpoint and CLI for the attribute module. It includes changes across various files to support this new functionality, such as adding message types, RPC methods, and tests for integration with governance proposals.

Changes

File(s) Change Summary
CHANGELOG.md Introduces UpdateParams endpoint and CLI for the attribute module.
client/docs/swagger-ui/swagger.yaml Adds MsgUpdateParamsResponse definition for the UpdateParams endpoint response.
proto/.../attribute/v1/attribute.proto Includes EventAttributeParamsUpdated message for updated attribute parameters.
proto/.../attribute/v1/tx.proto Adds UpdateParams RPC method, MsgUpdateParamsRequest, and MsgUpdateParamsResponse message types.
x/attribute/client/cli/tx.go Introduces NewUpdateParamsCmd for updating attribute module params via governance proposal.
x/attribute/keeper/keeper.go Adds authority management functions and an authority field to the Keeper struct.
x/attribute/keeper/msg_server.go Includes UpdateParams function to handle governance proposals for updating attribute module parameters.
x/attribute/keeper/msg_server_test.go Adds TestUpdateParams to test parameter updates with various scenarios.
x/attribute/types/events.go Introduces NewEventAttributeParamsUpdated function for creating an event with updated parameters.
x/attribute/types/msgs.go Adds MsgUpdateParamsRequest message type and related creation and validation functions.
x/attribute/types/msgs_test.go Includes TestMsgUpdateParamsRequest to validate MsgUpdateParamsRequest with different scenarios.
x/marker/client/cli/cli_test.go Adds import for attribute/client/cli and TestUpdateParamsProposal to define test cases for submitting update params proposals.

🐇
In the realm of code so bright,
Parameters take a new flight.
With updates swift and changes grand,
Governance now lends a hand.
Attributes now can change their song,
Through endpoints where they belong.
Celebrate this code's delight,
In the rabbit's moonlit night.
🌙


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.

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

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.

@nullpointer0x00 nullpointer0x00 self-assigned this May 21, 2024
@nullpointer0x00 nullpointer0x00 marked this pull request as ready for review May 21, 2024 19:33
@nullpointer0x00 nullpointer0x00 requested a review from a team as a code owner May 21, 2024 19:33
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

Outside diff range and nitpick comments (4)
CHANGELOG.md (4)

Line range hint 109-355: Consider using a consistent style for unordered lists. The markdown file uses dashes (-) instead of asterisks (*). While both are valid, using a consistent style improves readability and maintainability of the document.

- - message #<issue-number>
+ * message #<issue-number>

Line range hint 229-229: It's recommended to use Markdown link syntax instead of bare URLs for better readability and to provide descriptive link text which improves accessibility.

- https://github.com/provenance-io/provenance/issues/1772
+ [Issue #1772](https://github.com/provenance-io/provenance/issues/1772)

Also applies to: 260-260, 359-359, 409-409, 421-421, 437-437, 508-508, 519-519, 527-527, 563-563, 588-588, 600-600, 646-650, 697-697, 738-738, 791-791, 904-904


Line range hint 946-946: Remove unnecessary spaces inside emphasis markers to maintain proper Markdown formatting.

- * ` MsgUpdateParamsRequest ` 
+ * `MsgUpdateParamsRequest`

Line range hint 342-342: Remove unnecessary spaces inside code span elements to maintain proper Markdown formatting.

- ` provenanced query account `
+ `provenanced query account`
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 946a83b and 0ff49ca.
Files ignored due to path filters (2)
  • x/attribute/types/attribute.pb.go is excluded by !**/*.pb.go
  • x/attribute/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (12)
  • CHANGELOG.md (1 hunks)
  • client/docs/swagger-ui/swagger.yaml (1 hunks)
  • proto/provenance/attribute/v1/attribute.proto (1 hunks)
  • proto/provenance/attribute/v1/tx.proto (3 hunks)
  • x/attribute/client/cli/tx.go (4 hunks)
  • x/attribute/keeper/keeper.go (3 hunks)
  • x/attribute/keeper/msg_server.go (1 hunks)
  • x/attribute/keeper/msg_server_test.go (1 hunks)
  • x/attribute/types/events.go (2 hunks)
  • x/attribute/types/msgs.go (2 hunks)
  • x/attribute/types/msgs_test.go (2 hunks)
  • x/marker/client/cli/cli_test.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • client/docs/swagger-ui/swagger.yaml
Additional Context Used
GitHub Check Runs (1)
golangci-lint failure (11)

x/attribute/keeper/msg_server.go: [failure] 269-269:
Error return value of (github.com/cosmos/cosmos-sdk/types.EventManagerI).EmitTypedEvent is not checked (errcheck)

Additional comments not posted (8)
proto/provenance/attribute/v1/attribute.proto (1)

116-119: The addition of EventAttributeParamsUpdated is well-defined and aligns with the module's functionality.

x/attribute/types/events.go (1)

126-128: The implementation of NewEventAttributeParamsUpdated correctly formats maxValueLength for event logging.

x/attribute/types/msgs.go (1)

154-168: The addition of MsgUpdateParamsRequest and its validation logic are correctly implemented, ensuring the authority field is a valid address.

x/attribute/types/msgs_test.go (1)

164-200: The tests for MsgUpdateParamsRequest are comprehensive and effectively validate the message's basic constraints.

proto/provenance/attribute/v1/tx.proto (1)

35-36: The addition of the UpdateParams RPC method is correctly implemented and aligns with the module's functionality.

x/attribute/keeper/msg_server_test.go (1)

330-373: The implementation of TestUpdateParams is robust, covering essential success and failure scenarios. Good use of structured tests and clear error messages enhances maintainability.

x/attribute/client/cli/tx.go (1)

322-352: The NewUpdateParamsCmd function is well-implemented, providing a clear and user-friendly interface for updating attribute module parameters via governance proposals. Error handling and command structure are appropriately managed.

x/attribute/keeper/keeper.go (1)

65-81: The implementation of authority management functions (GetAuthority, IsAuthority, ValidateAuthority) is clear and concise. Good use of case-insensitive comparison and informative error messages enhances the robustness and maintainability of the module.

x/marker/client/cli/cli_test.go Show resolved Hide resolved
x/attribute/keeper/msg_server.go Outdated Show resolved Hide resolved
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0ff49ca and a69e123.
Files selected for processing (1)
  • x/attribute/keeper/msg_server.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/attribute/keeper/msg_server.go

@nullpointer0x00 nullpointer0x00 enabled auto-merge (squash) May 21, 2024 21:59
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 (5)
CHANGELOG.md (5)

Line range hint 110-356: Consistency in list item markers is important for maintaining a uniform style in markdown files. It's recommended to use either asterisks (*) or dashes (-) consistently for list items. The current file uses both, which can be visually inconsistent and potentially confusing. Consider standardizing to one style.

- -
+ *

Also applies to: 712-712, 720-720, 765-765, 773-773


Line range hint 819-819: Multiple consecutive blank lines found in the document. It's a good practice to limit to one blank line to separate sections or elements for better readability and to maintain a clean and professional appearance in the document.

- 

+

Also applies to: 1220-1220, 1237-1237, 1289-1289, 1393-1393


Line range hint 230-230: Bare URLs are used in the document. It's a good practice to use descriptive link text rather than bare URLs. Descriptive links are more accessible and improve the readability of the document.

- https://github.com/provenance-io/provenance/issues/123
+ [Issue #123](https://github.com/provenance-io/provenance/issues/123)

Also applies to: 261-261, 360-360, 410-410, 422-422, 438-438, 509-509, 520-520, 528-528, 564-564, 589-589, 601-601, 647-651, 698-698, 739-739, 792-792, 905-905


Line range hint 947-947: Spaces found inside emphasis markers. This can lead to rendering issues in some markdown parsers. It's recommended to remove any leading or trailing spaces inside emphasis markers.

- * emphasized text *
+ *emphasized text*

Line range hint 343-343: Spaces found inside code span elements. This can lead to unintended display of spaces in the formatted document. It's recommended to remove any leading or trailing spaces inside code spans.

- ` code `
+ `code`
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between a69e123 and 11cdb34.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)

@nullpointer0x00 nullpointer0x00 merged commit 0210fda into main May 22, 2024
27 of 36 checks passed
@nullpointer0x00 nullpointer0x00 deleted the nullpointer0x00/add-update-params-to-attribute-module branch May 22, 2024 14:15
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