Skip to content

Commit 350f916

Browse files
authored
refactor!: move v1beta2 gov types into types dir (#10763)
closes #9865 To be merged after #10748 --- ### 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) 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)
1 parent a3371e3 commit 350f916

File tree

33 files changed

+1264
-11276
lines changed

33 files changed

+1264
-11276
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ client/lcd/keys/*
3333
coverage.txt
3434
profile.out
3535
sim_log_file
36+
x/genutil/config
37+
x/genutil/data
3638

3739
# Vagrant
3840
.vagrant/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
191191
* (x/upgrade) [\#10189](https://github.com/cosmos/cosmos-sdk/issues/10189) Removed potential sources of non-determinism in upgrades
192192
* [\#10393](https://github.com/cosmos/cosmos-sdk/pull/10422) Add `MinCommissionRate` param to `x/staking` module.
193193
* [#10725](https://github.com/cosmos/cosmos-sdk/pull/10725) populate `ctx.ConsensusParams` for begin/end blockers.
194+
* [#10763](https://github.com/cosmos/cosmos-sdk/pull/10763) modify the fields in `TallyParams` to use `string` instead of `bytes`
194195

195196
### Deprecated
196197

docs/core/proto-docs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6165,9 +6165,9 @@ TallyParams defines the params for tallying votes on governance proposals.
61656165

61666166
| Field | Type | Label | Description |
61676167
| ----- | ---- | ----- | ----------- |
6168-
| `quorum` | [bytes](#bytes) | | Minimum percentage of total stake needed to vote for a result to be considered valid. |
6169-
| `threshold` | [bytes](#bytes) | | Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. |
6170-
| `veto_threshold` | [bytes](#bytes) | | Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Default value: 1/3. |
6168+
| `quorum` | [string](#string) | | Minimum percentage of total stake needed to vote for a result to be considered valid. |
6169+
| `threshold` | [string](#string) | | Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. |
6170+
| `veto_threshold` | [string](#string) | | Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Default value: 1/3. |
61716171

61726172

61736173

proto/cosmos/gov/v1beta2/genesis.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package cosmos.gov.v1beta2;
44

55
import "cosmos/gov/v1beta2/gov.proto";
66

7-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
7+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
88

99
// GenesisState defines the gov module's genesis state.
1010
message GenesisState {

proto/cosmos/gov/v1beta2/gov.proto

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "google/protobuf/any.proto";
88
import "google/protobuf/duration.proto";
99
import "cosmos_proto/cosmos.proto";
1010

11-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
11+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
1212

1313
// VoteOption enumerates the valid vote options for a given governance proposal.
1414
enum VoteOption {
@@ -35,7 +35,7 @@ message WeightedVoteOption {
3535
message Deposit {
3636
uint64 proposal_id = 1;
3737
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
38-
repeated cosmos.base.v1beta1.Coin amount = 3;
38+
repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
3939
}
4040

4141
// Proposal defines the core field members of a governance proposal.
@@ -46,7 +46,7 @@ message Proposal {
4646
TallyResult final_tally_result = 4;
4747
google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true];
4848
google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true];
49-
repeated cosmos.base.v1beta1.Coin total_deposit = 7;
49+
repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false];
5050
google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true];
5151
google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true];
5252
}
@@ -95,7 +95,7 @@ message Vote {
9595
// DepositParams defines the params for deposits on governance proposals.
9696
message DepositParams {
9797
// Minimum deposit for a proposal to enter voting period.
98-
repeated cosmos.base.v1beta1.Coin min_deposit = 1;
98+
repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false];
9999

100100
// Maximum period for Atom holders to deposit on a proposal. Initial value: 2
101101
// months.
@@ -112,12 +112,12 @@ message VotingParams {
112112
message TallyParams {
113113
// Minimum percentage of total stake needed to vote for a result to be
114114
// considered valid.
115-
bytes quorum = 1;
115+
string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec"];
116116

117117
// Minimum proportion of Yes votes for proposal to pass. Default value: 0.5.
118-
bytes threshold = 2;
118+
string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec"];
119119

120120
// Minimum value of Veto votes to Total votes ratio for proposal to be
121121
// vetoed. Default value: 1/3.
122-
bytes veto_threshold = 3;
122+
string veto_threshold = 3 [(cosmos_proto.scalar) = "cosmos.Dec"];
123123
}

proto/cosmos/gov/v1beta2/query.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "google/api/annotations.proto";
66
import "cosmos/gov/v1beta2/gov.proto";
77
import "cosmos_proto/cosmos.proto";
88

9-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
9+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
1010

1111
// Query defines the gRPC querier service for gov module
1212
service Query {

proto/cosmos/gov/v1beta2/tx.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package cosmos.gov.v1beta2;
33

44
import "cosmos/base/v1beta1/coin.proto";
55
import "cosmos/gov/v1beta2/gov.proto";
6+
import "gogoproto/gogo.proto";
67
import "cosmos_proto/cosmos.proto";
78
import "google/protobuf/any.proto";
89

9-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
10+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
1011

1112
// Msg defines the gov Msg service.
1213
service Msg {
@@ -29,7 +30,7 @@ service Msg {
2930
// proposal Content.
3031
message MsgSubmitProposal {
3132
repeated google.protobuf.Any messages = 1;
32-
repeated cosmos.base.v1beta1.Coin initial_deposit = 2;
33+
repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false];
3334
string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
3435
}
3536

@@ -66,7 +67,7 @@ message MsgVoteWeightedResponse {}
6667
message MsgDeposit {
6768
uint64 proposal_id = 1;
6869
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
69-
repeated cosmos.base.v1beta1.Coin amount = 3;
70+
repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
7071
}
7172

7273
// MsgDepositResponse defines the Msg/Deposit response type.

x/genutil/migrations/v043/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/cosmos/cosmos-sdk/x/genutil/types"
99
v040gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v040"
1010
v043gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v043"
11-
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
11+
gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
1212
)
1313

1414
// Migrate migrates exported state from v0.40 to a v0.43 genesis state.

x/gov/client/cli/query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
sdk "github.com/cosmos/cosmos-sdk/types"
1313
"github.com/cosmos/cosmos-sdk/version"
1414
gcutils "github.com/cosmos/cosmos-sdk/x/gov/client/utils"
15-
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
1615
"github.com/cosmos/cosmos-sdk/x/gov/types"
16+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
1717
)
1818

1919
// GetQueryCmd returns the cli query commands for this module

x/gov/client/testutil/cli_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ func TestIntegrationTestSuite(t *testing.T) {
1717
cfg.NumValidators = 1
1818
suite.Run(t, NewIntegrationTestSuite(cfg))
1919

20+
dp := types.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, types.DefaultMinDepositTokens)), time.Duration(15)*time.Second)
21+
vp := types.NewVotingParams(time.Duration(5) * time.Second)
2022
genesisState := types.DefaultGenesisState()
21-
genesisState.DepositParams = types.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, types.DefaultMinDepositTokens)), time.Duration(15)*time.Second)
22-
genesisState.VotingParams = types.NewVotingParams(time.Duration(5) * time.Second)
23+
genesisState.DepositParams = &dp
24+
genesisState.VotingParams = &vp
2325
bz, err := cfg.Codec.MarshalJSON(genesisState)
2426
require.NoError(t, err)
2527
cfg.GenesisState["gov"] = bz

0 commit comments

Comments
 (0)