Skip to content

Commit 46620d4

Browse files
authored
Merge pull request #3136 from cosmos/jae/revert_remove_gov_slashing
Revert remove gov slashing
2 parents ac511ab + 5280340 commit 46620d4

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

cmd/gaia/app/sim_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ func appStateFn(r *rand.Rand, accs []simulation.Account) json.RawMessage {
8787
VotingPeriod: vp,
8888
},
8989
TallyParams: gov.TallyParams{
90-
Threshold: sdk.NewDecWithPrec(5, 1),
91-
Veto: sdk.NewDecWithPrec(334, 3),
90+
Threshold: sdk.NewDecWithPrec(5, 1),
91+
Veto: sdk.NewDecWithPrec(334, 3),
92+
GovernancePenalty: sdk.NewDecWithPrec(1, 2),
9293
},
9394
}
9495
fmt.Printf("Selected randomly generated governance parameters:\n\t%+v\n", govGenesis)

x/gov/genesis.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ func DefaultGenesisState() GenesisState {
5252
VotingPeriod: time.Duration(172800) * time.Second,
5353
},
5454
TallyParams: TallyParams{
55-
Quorum: sdk.NewDecWithPrec(334, 3),
56-
Threshold: sdk.NewDecWithPrec(5, 1),
57-
Veto: sdk.NewDecWithPrec(334, 3),
55+
Quorum: sdk.NewDecWithPrec(334, 3),
56+
Threshold: sdk.NewDecWithPrec(5, 1),
57+
Veto: sdk.NewDecWithPrec(334, 3),
58+
GovernancePenalty: sdk.NewDecWithPrec(1, 2),
5859
},
5960
}
6061
}
@@ -73,6 +74,12 @@ func ValidateGenesis(data GenesisState) error {
7374
veto.String())
7475
}
7576

77+
govPenalty := data.TallyParams.GovernancePenalty
78+
if govPenalty.IsNegative() || govPenalty.GT(sdk.OneDec()) {
79+
return fmt.Errorf("Governance vote veto threshold should be positive and less or equal to one, is %s",
80+
govPenalty.String())
81+
}
82+
7683
if data.DepositParams.MaxDepositPeriod > data.VotingParams.VotingPeriod {
7784
return fmt.Errorf("Governance deposit period should be less than or equal to the voting period (%ds), is %ds",
7885
data.VotingParams.VotingPeriod, data.DepositParams.MaxDepositPeriod)

x/gov/params.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ type DepositParams struct {
1414

1515
// Param around Tallying votes in governance
1616
type TallyParams struct {
17-
Quorum sdk.Dec `json:"quorum"` // Minimum percentage of total stake needed to vote for a result to be considered valid
18-
Threshold sdk.Dec `json:"threshold"` // Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
19-
Veto sdk.Dec `json:"veto"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
17+
Quorum sdk.Dec `json:"quorum"` // Minimum percentage of total stake needed to vote for a result to be considered valid
18+
Threshold sdk.Dec `json:"threshold"` // Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
19+
Veto sdk.Dec `json:"veto"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
20+
GovernancePenalty sdk.Dec `json:"governance_penalty"` // Penalty if validator does not vote
2021
}
2122

2223
// Param around Voting in governance

0 commit comments

Comments
 (0)