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

feat!: expedited proposal min deposit param #254

Merged
merged 56 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5fd6d11
make proto-all
p0mvn May 19, 2022
ebc98bd
make proto-all with IsExpedited flag
p0mvn May 19, 2022
4498298
expedited_voting_period on voting params
p0mvn May 19, 2022
c964a0d
go mod tidy
p0mvn May 19, 2022
68d3724
add IsExpedited flag to all proposals
p0mvn May 19, 2022
e74b6ce
implement the foundation for expedited proposals
p0mvn May 20, 2022
de4f187
add validation for voting period params
p0mvn May 20, 2022
2be2b33
validate tally params - expedited must be greater than or equal to re…
p0mvn May 20, 2022
de6d0d4
fix cli
p0mvn May 20, 2022
14ac4ee
fix problems with querying tally params
p0mvn May 20, 2022
c9f61a4
TestProposalPassedEndblocker for expedited
p0mvn May 20, 2022
6f6d34d
update TestCmdParams
p0mvn May 20, 2022
2e2f96d
fix TestMigrate v040
p0mvn May 20, 2022
c46a1e6
fix TestGRPCQueryProposal
p0mvn May 20, 2022
39344ce
fix v043 TestMigrateJSON
p0mvn May 20, 2022
fe53f96
fix TestRandomizedGenState
p0mvn May 20, 2022
ddfda7c
fix TestSimulateMsgSubmitProposal
p0mvn May 20, 2022
83bad19
TestExpeditedToRegularConversion
p0mvn May 20, 2022
3f949da
fix TestIntegrationTestSuite/TestCmdParams/text_output
p0mvn May 20, 2022
45eb715
test TestExpeditedProposal_PassAndConversionToRegular
p0mvn May 20, 2022
324fb3e
attempt to fix TestAppStateDeterminism
p0mvn May 20, 2022
b90072a
fix TestRandomizedGenState after changing rand generation bounds
p0mvn May 20, 2022
ead97d0
fix TestParamChanges
p0mvn May 20, 2022
13a09c5
Merge branch 'osmosis-main' into roman/emergency-voting
p0mvn May 20, 2022
63272d2
Update x/gov/abci.go
p0mvn May 20, 2022
5f53f22
Update x/gov/abci.go
p0mvn May 20, 2022
83cb447
Update x/gov/types/keys.go
p0mvn May 20, 2022
15fab45
refactor to have isExpedited flag on the proposal struct
p0mvn Jun 2, 2022
5a348e8
fix tests
p0mvn Jun 2, 2022
11cad5f
Merge branch 'osmosis-main' into roman/emergency-voting
p0mvn Jun 2, 2022
9fab856
clean up proto files and remove is_expedited from CommunityPoolSpendP…
p0mvn Jun 2, 2022
91fbb54
fix migrate tests
p0mvn Jun 2, 2022
47d3cae
fix proto
p0mvn Jun 3, 2022
9ffefd0
Update x/gov/abci.go
p0mvn Jun 3, 2022
6896268
Update proto/cosmos/gov/v1beta1/gov.proto
p0mvn Jun 3, 2022
3cc294a
expedited vote threshold must be strictly greater than regular
p0mvn Jun 3, 2022
69d7f3b
fix Cmd tests
p0mvn Jun 3, 2022
7c12628
fix another cmd test
p0mvn Jun 3, 2022
68528ce
Add spec for emergency voting (#249)
mattverse Jun 5, 2022
1430846
Update x/gov/types/keys.go
p0mvn Jun 6, 2022
a7d05e0
remove redundant isExpedited flag from ContentFromProposalType
p0mvn Jun 6, 2022
3d13fa5
Update x/gov/abci.go
p0mvn Jun 6, 2022
3bccb4d
Merge branch 'osmosis-main' into roman/emergency-voting
p0mvn Jun 7, 2022
001433f
feat: expedited proposal min deposit param
p0mvn Jun 7, 2022
f59e04d
fix TestMigrateJSON
p0mvn Jun 7, 2022
e35dabb
improve TestProposalHandler to test validation of invalid min expedit…
p0mvn Jun 7, 2022
96bc750
fix abci tests
p0mvn Jun 7, 2022
781138d
fix migrate_test.go
p0mvn Jun 7, 2022
b8fdc1a
fix more cli tests
p0mvn Jun 7, 2022
55e3810
fix TestRandomizedGenState
p0mvn Jun 8, 2022
8c5646c
Merge branch 'osmosis-main' into roman/expedited-deposit
p0mvn Jun 17, 2022
b1ae23d
fix merge issue
p0mvn Jun 17, 2022
4fecadb
Update x/gov/types/proposal.go
p0mvn Jun 17, 2022
6fe17ac
Merge branch 'osmosis-main' into roman/expedited-deposit
p0mvn Jun 17, 2022
a409a00
Merge branch 'osmosis-main' into roman/expedited-deposit
p0mvn Jun 17, 2022
6e9e75b
Update x/gov/abci_test.go
p0mvn Jun 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix problems with querying tally params
  • Loading branch information
p0mvn committed May 20, 2022
commit 14ac4eed9c052e897396b73bd6ee9a0f1901af0f
2 changes: 1 addition & 1 deletion proto/cosmos/gov/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ message TallyParams {
bytes expedited_threshold = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "threshold,omitempty"
(gogoproto.jsontag) = "expedited_threshold,omitempty"
];

// Minimum value of Veto votes to Total votes ratio for proposal to be
Expand Down
1 change: 1 addition & 0 deletions x/gov/client/rest/grpc_query_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build norace
// +build norace

package rest_test
Expand Down
3 changes: 2 additions & 1 deletion x/gov/client/testutil/cli_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build norace
// +build norace

package testutil
Expand All @@ -21,7 +22,7 @@ func TestIntegrationTestSuite(t *testing.T) {

genesisState := types.DefaultGenesisState()
genesisState.DepositParams = types.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, types.DefaultMinDepositTokens)), time.Duration(15)*time.Second)
genesisState.VotingParams = types.NewVotingParams(time.Duration(5) * time.Second)
genesisState.VotingParams = types.NewVotingParams(time.Duration(5)*time.Second, time.Duration(2)*time.Second)
bz, err := cfg.Codec.MarshalJSON(genesisState)
require.NoError(t, err)
cfg.GenesisState["gov"] = bz
Expand Down
2 changes: 1 addition & 1 deletion x/gov/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func RandomizedGenState(simState *module.SimulationState) {
startingProposalID,
types.NewDepositParams(minDeposit, depositPeriod),
types.NewVotingParams(votingPeriod, expeditedVotingPeriod),
types.NewTallyParams(quorum, threshold, veto, expeditedThreshold),
types.NewTallyParams(quorum, threshold, expeditedThreshold, veto),
)

bz, err := json.MarshalIndent(&govGenesis, "", " ")
Expand Down
12 changes: 12 additions & 0 deletions x/gov/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ func ValidateGenesis(data *GenesisState) error {
threshold.String())
}

expeditedThreshold := data.TallyParams.ExpeditedThreshold
if expeditedThreshold.IsNegative() || expeditedThreshold.GT(sdk.OneDec()) {
return fmt.Errorf("governance expedited vote threshold should be positive and less or equal to one, is %s",
expeditedThreshold)
}

if expeditedThreshold.LT(threshold) {
return fmt.Errorf("expedited governance vote threshold %s should be greater than or equal to regular threshold %s",
expeditedThreshold,
threshold)
}

veto := data.TallyParams.VetoThreshold
if veto.IsNegative() || veto.GT(sdk.OneDec()) {
return fmt.Errorf("governance vote veto threshold should be positive and less or equal to one, is %s",
Expand Down
197 changes: 99 additions & 98 deletions x/gov/types/gov.pb.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions x/gov/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (tp TallyParams) GetThreshold(isExpedited bool) sdk.Dec {

// Equal checks equality of TallyParams
func (tp TallyParams) Equal(other TallyParams) bool {
return tp.Quorum.Equal(other.Quorum) && tp.Threshold.Equal(other.Threshold) && tp.VetoThreshold.Equal(other.VetoThreshold)
return tp.Quorum.Equal(other.Quorum) && tp.Threshold.Equal(other.Threshold) && tp.ExpeditedThreshold.Equal(other.ExpeditedThreshold) && tp.VetoThreshold.Equal(other.VetoThreshold)
}

// String implements stringer insterface
Expand Down Expand Up @@ -137,7 +137,7 @@ func validateTallyParams(i interface{}) error {
return fmt.Errorf("vote threshold too large: %s", v.Threshold)
}
if !v.ExpeditedThreshold.IsPositive() {
return fmt.Errorf("expedited ote threshold must be positive: %s", v.Threshold)
return fmt.Errorf("expedited ote threshold must be positive: %s", v.ExpeditedThreshold)
}
if v.ExpeditedThreshold.GT(sdk.OneDec()) {
return fmt.Errorf("expedited vote threshold too large: %s", v.ExpeditedThreshold)
Expand Down