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
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 151 additions & 22 deletions api/cosmos/group/module/v1/module.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion proto/cosmos/group/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,21 @@ message Module {
google.protobuf.Duration max_execution_period = 1
[(gogoproto.stdduration) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true];

// max_metadata_len defines the max length of the metadata bytes field for various entities within the group module.
// MaxMetadataLen defines the max chars allowed in all
// messages that allows creating or updating a group
// with a metadata field
// Defaults to 255 if not explicitly set.
uint64 max_metadata_len = 2;

// MaxProposalTitleLen defines the max chars allowed
// in string for the MsgSubmitProposal and Proposal
// summary field
// Defaults to 255 if not explicitly set.
uint64 max_proposal_title_len = 3;

// MaxProposalSummaryLen defines the max chars allowed
// in string for the MsgSubmitProposal and Proposal
// summary field
// Defaults to 10200 if not explicitly set.
uint64 max_proposal_summary_len = 4;
emidev98 marked this conversation as resolved.
Show resolved Hide resolved
}
8 changes: 6 additions & 2 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"

"cosmossdk.io/x/group"
emidev98 marked this conversation as resolved.
Show resolved Hide resolved
abci "github.com/cometbft/cometbft/abci/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
Expand Down Expand Up @@ -348,8 +349,11 @@ func NewSimApp(

groupConfig := group.DefaultConfig()
/*
Example of setting group params:
groupConfig.MaxMetadataLen = 1000
Example of group params:
config.MaxExecutionPeriod = "1209600s" // example execution period in seconds
config.MaxMetadataLen = 1000 // example metadata length in bytes
config.MaxProposalTitleLen = 255 // example max title length in characters
config.MaxProposalSummaryLen = 10200 // example max summary length in characters
*/
app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AuthKeeper, groupConfig)

Expand Down
4 changes: 4 additions & 0 deletions x/gov/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

## Improvements

* [18449](https://github.com/cosmos/cosmos-sdk/pull/18449) Clean validationcode
emidev98 marked this conversation as resolved.
Show resolved Hide resolved

### Features

### API Breaking Changes
1 change: 1 addition & 0 deletions x/group/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* [18448](https://github.com/cosmos/cosmos-sdk/pull/18448) Extend group config
emidev98 marked this conversation as resolved.
Show resolved Hide resolved
* [18286](https://github.com/cosmos/cosmos-sdk/pull/18286) Move prefix store creation down after error checks.

### Features
Expand Down
21 changes: 17 additions & 4 deletions x/group/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@ package group

import "time"

// Config is a config struct used for intialising the group module to avoid using globals.
// Config used to initialize x/group module avoiding using global variable.
type Config struct {
// MaxExecutionPeriod defines the max duration after a proposal's voting
// period ends that members can send a MsgExec to execute the proposal.
MaxExecutionPeriod time.Duration
// MaxMetadataLen defines the max length of the metadata bytes field for various entities within the group module. Defaults to 255 if not explicitly set.

// MaxMetadataLen defines the max chars allowed in all
// messages that allows creating or updating a group
// with a metadata field
MaxMetadataLen uint64

// title field
// Defaults to 255 if not explicitly set.
emidev98 marked this conversation as resolved.
Show resolved Hide resolved
MaxProposalTitleLen uint64

// summary field
// Defaults to 10200 if not explicitly set.
MaxProposalSummaryLen uint64
}

// DefaultConfig returns the default config for group.
func DefaultConfig() Config {
return Config{
MaxExecutionPeriod: 2 * time.Hour * 24 * 7, // Two weeks.
MaxMetadataLen: 255,
MaxExecutionPeriod: 2 * time.Hour * 24 * 7, // Two weeks.
MaxMetadataLen: 255,
MaxProposalTitleLen: 255,
emidev98 marked this conversation as resolved.
Show resolved Hide resolved
MaxProposalSummaryLen: 10200,
}
emidev98 marked this conversation as resolved.
Show resolved Hide resolved
}
Loading
Loading