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

x/gov: allow arbitrary messages in proposal #9726

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/grpc/tmservice/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/network"
qtypes "github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/testutil/rest"
qtypes "github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/version"
)

Expand Down
132 changes: 52 additions & 80 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@
- [PubKey](#cosmos.crypto.secp256r1.PubKey)

- [cosmos/distribution/v1beta1/distribution.proto](#cosmos/distribution/v1beta1/distribution.proto)
- [CommunityPoolSpendProposal](#cosmos.distribution.v1beta1.CommunityPoolSpendProposal)
- [CommunityPoolSpendProposalWithDeposit](#cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit)
- [DelegationDelegatorReward](#cosmos.distribution.v1beta1.DelegationDelegatorReward)
- [DelegatorStartingInfo](#cosmos.distribution.v1beta1.DelegatorStartingInfo)
- [FeePool](#cosmos.distribution.v1beta1.FeePool)
Expand Down Expand Up @@ -283,6 +281,8 @@
- [MsgFundCommunityPoolResponse](#cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse)
- [MsgSetWithdrawAddress](#cosmos.distribution.v1beta1.MsgSetWithdrawAddress)
- [MsgSetWithdrawAddressResponse](#cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse)
- [MsgSpendCommunityPool](#cosmos.distribution.v1beta1.MsgSpendCommunityPool)
- [MsgSpendCommunityPoolResponse](#cosmos.distribution.v1beta1.MsgSpendCommunityPoolResponse)
- [MsgWithdrawDelegatorReward](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward)
- [MsgWithdrawDelegatorRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse)
- [MsgWithdrawValidatorCommission](#cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission)
Expand Down Expand Up @@ -344,7 +344,6 @@
- [Proposal](#cosmos.gov.v1beta1.Proposal)
- [TallyParams](#cosmos.gov.v1beta1.TallyParams)
- [TallyResult](#cosmos.gov.v1beta1.TallyResult)
- [TextProposal](#cosmos.gov.v1beta1.TextProposal)
- [Vote](#cosmos.gov.v1beta1.Vote)
- [VotingParams](#cosmos.gov.v1beta1.VotingParams)
- [WeightedVoteOption](#cosmos.gov.v1beta1.WeightedVoteOption)
Expand Down Expand Up @@ -378,6 +377,7 @@
- [cosmos/gov/v1beta1/tx.proto](#cosmos/gov/v1beta1/tx.proto)
- [MsgDeposit](#cosmos.gov.v1beta1.MsgDeposit)
- [MsgDepositResponse](#cosmos.gov.v1beta1.MsgDepositResponse)
- [MsgSignal](#cosmos.gov.v1beta1.MsgSignal)
- [MsgSubmitProposal](#cosmos.gov.v1beta1.MsgSubmitProposal)
- [MsgSubmitProposalResponse](#cosmos.gov.v1beta1.MsgSubmitProposalResponse)
- [MsgVote](#cosmos.gov.v1beta1.MsgVote)
Expand Down Expand Up @@ -476,7 +476,6 @@

- [cosmos/params/v1beta1/params.proto](#cosmos/params/v1beta1/params.proto)
- [ParamChange](#cosmos.params.v1beta1.ParamChange)
- [ParameterChangeProposal](#cosmos.params.v1beta1.ParameterChangeProposal)

- [cosmos/params/v1beta1/query.proto](#cosmos/params/v1beta1/query.proto)
- [QueryParamsRequest](#cosmos.params.v1beta1.QueryParamsRequest)
Expand Down Expand Up @@ -3611,46 +3610,6 @@ PubKey defines a secp256r1 ECDSA public key.



<a name="cosmos.distribution.v1beta1.CommunityPoolSpendProposal"></a>

### CommunityPoolSpendProposal
CommunityPoolSpendProposal details a proposal for use of community funds,
together with how many coins are proposed to be spent, and to which
recipient account.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |
| `recipient` | [string](#string) | | |
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |






<a name="cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit"></a>

### CommunityPoolSpendProposalWithDeposit
CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal
with a deposit


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |
| `recipient` | [string](#string) | | |
| `amount` | [string](#string) | | |
| `deposit` | [string](#string) | | |






<a name="cosmos.distribution.v1beta1.DelegationDelegatorReward"></a>

### DelegationDelegatorReward
Expand Down Expand Up @@ -4380,6 +4339,33 @@ MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type.



<a name="cosmos.distribution.v1beta1.MsgSpendCommunityPool"></a>

### MsgSpendCommunityPool
MsgSpendCommunityPool allows an authority account of the community pool to
transfer coins to a recipient address


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |
| `recipient` | [string](#string) | | |






<a name="cosmos.distribution.v1beta1.MsgSpendCommunityPoolResponse"></a>

### MsgSpendCommunityPoolResponse
MsgSpendCommunityPoolResponse defines the Msg/SpendCommunityPool response type.






<a name="cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"></a>

### MsgWithdrawDelegatorReward
Expand Down Expand Up @@ -4450,6 +4436,7 @@ Msg defines the distribution Msg service.
| `WithdrawDelegatorReward` | [MsgWithdrawDelegatorReward](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward) | [MsgWithdrawDelegatorRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse) | WithdrawDelegatorReward defines a method to withdraw rewards of delegator from a single validator. | |
| `WithdrawValidatorCommission` | [MsgWithdrawValidatorCommission](#cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission) | [MsgWithdrawValidatorCommissionResponse](#cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse) | WithdrawValidatorCommission defines a method to withdraw the full commission to the validator address. | |
| `FundCommunityPool` | [MsgFundCommunityPool](#cosmos.distribution.v1beta1.MsgFundCommunityPool) | [MsgFundCommunityPoolResponse](#cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse) | FundCommunityPool defines a method to allow an account to directly fund the community pool. | |
| `SpendCommunityPool` | [MsgSpendCommunityPool](#cosmos.distribution.v1beta1.MsgSpendCommunityPool) | [MsgSpendCommunityPoolResponse](#cosmos.distribution.v1beta1.MsgSpendCommunityPoolResponse) | SpendCommunityPool defined a method to transfer tokens from the community pool to a recipient address | |

<!-- end services -->

Expand Down Expand Up @@ -5038,14 +5025,15 @@ Proposal defines the core field members of a governance proposal.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `proposal_id` | [uint64](#uint64) | | |
| `content` | [google.protobuf.Any](#google.protobuf.Any) | | |
| `content` | [google.protobuf.Any](#google.protobuf.Any) | | **Deprecated.** |
| `status` | [ProposalStatus](#cosmos.gov.v1beta1.ProposalStatus) | | |
| `final_tally_result` | [TallyResult](#cosmos.gov.v1beta1.TallyResult) | | |
| `submit_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |
| `deposit_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |
| `total_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |
| `voting_start_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |
| `voting_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |
| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | |



Expand Down Expand Up @@ -5087,23 +5075,6 @@ TallyResult defines a standard tally for a governance proposal.



<a name="cosmos.gov.v1beta1.TextProposal"></a>

### TextProposal
TextProposal defines a standard text proposal whose changes need to be
manually updated in case of approval.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |






<a name="cosmos.gov.v1beta1.Vote"></a>

### Vote
Expand Down Expand Up @@ -5551,6 +5522,23 @@ MsgDepositResponse defines the Msg/Deposit response type.



<a name="cosmos.gov.v1beta1.MsgSignal"></a>

### MsgSignal
MsgSignal is a simple text-based message that can be added to a proposal if
the proposer wants to signal a change. Nothing is executed.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |






<a name="cosmos.gov.v1beta1.MsgSubmitProposal"></a>

### MsgSubmitProposal
Expand All @@ -5560,9 +5548,10 @@ proposal Content.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `content` | [google.protobuf.Any](#google.protobuf.Any) | | |
| `content` | [google.protobuf.Any](#google.protobuf.Any) | | **Deprecated.** |
| `initial_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |
| `proposer` | [string](#string) | | |
| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | |



Expand Down Expand Up @@ -6864,23 +6853,6 @@ ParameterChangeProposal.




<a name="cosmos.params.v1beta1.ParameterChangeProposal"></a>

### ParameterChangeProposal
ParameterChangeProposal defines a proposal to change one or more parameters.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |
| `changes` | [ParamChange](#cosmos.params.v1beta1.ParamChange) | repeated | |





<!-- end messages -->

<!-- end enums -->
Expand Down
28 changes: 0 additions & 28 deletions proto/cosmos/distribution/v1beta1/distribution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,6 @@ message FeePool {
];
}

// CommunityPoolSpendProposal details a proposal for use of community funds,
// together with how many coins are proposed to be spent, and to which
// recipient account.
message CommunityPoolSpendProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string title = 1;
string description = 2;
string recipient = 3;
repeated cosmos.base.v1beta1.Coin amount = 4
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

// DelegatorStartingInfo represents the starting info for a delegator reward
// period. It tracks the previous validator period, the delegation's amount of
// staking token, and the creation height (to check later on if any slashes have
Expand Down Expand Up @@ -142,16 +127,3 @@ message DelegationDelegatorReward {
repeated cosmos.base.v1beta1.DecCoin reward = 2
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal
// with a deposit
message CommunityPoolSpendProposalWithDeposit {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;

string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
string recipient = 3 [(gogoproto.moretags) = "yaml:\"recipient\""];
string amount = 4 [(gogoproto.moretags) = "yaml:\"amount\""];
string deposit = 5 [(gogoproto.moretags) = "yaml:\"deposit\""];
}
15 changes: 15 additions & 0 deletions proto/cosmos/distribution/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ service Msg {
// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);

// SpendCommunityPool defined a method to transfer tokens from the community
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// SpendCommunityPool defined a method to transfer tokens from the community
// SpendCommunityPool defines a method to transfer tokens from the community

// pool to a recipient address
rpc SpendCommunityPool(MsgSpendCommunityPool) returns (MsgSpendCommunityPoolResponse);
}

// MsgSetWithdrawAddress sets the withdraw address for
Expand Down Expand Up @@ -77,3 +81,14 @@ message MsgFundCommunityPool {

// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.
message MsgFundCommunityPoolResponse {}

// MsgSpendCommunityPool allows an authority account of the community pool to
// transfer coins to a recipient address
message MsgSpendCommunityPool {
repeated cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
string recipient = 2;
}

// MsgSpendCommunityPoolResponse defines the Msg/SpendCommunityPool response type.
message MsgSpendCommunityPoolResponse {}
14 changes: 2 additions & 12 deletions proto/cosmos/gov/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ message WeightedVoteOption {
];
}

// TextProposal defines a standard text proposal whose changes need to be
// manually updated in case of approval.
message TextProposal {
option (cosmos_proto.implements_interface) = "Content";

option (gogoproto.equal) = true;

string title = 1;
string description = 2;
}

// Deposit defines an amount deposited by an account address to an active
// proposal.
message Deposit {
Expand All @@ -67,7 +56,7 @@ message Proposal {
option (gogoproto.equal) = true;

uint64 proposal_id = 1 [(gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""];
google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"];
google.protobuf.Any content = 2 [deprecated = true, (cosmos_proto.accepts_interface) = "Content"];
ProposalStatus status = 3 [(gogoproto.moretags) = "yaml:\"proposal_status\""];
TallyResult final_tally_result = 4
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"final_tally_result\""];
Expand All @@ -84,6 +73,7 @@ message Proposal {
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_start_time\""];
google.protobuf.Timestamp voting_end_time = 9
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_end_time\""];
repeated google.protobuf.Any messages = 10;
}

// ProposalStatus enumerates the valid statuses of a proposal.
Expand Down
17 changes: 15 additions & 2 deletions proto/cosmos/gov/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ message MsgSubmitProposal {
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;

google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"];
google.protobuf.Any content = 1 [deprecated = true, (cosmos_proto.accepts_interface) = "Content"];
repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"initial_deposit\""
];
string proposer = 3;
string proposer = 3;
repeated google.protobuf.Any messages = 4;
}

// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.
Expand Down Expand Up @@ -91,3 +92,15 @@ message MsgDeposit {

// MsgDepositResponse defines the Msg/Deposit response type.
message MsgDepositResponse {}

// MsgSignal is a simple text-based message that can be added to a proposal if
// the proposer wants to signal a change. Nothing is executed.
message MsgSignal {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;

string title = 1;
string description = 2;
}
Comment on lines +98 to +106
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we just add title & description fields to MsgSubmitProposal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the alternative to adding a signal message in the proposal. I wasn't sure if all proposals necessary needed a title and a description. In some cases a link/address that points to the forum / proposal write up might suffice

Copy link
Member

Choose a reason for hiding this comment

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

I think a link is more common and maybe a better idea. We should discuss. I don't think the title and description metadata should extend to group proposals for a number of reasons. Some groups may be want to be more anonymous and including title and description could confuse users into sharing private info on a public blockchain.