Merge pull request #3136 from cosmos/jae/revert_remove_gov_slashing

Revert remove gov slashing
This commit is contained in:
Jae Kwon 2018-12-17 11:03:38 -08:00 committed by GitHub
commit 46620d4abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View File

@ -87,8 +87,9 @@ func appStateFn(r *rand.Rand, accs []simulation.Account) json.RawMessage {
VotingPeriod: vp,
},
TallyParams: gov.TallyParams{
Threshold: sdk.NewDecWithPrec(5, 1),
Veto: sdk.NewDecWithPrec(334, 3),
Threshold: sdk.NewDecWithPrec(5, 1),
Veto: sdk.NewDecWithPrec(334, 3),
GovernancePenalty: sdk.NewDecWithPrec(1, 2),
},
}
fmt.Printf("Selected randomly generated governance parameters:\n\t%+v\n", govGenesis)

View File

@ -52,9 +52,10 @@ func DefaultGenesisState() GenesisState {
VotingPeriod: time.Duration(172800) * time.Second,
},
TallyParams: TallyParams{
Quorum: sdk.NewDecWithPrec(334, 3),
Threshold: sdk.NewDecWithPrec(5, 1),
Veto: sdk.NewDecWithPrec(334, 3),
Quorum: sdk.NewDecWithPrec(334, 3),
Threshold: sdk.NewDecWithPrec(5, 1),
Veto: sdk.NewDecWithPrec(334, 3),
GovernancePenalty: sdk.NewDecWithPrec(1, 2),
},
}
}
@ -73,6 +74,12 @@ func ValidateGenesis(data GenesisState) error {
veto.String())
}
govPenalty := data.TallyParams.GovernancePenalty
if govPenalty.IsNegative() || govPenalty.GT(sdk.OneDec()) {
return fmt.Errorf("Governance vote veto threshold should be positive and less or equal to one, is %s",
govPenalty.String())
}
if data.DepositParams.MaxDepositPeriod > data.VotingParams.VotingPeriod {
return fmt.Errorf("Governance deposit period should be less than or equal to the voting period (%ds), is %ds",
data.VotingParams.VotingPeriod, data.DepositParams.MaxDepositPeriod)

View File

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