-
Notifications
You must be signed in to change notification settings - Fork 33
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
refactor: expedited proposals parameter migrations #303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, had some comments. Please take a look
x/gov/legacy/v4/export_test.go
Outdated
@@ -0,0 +1,6 @@ | |||
package v4 | |||
|
|||
var MinInitialDepositRatio = minInitialDepositRatio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's group these vars and add whitespace at the end of the file please
x/gov/legacy/v4/store.go
Outdated
var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) | ||
var minExpeditedDeposit = sdk.NewCoins(sdk.NewCoin("osmo", sdk.NewInt(5000))) | ||
var expeditedVotingPeriod = time.Duration(time.Hour * 24) | ||
var expeditedThreshold = sdk.NewDec(2).Quo(sdk.NewDec(3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please group the vars:
var (
...
)
x/gov/legacy/v4/store.go
Outdated
var expeditedVotingPeriod = time.Duration(time.Hour * 24) | ||
var expeditedThreshold = sdk.NewDec(2).Quo(sdk.NewDec(3)) | ||
|
||
// MigrateStore performs in-place store migrations for consensus version 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// MigrateStore performs in-place store migrations for consensus version 3 | |
// MigrateStore performs in-place store migrations for consensus version 4 |
x/gov/legacy/v4/store.go
Outdated
// Please note that this is the first version that switches from using | ||
// SDK versioning (v043 etc) for package names to consensus versioning | ||
// of the gov module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Please note that this is the first version that switches from using | |
// SDK versioning (v043 etc) for package names to consensus versioning | |
// of the gov module. |
x/gov/legacy/v4/store.go
Outdated
// of the gov module. | ||
// The migration includes: | ||
// | ||
// - Setting the minimum deposit param in the paramstore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the comment please
x/gov/legacy/v4/store.go
Outdated
|
||
//Set depositParams | ||
paramstore.Get(ctx, types.ParamStoreKeyDepositParams, &depositParams) | ||
depositParams.MinInitialDepositRatio = minInitialDepositRatio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been set during the previous migration (v3)
depositParams.MinInitialDepositRatio = minInitialDepositRatio |
x/gov/legacy/v4/store.go
Outdated
// increased to 5000 OSMO. The proposal will have 24 hours to achieve | ||
// a two-thirds majority of all staked OSMO voting power voting YES. | ||
var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) | ||
var minExpeditedDeposit = sdk.NewCoins(sdk.NewCoin("osmo", sdk.NewInt(5000))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this is not ideal that we have this coupling in the sdk on osmosis by having to hardcode the osmo denom here.
This is a flaw in the original design though and regular deposits have the same problem. I think it's okay to hard code it here, just commenting to keep this issue in mind
x/gov/legacy/v4/store.go
Outdated
// increased to 5000 OSMO. The proposal will have 24 hours to achieve | ||
// a two-thirds majority of all staked OSMO voting power voting YES. | ||
var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) | ||
var minExpeditedDeposit = sdk.NewCoins(sdk.NewCoin("osmo", sdk.NewInt(5000))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var minExpeditedDeposit = sdk.NewCoins(sdk.NewCoin("osmo", sdk.NewInt(5000))) | |
var minExpeditedDeposit = sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(5000 * 1_000_000))) |
x/gov/legacy/v4/store.go
Outdated
// If expedited, the deposit to enter voting period will be | ||
// increased to 5000 OSMO. The proposal will have 24 hours to achieve | ||
// a two-thirds majority of all staked OSMO voting power voting YES. | ||
var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) |
x/gov/legacy/v4/store_test.go
Outdated
|
||
// We assume that all deposit params are set besides the MinInitialDepositRatio | ||
originalDepositParams := types.DefaultDepositParams() | ||
originalDepositParams.MinInitialDepositRatio = sdk.ZeroDec() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove everything related to min initial deposit ratio please
x/gov/keeper/migrations.go
Outdated
@@ -25,3 +26,8 @@ func (m Migrator) Migrate1to2(ctx sdk.Context) error { | |||
func (m Migrator) Migrate2to3(ctx sdk.Context) error { | |||
return v3.MigrateStore(ctx, m.keeper.paramSpace) | |||
} | |||
|
|||
// Migrate2to3 migrates from version 3 to 4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Migrate2to3 migrates from version 3 to 4. | |
// Migrate3to4 migrates from version 3 to 4. |
x/gov/legacy/v4/store.go
Outdated
var depositParams types.DepositParams | ||
var votingParams types.VotingParams | ||
var tallyParams types.TallyParams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's group vars please
Closes: #2249
What is the purpose of the change
For expedited proposals we added 2 new parameters:
MinExpeditedDeposit
ExpeditedVotingPeriod
ExpeditedThreshold
However, these parameters have not been set / migrated to. We need to implement the migrations to set the parameters to the desired values according to: https://wallet.keplr.app/chains/osmosis/proposals/278 and its respective common wealth thread.
Brief Changelog
expedited proposal parameter migrations are implemented in the SDK fork
parameters are set to the desired values from the gov prop
the upgraded sdk change is integrated into Osmosis
e2e upgrade tests continue to pass
Testing and Verifying
This change is already covered by existing tests, such as the CI tests as well as tests written in gov/legacy/v4 module
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? (yes / no)x/<module>/spec/
) / Osmosis docs repo / not documented)