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

refactor: add title and summary to groups proposal #14465

Merged
merged 19 commits into from
Jan 4, 2023

Conversation

tac0turtle
Copy link
Member

Description


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
  • 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)

@julienrbrt julienrbrt added the backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release label Jan 3, 2023
@tac0turtle tac0turtle marked this pull request as ready for review January 3, 2023 10:29
@tac0turtle tac0turtle requested a review from a team as a code owner January 3, 2023 10:29
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm, I'll try it locally after the nits.

other nits: the same can be done in group prompt.go that what you've done in gov prompt.

x/group/client/cli/util.go Show resolved Hide resolved
x/group/keeper/msg_server.go Show resolved Hide resolved
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

LGTM, just have a question about max length

proto/cosmos/gov/v1/gov.proto Outdated Show resolved Hide resolved
string title = 6;

// summary is the summary of the proposal.
string summary = 7;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to add a char limit to these 2 fields? IIRC we had that set to 10000 chars

(same q for gov)

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of reusing the same max length as metadata. I did the check on summary but can add to title. Went with metadata length because it shouldn't be long

Copy link
Contributor

Choose a reason for hiding this comment

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

Went with metadata length because it shouldn't be long

I think I didn't follow the whole conversation for these changes, so if there was already consensus on this, then I can approve.

But my concern is: summary is not the long description, right? Where would summary be shown/used btw? Also, iiuc the initial problem was that without these 2 news fields, it breaks explorers (for gov). But if we introduce a summary with a 255-char lenghth, it still break explorers, right? e.g. https://www.mintscan.io/cosmos/proposals/93, the "Details" field would still need to be resolved with IPFS.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can rename it description to not break, that would be better. The character limit is there to ask people to only write a short description/summary, but not the entire one. Its kind of a middle ground to storing it off chain

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, talked offline, let's keep title+summary.

Can we add the max length check to title too? To keep the same behavior as before. (and to gov too)

Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

everything lgtm, not really needed but you can add more testcases to msgs_test.go with empty title and summary

Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

one small nit

x/group/msgs_test.go Outdated Show resolved Hide resolved
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
@sonarcloud
Copy link

sonarcloud bot commented Jan 4, 2023

[Cosmos SDK] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@amaury1093 amaury1093 self-assigned this Jan 4, 2023
@@ -31,15 +31,18 @@ type proposalType struct {

// Prompt the proposal type values and return the proposal and its metadata.
func (p *proposalType) Prompt(cdc codec.Codec) (*Proposal, govtypes.ProposalMetadata, error) {
proposal := &Proposal{}

// set metadata
metadata, err := govcli.Prompt(govtypes.ProposalMetadata{}, "proposal")
if err != nil {
return nil, metadata, fmt.Errorf("failed to set proposal metadata: %w", err)
}
// the metadata must be saved on IPFS, set placeholder
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// the metadata must be saved on IPFS, set placeholder

Copy link
Member

Choose a reason for hiding this comment

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

Will do in as follow-up as I need to touch this file for supporting slice in prompts

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

tACK

@julienrbrt julienrbrt enabled auto-merge (squash) January 4, 2023 19:43
@julienrbrt julienrbrt merged commit 7b12333 into main Jan 4, 2023
@julienrbrt julienrbrt deleted the marko/groups_proposal branch January 4, 2023 20:01
mergify bot pushed a commit that referenced this pull request Jan 4, 2023
julienrbrt added a commit that referenced this pull request Jan 5, 2023
…14482)

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release C:CLI C:Simulations C:x/gov C:x/group
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants