-
Notifications
You must be signed in to change notification settings - Fork 13
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
[Upgrades] v0.0.12 upgrade #1043
base: main
Are you sure you want to change the base?
Conversation
app/upgrades/v0.0.12.go
Outdated
// - Before: v0.0.11 | ||
// - After: v0.0.12 | ||
|
||
// TODO_IN_THIS_PR: WIP. Using this diff as a starting point: https://github.com/pokt-network/poktroll/compare/v0.0.11...feat/proof-endblocker |
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.
[linter-name (fail-on-found)] reported by reviewdog 🐶
// TODO_IN_THIS_PR: WIP. Using this diff as a starting point: v0.0.11...feat/proof-endblocker
app/upgrades/v0.0.12.go
Outdated
// - After: v0.0.12 | ||
|
||
// TODO_IN_THIS_PR: WIP. Using this diff as a starting point: https://github.com/pokt-network/poktroll/compare/v0.0.11...feat/proof-endblocker | ||
// TODO_IN_THIS_PR: Wait for https://github.com/pokt-network/poktroll/pull/1042 |
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.
}, | ||
StakingFee: &cosmosTypes.Coin{ | ||
Denom: "upokt", | ||
// TODO_IN_THIS_PR: 100upokt a good value? |
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.
[linter-name (fail-on-found)] reported by reviewdog 🐶
// TODO_IN_THIS_PR: 100upokt a good value?
app/upgrades/v0.0.12.go
Outdated
} | ||
logger.Info("Successfully updated supplier params", "new_params", supplierParams) | ||
|
||
// TODO_IN_THIS_PR: RevSharePercent / DefaultRevSharePercent has been changed from float32 to uint64. |
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.
[linter-name (fail-on-found)] reported by reviewdog 🐶
// TODO_IN_THIS_PR: RevSharePercent / DefaultRevSharePercent has been changed from float32 to uint64.
app/upgrades/v0.0.12.go
Outdated
// and maintain two versions of protobuf files IF we need to loop through existing suppliers and update their onchain | ||
// data. | ||
|
||
// TODO_IN_THIS_PR: Add service.params.target_num_relays. |
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.
[linter-name (fail-on-found)] reported by reviewdog 🐶
// TODO_IN_THIS_PR: Add service.params.target_num_relays.
app/upgrades/v0.0.12.go
Outdated
// data. | ||
|
||
// TODO_IN_THIS_PR: Add service.params.target_num_relays. | ||
// TODO_IN_THIS_PR: Add tokenomics.params.global_inflation_per_claim. |
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.
[linter-name (fail-on-found)] reported by reviewdog 🐶
// TODO_IN_THIS_PR: Add tokenomics.params.global_inflation_per_claim.
app/upgrades/v0.0.12.go
Outdated
// protobuf field. As a result, we expect existing on-chain data to switch to default value. | ||
// Investigate the impact of this change on existing on-chain data. | ||
// | ||
// TODO_IN_THIS_PR: decide if we need a proper module migration. |
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.
[linter-name (fail-on-found)] reported by reviewdog 🐶
// TODO_IN_THIS_PR: decide if we need a proper module migration.
5a3decc
to
f187c35
Compare
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.
LGTM! I feel we are starting to improve our migration plans 👏
}, | ||
StakingFee: &cosmosTypes.Coin{ | ||
Denom: "upokt", | ||
// TODO_IN_THIS_PR: 100upokt a good value? |
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.
I think 100upokt
or 1000upokt
is a good value for now. We have the transaction fees that also protect from sibyl.
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.
It'll all be revisited prior to mainnet. 100upokt LGTM
// Force all services to have a 100% revshare to the supplier. | ||
// Not something we would do on a real mainnet, but it's a quick way to resolve the issue. | ||
// Currently, we don't break any existing suppliers (as all of them have a 100% revshare to the supplier). | ||
service.RevShare = []*sharedtypes.ServiceRevenueShare{ |
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.
Ideally we would be able to loop over the old revshare map by unmashalling to the old proto type then create the new Supplier
proto with the new values.
But since we don't have proto versioning and we marked the old (float32) value as reserved, this is the next best option offered to us.
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.
@okdas Looks good!
Overall, I do want us to take this as an opportunity to create a good reference + example.
- keep it clean
- do things right
- iterate on process / template
Things aren't "on fire" and it's a "simple migration", so now is the time!
upgrades.Upgrade_0_0_4, | ||
upgrades.Upgrade_0_0_10, | ||
upgrades.Upgrade_0_0_11, | ||
upgrades.Upgrade_0_0_12, |
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.
What do you think of commenting out previous upgrades (explaining they're complete on Alpha, Beta, Main, etc) so the code also works as history?
@@ -11,9 +11,7 @@ import ( | |||
// The chain upgrade can be scheduled AFTER the new version (with upgrade strategy implemented) is released, |
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.
Isn't there a certain .md you're supposed to update (for documentation purposes) when we do an upgrade?
@@ -16,8 +16,14 @@ import ( | |||
const ( | |||
// The default PNF/DAO address in the genesis file for Alpha TestNet. Used to create new authz authorizations. | |||
AlphaTestNetPnfAddress = "pokt1r6ja6rz6rpae58njfrsgs5n5sp3r36r2q9j04h" | |||
|
|||
// Authority address. Defaults to gov module address. Used to create new authz authorizations. |
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.
// Authority address. Defaults to gov module address. Used to create new authz authorizations. | |
// Authority address. Defaults to x/gov module account address. Used to create new authz authorizations. |
// DEV_NOTE: Use `keepers.UpgradeKeeper.Authority(ctx, &upgradetypes.QueryAuthorityRequest{})` to query the authority | ||
// address for the current network. Keeping this variable for historical upgrades. |
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.
// DEV_NOTE: Use `keepers.UpgradeKeeper.Authority(ctx, &upgradetypes.QueryAuthorityRequest{})` to query the authority | |
// address for the current network. Keeping this variable for historical upgrades. | |
// TECHDEBT: DO NOT use AlphaTestNetAuthorityAddress. | |
// Use `keepers.UpgradeKeeper.Authority(ctx, &upgradetypes.QueryAuthorityRequest{})` to query the authority address of the current Alpha Network. | |
// This hard-coded address is kept for record keeping historical purposes. |
AlphaTestNetAuthorityAddress = "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t" | ||
|
||
// The default PNF/DAO address in the genesis file for Beta TestNet. Used to create new authz authorizations. |
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.
Wanted to remind myself by double-asking.
This isn't a module address, right?
// Add tokenomics module `global_inflation_per_claim` parameter per `config.yml`. | ||
// We use GetParams() as `DaoRewardAddress` is different between networks and we don't want to hardcode it. | ||
tokenomicsParams := keepers.TokenomicsKeeper.GetParams(ctx) | ||
tokenomicsParams.GlobalInflationPerClaim = 0.1 |
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.
Wdyt of of making local constants for all of the magic numbers in this file?
That way someone can look at the top of the file and quickly see the new values we're changing/setting, and all the "ugly business logic" is hidden in the implementation.
|
||
err := applyNewParameters(ctx) | ||
if err != nil { | ||
logger.Error("Failed to apply new parameters", "error", err) |
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.
Thoughts on (here and elsewhere) adding the version upgrade a a (key,val) as well?
You can either have a local v0.0.12
const, or update the logger context, or both!
return vm, err | ||
} | ||
|
||
// Since we changed the type of RevSharePercent from float32 to uint64, we need to update all on-chain data. |
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.
Can we moved this into a local helper to scope / separate the changes from the "boilerplate"?
return vm, err | ||
} | ||
|
||
logger.Info("Successfully completed v0.0.12 upgrade handler") |
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 make v0.0.12
a local constant and do some string formatting here.
It'll avoid copy-pasta errors in the future.
logger.Info("Updating all suppliers to have a 100% revshare to the supplier", "num_suppliers", len(suppliers)) | ||
for _, supplier := range suppliers { | ||
for _, service := range supplier.Services { | ||
// Force all services to have a 100% revshare to the supplier. |
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.
Can you change this to read the prior state and use it for the new state/
I realize it's not a big deal here, but I want us to take this as an opportunity to do it right, and set a right example/reference in the future.
Summary
Adding an upgrade handler for
v0.0.12
Type of change
Select one or more from the following:
consensus-breaking
label if so. See [Infra] Automatically add theconsensus-breaking
label #791 for detailsSanity Checklist
assignees
,reviewers
,labels
,project
,iteration
andmilestone
make docusaurus_start
make go_develop_and_test
andmake test_e2e
devnet-test-e2e
label to run E2E tests in CI