-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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, summary and proposer to proposal struct of gov #14390
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally in favor of this.
do we need migration for this? from 0.46 -> 0.47? |
I feel like we should update CLI (submit-proposal (and draft-proposal)) to check on title being set and as well actually set it, when parsing a proposal json. cosmos-sdk/x/gov/client/cli/util.go Line 88 in f1062c7
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, we should as well add a changelog.
I will test the changes locally a bit later.
x/gov/client/cli/prompt.go
Outdated
@@ -155,6 +155,10 @@ func (p *proposalType) Prompt(cdc codec.Codec) (*proposal, types.ProposalMetadat | |||
return nil, metadata, fmt.Errorf("failed to set proposal deposit: %w", err) | |||
} | |||
|
|||
// set title and summary from metadata in the proposal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit actually we can move that up to L147, just after we set the proposal.Metadata. IMHO it makes more sense to group that.
Maybe even assign all three of them in the struct directly after the metadata prompt and remove L138.
proposal := &proposal{
Metadata: "IPFS", // comment
Title: metadata.Title,
Summary: metadata.Summary,
}
err := keeper.assertMetadataLength(metadata) | ||
if err != nil { | ||
return v1.Proposal{}, err | ||
} | ||
|
||
// assert summary is no longer than predefined max length of metdata | ||
err = keeper.assertMetadataLength(summary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it warrants adding this in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, a small doubt.
x/gov/keeper/msg_server.go
Outdated
if msg.Title == "" { | ||
return nil, goerrors.New("proposal title cannot be empty") | ||
} | ||
if msg.Summary == "" { | ||
return nil, goerrors.New("proposal summary cannot be empty") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I can see, these checks are already present in ValidateBasic
, do we still need here?
38b565d
to
fc93b4f
Compare
I don't think you can. You cannot safely infer title and summary from the (unstructured) metadata. |
x/gov/README.md
Outdated
} | ||
``` | ||
|
||
> Note: By default the metadata and the proposal are both limited by 255 characters, this can be overridden by the application developer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> Note: By default the metadata and the proposal are both limited by 255 characters, this can be overridden by the application developer | |
:::note | |
By default the metadata and the proposal are both limited by 255 characters, this can be overridden by the application developer. | |
::: |
Nit: it shows nicer in docusaurus.
x/gov/client/cli/prompt.go
Outdated
proposal.Metadata = "ipfs://CID" | ||
|
||
proposal := &proposal{ | ||
Metadata: "ipfs://CID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metadata: "ipfs://CID", | |
Metadata: "ipfs://CID", // the metadata must be saved on IPFS, set placeholder |
I think the comment still has a value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, we should as well add a changelog.
I will test the changes locally a bit later.
tACK.
Description
add title, summary (limited in characters) and proposer to the proposal struct. Would like to here if proposer is needed here?
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change