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, summary and proposer to proposal struct of gov #14390

Merged
merged 13 commits into from
Dec 26, 2022
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"];
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
}

// 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
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
4 changes: 2 additions & 2 deletions tests/integration/gov/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ func (suite *KeeperTestSuite) SetupTest() {
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
v1.RegisterQueryServer(queryHelper, app.GovKeeper)
legacyQueryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(app.GovKeeper))
v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(&app.GovKeeper))
queryClient := v1.NewQueryClient(queryHelper)
legacyQueryClient := v1beta1.NewQueryClient(legacyQueryHelper)

suite.app = app
suite.ctx = ctx
suite.queryClient = queryClient
suite.legacyQueryClient = legacyQueryClient
suite.msgSrvr = keeper.NewMsgServerImpl(suite.app.GovKeeper)
suite.msgSrvr = keeper.NewMsgServerImpl(&suite.app.GovKeeper)

govAcct := suite.app.GovKeeper.GetGovernanceAccount(suite.ctx).GetAddress()
suite.legacyMsgSrvr = keeper.NewLegacyMsgServerImpl(govAcct.String(), suite.msgSrvr)
Expand Down
Loading