Skip to content

Commit

Permalink
Update default gov parameters; update migration logic
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Jan 11, 2024
1 parent b48250d commit 48ff5c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion x/gov/migrations/v5/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func MigrateStore(ctx sdk.Context, storeService corestoretypes.KVStoreService, c
}

defaultParams := govv1.DefaultParams()
params.ExpeditedMinDeposit = defaultParams.ExpeditedMinDeposit
params.ExpeditedMinDeposit = params.MinDeposit // Use regular `min_deposit` as `expedited_min_deposit`
params.ExpeditedVotingPeriod = defaultParams.ExpeditedVotingPeriod
params.ExpeditedThreshold = defaultParams.ExpeditedThreshold
params.ProposalCancelRatio = defaultParams.ProposalCancelRatio
Expand Down
3 changes: 2 additions & 1 deletion x/gov/migrations/v5/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func TestMigrateStore(t *testing.T) {
bz = store.Get(v4.ParamsKey)
require.NoError(t, cdc.Unmarshal(bz, &params))
require.NotNil(t, params)
require.Equal(t, v1.DefaultParams().ExpeditedMinDeposit, params.ExpeditedMinDeposit)
// Expect ExpeditedMinDeposit to equal previous MinDeposit after migraiton.
require.Equal(t, params.MinDeposit, params.ExpeditedMinDeposit)
require.Equal(t, v1.DefaultParams().ExpeditedThreshold, params.ExpeditedThreshold)
require.Equal(t, v1.DefaultParams().ExpeditedVotingPeriod, params.ExpeditedVotingPeriod)
require.Equal(t, v1.DefaultParams().MinDepositRatio, params.MinDepositRatio)
Expand Down
19 changes: 13 additions & 6 deletions x/gov/types/v1/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,28 @@ import (

// Default period for deposits & voting
const (
DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days
DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days
// (New default value for v0.50 migration) 24 hours voting period for expedited proposals.
DefaultExpeditedPeriod time.Duration = time.Hour * 24 * 1 // 1 day
DefaultMinExpeditedDepositTokensRatio = 5
)

// Default governance params
var (
DefaultMinDepositTokens = sdkmath.NewInt(10000000)
DefaultMinDepositTokens = sdkmath.NewInt(10000000)
// During v0.50 migration, this default value is overwritten with existing value of `MinDeposit`.
DefaultMinExpeditedDepositTokens = DefaultMinDepositTokens.Mul(sdkmath.NewInt(DefaultMinExpeditedDepositTokensRatio))
DefaultQuorum = sdkmath.LegacyNewDecWithPrec(334, 3)
DefaultThreshold = sdkmath.LegacyNewDecWithPrec(5, 1)
DefaultExpeditedThreshold = sdkmath.LegacyNewDecWithPrec(667, 3)
DefaultVetoThreshold = sdkmath.LegacyNewDecWithPrec(334, 3)
DefaultMinInitialDepositRatio = sdkmath.LegacyZeroDec()
DefaultProposalCancelRatio = sdkmath.LegacyMustNewDecFromStr("0.5")
// (New default value for v0.50 migration) 75% of Yes votes required for an expedited proposal to pass.
DefaultExpeditedThreshold = sdkmath.LegacyNewDecWithPrec(75, 2)
DefaultVetoThreshold = sdkmath.LegacyNewDecWithPrec(334, 3)
DefaultMinInitialDepositRatio = sdkmath.LegacyZeroDec()
// (New default value for v0.50 migration) 100% of deposit will not be returned to the depositors,
// if the proposal is cancelled. Also, `MsgCancelProposal` is disabled in application.

Check failure on line 32 in x/gov/types/v1/params.go

View workflow job for this annotation

GitHub Actions / Analyze

`cancelled` is a misspelling of `canceled` (misspell)
DefaultProposalCancelRatio = sdkmath.LegacyMustNewDecFromStr("1.0")
// (New default value for v0.50 migration) 100% of deposit is burned if the proposal is cancelled.

Check failure on line 34 in x/gov/types/v1/params.go

View workflow job for this annotation

GitHub Actions / Analyze

`cancelled` is a misspelling of `canceled` (misspell)
// Also, `MsgCancelProposal` is disabled in application.
DefaultProposalCancelDestAddress = ""
DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47)
DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47)
Expand Down

0 comments on commit 48ff5c6

Please sign in to comment.