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

[CORE-850] Update default values for new Gov parameters #34

Merged
merged 5 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion x/gov/migrations/v5/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ func MigrateStore(ctx sdk.Context, storeService corestoretypes.KVStoreService, c
return err
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this MigrationStore is registered here, which is run in RunMigrations during the v_4_0_0_0 upgrade.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make sure that this gets tested during our qualification in staging + testnet?


// defaultParams is updated with default values for new parameters introduced in v0.50.
defaultParams := govv1.DefaultParams()
params.ExpeditedMinDeposit = defaultParams.ExpeditedMinDeposit
// Use `MinDeposit` from state as `ExpeditedMinDeposit`.
params.ExpeditedMinDeposit = params.MinDeposit
// For below five parameters, use the updated default values.
params.ExpeditedVotingPeriod = defaultParams.ExpeditedVotingPeriod
ttl33 marked this conversation as resolved.
Show resolved Hide resolved
params.ExpeditedThreshold = defaultParams.ExpeditedThreshold
params.ProposalCancelRatio = defaultParams.ProposalCancelRatio
Expand Down
11 changes: 7 additions & 4 deletions x/gov/migrations/v5/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ 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)
require.Equal(t, v1.DefaultParams().ExpeditedThreshold, params.ExpeditedThreshold)
require.Equal(t, v1.DefaultParams().ExpeditedVotingPeriod, params.ExpeditedVotingPeriod)
require.Equal(t, v1.DefaultParams().MinDepositRatio, params.MinDepositRatio)
// After migration, expect `ExpeditedMinDeposit` to equal previous value of `MinDeposit`.
require.Equal(t, params.MinDeposit, params.ExpeditedMinDeposit)
require.Equal(t, "0.750000000000000000", params.ExpeditedThreshold)
require.Equal(t, "1.000000000000000000", params.ProposalCancelRatio)
require.Equal(t, "", params.ProposalCancelDest)
require.Equal(t, 24*time.Hour, *params.ExpeditedVotingPeriod)
require.Equal(t, "0.010000000000000000", params.MinDepositRatio)

// Check constitution
result, err := constitutionCollection.Get(ctx)
Expand Down
22 changes: 15 additions & 7 deletions x/gov/types/v1/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,34 @@ 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.
ttl33 marked this conversation as resolved.
Show resolved Hide resolved
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 canceled. Also, `MsgCancelProposal` is disabled in application.
DefaultProposalCancelRatio = sdkmath.LegacyMustNewDecFromStr("1.0")
// (New default value for v0.50 migration) 100% of deposit is burned if the proposal is canceled.
// 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)
DefaultBurnVoteVeto = true // set to true to replicate behavior of when this change was made (0.47)
DefaultMinDepositRatio = sdkmath.LegacyMustNewDecFromStr("0.01")
// (New default value for v0.50 migration) 1% of `min_deposit` is required to make a deposit.
DefaultMinDepositRatio = sdkmath.LegacyMustNewDecFromStr("0.01")
)

// Deprecated: NewDepositParams creates a new DepositParams object
Expand Down
Loading