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(x/group): extend group config and make it configurable #18448

Merged
merged 16 commits into from
Nov 27, 2023

Conversation

emidev98
Copy link
Contributor

@emidev98 emidev98 commented Nov 11, 2023

Description

This pull request extends group module config and allows setting a length for the Title, Summary and Metadata on the messsages.

Closes: #XXXX


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
  • added ! to 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
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • 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.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Summary by CodeRabbit

  • New Features

    • Introduced maximum length constraints for proposal titles and summaries in governance modules.
    • Added new configuration options for group modules, allowing for more detailed governance parameters.
  • Improvements

    • Enhanced error messages for metadata, summary, and title length validations.
    • Improved governance module by limiting accepted deposit coins to minimum proposal deposit denominations.
  • Bug Fixes

    • Fixed issues with metadata length validations in various modules.
  • Documentation

    • Updated comments and documentation to clarify the usage of new configuration parameters.
  • Refactor

    • Reorganized codebase to accommodate new configuration structures and validation methods.
  • Style

    • Adjusted code formatting to align with new configuration options.
  • Chores

    • Updated CHANGELOG.md with summaries of recent changes and improvements.

@emidev98 emidev98 requested a review from a team as a code owner November 11, 2023 19:34
Copy link
Contributor

coderabbitai bot commented Nov 11, 2023

Warning

Rate Limit Exceeded

@emidev98 has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 12 minutes and 24 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. 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 861655e and a2fb975.

Walkthrough

The changes involve extending the configuration of the Cosmos SDK's group module to include new fields for maximum proposal title and summary lengths. New validation functions and error messages have been added to enforce these constraints. The Config struct has been updated across various files, with group.DefaultConfig() being replaced by grouptypes.DefaultConfig(). The changes also include updates to the protobuf definitions and reflect a broader reorganization or refactoring of the codebase related to group functionality.

Changes

File(s) Change Summary
api/cosmos/group/module/v1/module.pulsar.go
proto/cosmos/group/module/v1/module.proto
x/group/config.go
x/group/types/config.go
Added new fields for maximum proposal title and summary lengths to the Module struct and updated protobuf definitions.
x/group/errors/errors.go Introduced new error variables for metadata, summary, and title length constraints.
x/group/keeper/keeper.go
x/group/keeper/keeper_test.go
x/group/keeper/msg_server.go
x/group/keeper/msg_server_test.go
x/group/keeper/genesis_test.go
x/group/keeper/grpc_query_test.go
Updated the Keeper struct with new validation methods and replaced group.Config with grouptypes.Config.
x/group/module/module.go
simapp/app.go
Modified the ProvideModule function and NewSimApp function to handle new configuration parameters.
x/group/simulation/operations.go
x/group/types.go
x/group/types_test.go
Reflected changes in configuration handling and updated import statements.
CHANGELOG.md
x/gov/CHANGELOG.md
x/group/CHANGELOG.md
Documented changes related to group and governance config extensions and other improvements.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b7fb292 and 39ccfd3.
Files ignored due to filter (1)
  • x/group/go.mod
Files selected for processing (9)
  • api/cosmos/group/module/v1/module.pulsar.go (15 hunks)
  • proto/cosmos/group/module/v1/module.proto (1 hunks)
  • x/group/errors/errors.go (1 hunks)
  • x/group/keeper/keeper.go (4 hunks)
  • x/group/keeper/msg_server.go (2 hunks)
  • x/group/module/module.go (2 hunks)
  • x/group/simulation/operations.go (3 hunks)
  • x/group/types.go (4 hunks)
  • x/group/types/config.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/group/types/config.go
Additional comments: 34
x/group/errors/errors.go (1)
  • 6-20: The new error variables ErrMetadataTooLong, ErrSummaryTooLong, and ErrTitleTooLong are correctly registered with unique error codes and appropriate messages. Ensure that these errors are properly handled in the code where length constraints are enforced.
proto/cosmos/group/module/v1/module.proto (4)
  • 18-19: Ensure that the max_execution_period field is being used correctly throughout the codebase.

  • 21-25: The comment for max_metadata_len is clear and the default value is set correctly.

  • 27-31: The comment for max_proposal_title_len is clear and the default value is set correctly.

  • 33-37: The comment for max_proposal_summary_len is clear and the default value is set correctly.

x/group/simulation/operations.go (3)
  • 13-13: The new import statement is correctly placed in alphabetical order.

  • 426-429: The Validate function now uses the grouptypes.DefaultConfig(). Ensure that this change is reflected in all calls to Validate.

  • 894-897: The Validate function now uses the grouptypes.DefaultConfig(). Ensure that this change is reflected in all calls to Validate.

x/group/types.go (4)
  • 14-17: The new import statement for grouptypes has been added correctly.

  • 45-49: The Validate function signatures of the ThresholdDecisionPolicy and PercentageDecisionPolicy structs have been updated to use grouptypes.Config. Ensure that all calls to these functions throughout the codebase have been updated to match the new signature.

  • 137-143: The Validate function of ThresholdDecisionPolicy struct has been updated to use grouptypes.Config. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.

  • 189-195: The Validate function of PercentageDecisionPolicy struct has been updated to use grouptypes.Config. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.

x/group/module/module.go (2)
  • 18-24: The import of the grouptypes package is a new addition. Ensure that this package is available and accessible.

  • 207-234: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [209-235]

The ProvideModule function has been updated to initialize defaultConfig using grouptypes.DefaultConfig(). It then conditionally updates defaultConfig based on in.Config values. The keeper.NewKeeper function call has been modified to include the defaultConfig parameter. Ensure that all calls to ProvideModule have been updated to match the new function signature and that the defaultConfig values are being set correctly.

- k := keeper.NewKeeper(in.Key, in.Cdc, in.MsgServiceRouter, in.AccountKeeper)
+ k := keeper.NewKeeper(in.Key, in.Cdc, in.MsgServiceRouter, in.AccountKeeper, defaultConfig)
x/group/keeper/keeper.go (3)
  • 78-84: The Keeper struct has been updated to include a config field of type grouptypes.Config. This is a good practice as it allows the configuration to be easily accessed and modified within the Keeper methods.

  • 87-108: The NewKeeper function has been updated to accept a grouptypes.Config parameter and initialize the config field of the Keeper struct. It also sets default values for MaxMetadataLen, MaxProposalTitleLen, and MaxProposalSummaryLen if they are not provided. This is a good practice as it ensures that these values are always defined and prevents potential runtime errors.

  • 454-479: The new validation methods assertMetadataLength, assertSummaryLength, and assertTitleLength are introduced to enforce length constraints on metadata, proposal summary, and proposal title, respectively. These methods are crucial for maintaining data integrity and preventing potential errors or security vulnerabilities related to excessively long inputs.

x/group/keeper/msg_server.go (3)
  • 524-530: The assertMetadataLength and assertSummaryLength functions have been removed. Ensure that the length validation for msg.Metadata and msg.Summary is now handled elsewhere in the codebase.

  • 532-532: The validation order of msg.Metadata and msg.Title has been swapped. Ensure that this change does not affect the overall logic and error handling.

  • 1060-1062: The validateDecisionPolicies function is not affected by the changes in this pull request. No action is required.

api/cosmos/group/module/v1/module.pulsar.go (14)
  • 20-33: The new fields MaxProposalTitleLen and MaxProposalSummaryLen have been added to the Module struct and are being initialized in the init function. Ensure that these fields are being used correctly throughout the codebase.

  • 113-124: The MaxProposalTitleLen and MaxProposalSummaryLen fields are being checked for non-zero values. This is a good practice as it prevents unnecessary operations on zero values.

  • 144-147: The Has function has been updated to include the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 168-171: The Clear function has been updated to clear the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 194-199: The Get function has been updated to get the values of the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 224-227: The Set function has been updated to set the values of the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 255-258: The Mutable function has been updated to include the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 277-280: The New function has been updated to initialize the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 357-362: The Size function has been updated to include the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 392-401: The MarshalToSizedBuffer function has been updated to include the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 525-562: The Unmarshal function has been updated to include the new fields. This is a good practice as it ensures that the function's behavior remains consistent with the updated struct.

  • 620-634: The protobuf definition has been updated to include the new fields. This is a good practice as it ensures that the protobuf definition remains consistent with the updated struct.

  • 671-683: Getter methods for the new fields have been added. This is a good practice as it provides a safe way to access the fields of the struct.

  • 704-733: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [698-730]

The protobuf raw descriptor has been updated to include the new fields. This is a good practice as it ensures that the protobuf raw descriptor remains consistent with the updated struct.

@julienrbrt julienrbrt self-assigned this Nov 11, 2023
Copy link
Collaborator

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

Thanks for this change @emidev98! Just some initial comments.

x/group/keeper/keeper.go Outdated Show resolved Hide resolved
x/group/keeper/keeper.go Outdated Show resolved Hide resolved
x/group/keeper/keeper.go Outdated Show resolved Hide resolved
x/group/types/config.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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 39ccfd3 and 7566ae1.
Files selected for processing (6)
  • x/group/keeper/genesis_test.go (2 hunks)
  • x/group/keeper/grpc_query_test.go (2 hunks)
  • x/group/keeper/keeper.go (4 hunks)
  • x/group/keeper/keeper_test.go (4 hunks)
  • x/group/types/config.go (1 hunks)
  • x/group/types_test.go (2 hunks)
Additional comments: 12
x/group/types_test.go (2)
  • 7-20: The import path and the function call to get the default configuration have been updated to reflect the new package structure and configuration setup. Ensure that the new package and function provide the same functionality as the old ones.

  • 57-63: The import path and the function call to get the default configuration have been updated to reflect the new package structure and configuration setup. Ensure that the new package and function provide the same functionality as the old ones.

x/group/keeper/grpc_query_test.go (1)
  • 68-71: The groupKeeper initialization has been updated to use grouptypes.DefaultConfig() instead of group.DefaultConfig(). Ensure that this change is consistent with the intended configuration for the groupKeeper instance.
x/group/types/config.go (1)
  • 1-35: The new Config struct and DefaultConfig function are well defined and follow the best practices. The comments are clear and provide a good understanding of the purpose of each field in the Config struct. The default values in the DefaultConfig function seem reasonable, but you might want to verify these values with your team or stakeholders.
x/group/keeper/keeper_test.go (4)
  • 9-12: The import of the grouptypes package is a necessary change due to the shift in configuration handling for the group module.

  • 74-80: The replacement of group.DefaultConfig() with grouptypes.DefaultConfig() is consistent with the changes in the configuration handling for the group module. Also, the Keeper struct is now initialized with the new grouptypes.Config type.

  • 408-414: The calculation of minExecutionPeriod has been updated to use grouptypes.DefaultConfig().MaxExecutionPeriod. This change is consistent with the shift in configuration handling for the group module.

  • 472-478: The calculation of minExecutionPeriod has been updated to use grouptypes.DefaultConfig().MaxExecutionPeriod. This change is consistent with the shift in configuration handling for the group module.

x/group/keeper/genesis_test.go (2)
  • 6-12: The import statement has been updated to include the grouptypes package. This change is consistent with the pull request summary, which mentions a shift in the configuration handling for the group module.

  • 72-76: The keeper.NewKeeper function is now being called with grouptypes.DefaultConfig() instead of group.DefaultConfig(). This change is consistent with the pull request summary, which mentions a shift in the configuration handling for the group module. Ensure that the grouptypes.DefaultConfig() function is correctly defined and returns the expected default configuration.

x/group/keeper/keeper.go (2)
  • 78-93: The Keeper struct now includes a config field of type grouptypes.Config. This is a good change as it allows the module to have its own configuration, which can be easily extended in the future.

  • 95-107: The NewKeeper function now accepts a grouptypes.Config parameter and sets default values for certain configuration parameters if they are not provided. This is a good practice as it provides sensible defaults and allows the caller to override them if necessary.

x/group/keeper/keeper.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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7566ae1 and 2e97681.
Files ignored due to filter (1)
  • x/group/go.sum
Files selected for processing (3)
  • simapp/app.go (2 hunks)
  • x/group/keeper/keeper.go (4 hunks)
  • x/group/keeper/msg_server_test.go (11 hunks)
Additional comments: 8
simapp/app.go (2)
  • 12-12: The import path has been updated to reflect the new location of the group module. Ensure that the new path is correct and accessible.

  • 350-350: The group.DefaultConfig() function has been replaced with grouptypes.DefaultConfig(). Ensure that all instances of group.DefaultConfig() have been updated throughout the codebase.

x/group/keeper/keeper.go (4)
  • 10-14: The import of the grouptypes package is a new addition. Ensure that this package is available and accessible.

  • 78-93: The config field in the Keeper struct has been changed to grouptypes.Config. The NewKeeper function has been updated to initialize config with default values if they are not set by the app developer. This is a good practice as it provides sensible defaults and reduces the chance of misconfiguration.

  • 95-112: The config field is being initialized with default values if they are not set by the app developer. This is a good practice as it provides sensible defaults and reduces the chance of misconfiguration.

  • 459-484: Three new functions assertMetadataLength, assertSummaryLength, and assertTitleLength have been added to validate metadata, summary, and title lengths based on the configuration. This is a good practice as it ensures that the lengths of these fields do not exceed the maximum allowed lengths, thereby preventing potential issues such as database errors or memory overflows.

x/group/keeper/msg_server_test.go (2)
  • 108-115: The test case checks if the error is thrown when the metadata length exceeds the limit. Ensure that the limit is set correctly in the configuration.

  • 2322-2322: These test cases are checking if the error is thrown when the metadata length exceeds the limit. Ensure that the limit is set correctly in the configuration.

x/group/keeper/msg_server_test.go Show resolved Hide resolved
x/group/keeper/msg_server_test.go 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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2e97681 and 73c67c2.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional comments: 1
CHANGELOG.md (1)
  • 56-59: The changes are well-documented and the links to the pull requests provide a good reference for further details. Ensure that the pull request numbers and the links are correct.

@emidev98
Copy link
Contributor Author

Tank you @odeke-em! Changes applied, let me know if this looks better to you

@emidev98 emidev98 mentioned this pull request Nov 12, 2023
20 tasks
CHANGELOG.md Outdated
@@ -53,6 +53,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (x/group) [#18448](https://github.com/cosmos/cosmos-sdk/pull/18448) Extend group config
Copy link
Member

Choose a reason for hiding this comment

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

Can we get this one and the gov one entry in respectively group/CHANGELOG.md and gov changelog instead of the main one?

@@ -0,0 +1,35 @@
package types
Copy link
Member

Choose a reason for hiding this comment

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

Let's not create a type package. Group follows the latest module directory guidelines: https://docs.cosmos.network/main/build/building-modules/structure

// MaxMetadataLen defines the max chars allowed in all
// messages that allows creating or updating a group
// with a metadata field
// Defaults to 140 if not explicitly set.
Copy link
Member

Choose a reason for hiding this comment

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

This isn't true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out, consequences of copy paste

// MaxProposalTitleLen defines the max chars allowed
// in string for the MsgSubmitProposal and Proposal
// summary field
// Defaults to 140 if not explicitly set.
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out, consequences of copy paste

@julienrbrt
Copy link
Member

Gentle bump :)

@emidev98
Copy link
Contributor Author

I have not seen the comments, let me work these changes tomorrow and get back to you!

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 73c67c2 and 941e677.
Files ignored due to filter (1)
  • x/group/go.mod
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional comments: 1
CHANGELOG.md (1)
  • 57-57:
    The changelog entry for the group module should be moved to group/CHANGELOG.md as per the previous review comment.

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.

Review Status

Actionable comments generated: 6

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 941e677 and 5e28e26.
Files selected for processing (6)
  • proto/cosmos/group/module/v1/module.proto (1 hunks)
  • x/gov/CHANGELOG.md (1 hunks)
  • x/group/CHANGELOG.md (1 hunks)
  • x/group/config.go (1 hunks)
  • x/group/keeper/keeper.go (3 hunks)
  • x/group/module/module.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/gov/CHANGELOG.md
Additional comments: 2
x/group/CHANGELOG.md (1)
  • 27-33:

The changelog entries for pull requests #18448 and #18286 are correctly listed under the "Improvements" section and are formatted properly according to the guidelines. No further action is required for this hunk.

x/group/keeper/keeper.go (1)
  • 224-227:
    The NewKeeper function correctly initializes the Keeper and panics on unrecoverable errors, which is appropriate for setup functions.

x/group/config.go Outdated Show resolved Hide resolved
proto/cosmos/group/module/v1/module.proto Show resolved Hide resolved
x/group/module/module.go Outdated Show resolved Hide resolved
x/group/config.go Show resolved Hide resolved
x/group/keeper/keeper.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.

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5e28e26 and 0ce9a3c.
Files selected for processing (3)
  • x/group/config.go (1 hunks)
  • x/group/keeper/keeper.go (3 hunks)
  • x/group/module/module.go (1 hunks)
Additional comments: 2
x/group/config.go (1)
  • 25-32:
x/group/keeper/keeper.go (1)
  • 91-115:
    The default configuration logic is correctly implemented, ensuring that the system has sensible defaults if not provided by the app developer. The use of panic is appropriate for initialization failures of critical components.

x/group/keeper/keeper.go Show resolved Hide resolved
x/group/config.go Show resolved Hide resolved
x/group/config.go Show resolved Hide resolved
x/group/module/module.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you @emidev98

*/

k := keeper.NewKeeper(in.Key, in.Cdc, in.MsgServiceRouter, in.AccountKeeper, group.Config{MaxExecutionPeriod: in.Config.MaxExecutionPeriod.AsDuration(), MaxMetadataLen: in.Config.MaxMetadataLen})
if in.Config.MaxMetadataLen != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't necessary, let's revert this, it is already checked and updated in the keeper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason when removing this code and I send the config itself to the module without doing checks I get the following errors:
image

No matters how many times I build the proto nor if I remove the modules cache and try again. Any idea why that could happen to me in local?

Copy link
Member

Choose a reason for hiding this comment

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

My first guess was the missing API module replace but I do see it in the go.mod. 🤷🏾‍♂️, works for me locally.

x/group/module/module.go Outdated Show resolved Hide resolved
simapp/app.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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0ce9a3c and 66e7a52.
Files selected for processing (4)
  • api/cosmos/group/module/v1/module.pulsar.go (15 hunks)
  • simapp/app.go (2 hunks)
  • x/group/keeper/keeper.go (3 hunks)
  • x/group/module/module.go (1 hunks)
Additional comments: 17
api/cosmos/group/module/v1/module.pulsar.go (13)
  • 19-25: The addition of new fields MaxProposalTitleLen and MaxProposalSummaryLen to the Module struct is correctly reflected in the variable declarations.

  • 27-34: The init function has been correctly updated to initialize the field descriptors for the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 110-125: The Range method has been correctly updated to iterate over the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 141-150: The Has method has been correctly updated to check the presence of the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 165-174: The Clear method has been correctly updated to clear the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 191-202: The Get method has been correctly updated to retrieve the values of the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 221-230: The Set method has been correctly updated to set the values of the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 252-261: The Mutable method correctly panics for the new fields MaxProposalTitleLen and MaxProposalSummaryLen as they are not mutable.

  • 274-283: The NewField method has been correctly updated to return a new value for the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 354-365: The ProtoMethods method has been correctly updated to handle the size and marshaling of the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 522-565: The ProtoMethods method has been correctly updated to handle the unmarshaling of the new fields MaxProposalTitleLen and MaxProposalSummaryLen.

  • 617-635: The Module struct has been correctly updated to include the new fields MaxProposalTitleLen and MaxProposalSummaryLen with appropriate protobuf tags and comments.

  • 668-683: The getter methods GetMaxProposalTitleLen and GetMaxProposalSummaryLen in the Module struct are correctly implemented.

simapp/app.go (1)
  • 350-358: The group module configuration is provided as a commented-out example. Please verify that this is intentional and ensure that the actual configuration is set elsewhere in the codebase if necessary.
x/group/keeper/keeper.go (2)
  • 91-119: The logic for setting default configuration values in the NewKeeper function is correct and well-documented with examples. This ensures that the keeper is initialized with valid configuration values, even if the app developer does not provide them.

  • 466-491: The assert functions assertMetadataLength, assertSummaryLength, and assertTitleLength are correctly enforcing length constraints based on the module configuration. While additional documentation could be beneficial, the function names and parameters are self-explanatory, and the code is straightforward.

x/group/module/module.go (1)
  • 208-221: The changes to the ProvideModule function correctly incorporate the new configuration parameters MaxProposalTitleLen and MaxProposalSummaryLen. Ensure that these parameters are validated appropriately elsewhere in the codebase.

simapp/app.go Outdated Show resolved Hide resolved
x/group/module/module.go Outdated Show resolved Hide resolved
x/gov/CHANGELOG.md Outdated Show resolved Hide resolved
x/group/CHANGELOG.md 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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 339750c and 829e22b.
Files selected for processing (1)
  • x/group/module/module.go (1 hunks)
Additional comments: 1
x/group/module/module.go (1)
  • 208-221: The changes to the ProvideModule function correctly integrate the new configuration parameters MaxProposalTitleLen and MaxProposalSummaryLen into the group.Config struct. Ensure that these new parameters are validated appropriately elsewhere in the codebase, as the hunk does not show validation logic.

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 829e22b and 861655e.
Files selected for processing (1)
  • x/gov/CHANGELOG.md (1 hunks)

x/gov/CHANGELOG.md Show resolved Hide resolved
@julienrbrt julienrbrt added this pull request to the merge queue Nov 27, 2023
Merged via the queue into cosmos:main with commit 0917d34 Nov 27, 2023
58 of 60 checks passed
@emidev98 emidev98 deleted the cosmos/main branch November 29, 2023 05:50
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.

3 participants