Skip to content

Commit

Permalink
refactor: add title, summary and proposer to proposal struct of gov (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored Dec 26, 2022
1 parent 6dfa0c9 commit 08361d5
Show file tree
Hide file tree
Showing 37 changed files with 1,104 additions and 337 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#14019](https://github.com/cosmos/cosmos-sdk/issues/14019) Remove the interface casting to allow other implementations of a `CommitMultiStore`.
* [#13881](https://github.com/cosmos/cosmos-sdk/pull/13881) Optimize iteration on nested cached KV stores and other operations in general.
* (x/gov) [#14347](https://github.com/cosmos/cosmos-sdk/pull/14347) Support `v1.Proposal` message in `v1beta1.Proposal.Content`.
* (x/gov) [#14390](https://github.com/cosmos/cosmos-sdk/pull/14390) Add title, proposer and summary to proposal struct

### State Machine Breaking

Expand Down
447 changes: 336 additions & 111 deletions api/cosmos/gov/v1/gov.pulsar.go

Large diffs are not rendered by default.

153 changes: 151 additions & 2 deletions api/cosmos/gov/v1/tx.pulsar.go

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

8 changes: 8 additions & 0 deletions proto/cosmos/gov/v1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ message Proposal {

// metadata is any arbitrary metadata attached to the proposal.
string metadata = 10;

// title is the title of the proposal
string title = 11;

// summary is a short summary of the proposal
string summary = 12;

string proposer = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// ProposalStatus enumerates the valid statuses of a proposal.
Expand Down
6 changes: 6 additions & 0 deletions proto/cosmos/gov/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ message MsgSubmitProposal {

// metadata is any arbitrary metadata attached to the proposal.
string metadata = 4;

// title is the title of the proposal.
string title = 5;

// summary is the summary of the proposal
string summary = 6;
}

// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/gov/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func (s *E2ETestSuite) TestNewCmdSubmitProposal() {
}
}
],
"title": "My awesome title",
"summary": "My awesome description",
"metadata": "%s",
"deposit": "%s"
}`, authtypes.NewModuleAddress(types.ModuleName), base64.StdEncoding.EncodeToString(propMetadata), sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5431)))
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/gov/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ func TestImportExportQueues(t *testing.T) {

ctx = s1.app.BaseApp.NewContext(false, tmproto.Header{})
// Create two proposals, put the second into the voting period
proposal1, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "")
proposal1, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0])
require.NoError(t, err)
proposalID1 := proposal1.Id

proposal2, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "")
proposal2, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0])
require.NoError(t, err)
proposalID2 := proposal2.Id

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/gov/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() {
"create a proposal and get tally",
func() {
var err error
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "")
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "", "test", "description", addrs[0])
suite.Require().NoError(err)
suite.Require().NotNil(proposal)

Expand Down Expand Up @@ -161,7 +161,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryTally() {
"create a proposal and get tally",
func() {
var err error
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "")
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, "", "test", "description", addrs[0])
suite.Require().NoError(err)
suite.Require().NotNil(proposal)

Expand Down
Loading

0 comments on commit 08361d5

Please sign in to comment.