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

[Upgrades] v0.0.12 upgrade #1043

Merged
merged 10 commits into from
Feb 4, 2025
Merged

[Upgrades] v0.0.12 upgrade #1043

merged 10 commits into from
Feb 4, 2025

Conversation

okdas
Copy link
Member

@okdas okdas commented Jan 24, 2025

Summary

Adding an upgrade handler for v0.0.12

Type of change

Select one or more from the following:

Sanity Checklist

  • I have updated the GitHub Issue assignees, reviewers, labels, project, iteration and milestone
  • For docs, I have run make docusaurus_start
  • For code, I have run make go_develop_and_test and make test_e2e
  • For code, I have added the devnet-test-e2e label to run E2E tests in CI
  • For configurations, I have update the documentation
  • I added TODOs where applicable

@okdas okdas added the protocol General core protocol related changes label Jan 24, 2025
@okdas okdas added this to the Beta TestNet Iteration milestone Jan 24, 2025
@okdas okdas self-assigned this Jan 24, 2025
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
@okdas okdas force-pushed the upgrade/prep-v0.0.12 branch from 5a3decc to f187c35 Compare January 30, 2025 23:49
@okdas okdas changed the title [Upgrades][WIP] prepare for v0.0.12 [Upgrades] v0.0.12 migration Jan 31, 2025
@okdas okdas changed the title [Upgrades] v0.0.12 migration [Upgrades] v0.0.12 upgrade Jan 31, 2025
@okdas okdas requested a review from Olshansk January 31, 2025 01:54
@okdas okdas marked this pull request as ready for review January 31, 2025 01:55
Copy link
Contributor

@red-0ne red-0ne left a 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 👏

app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
// 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{
Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

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

@red-0ne Really appreciate this feedback & input.

@okdas Can you #PUC what the "best" approach would be an "why" - essentially paragraphsing @red-0ne's comments.

In particular, explaining why we're not doing it would help. I'm thinking:

  1. Requires multiple copies of the protobuf
  2. Requiers multiple steps in the migration (overkill given that we're not in prod)
  3. Etc...

Copy link
Member Author

Choose a reason for hiding this comment

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

Rephrased the whole block.

Copy link
Member

@Olshansk Olshansk left a 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!

app/upgrades.go Show resolved Hide resolved
@@ -11,9 +11,7 @@ import (
// The chain upgrade can be scheduled AFTER the new version (with upgrade strategy implemented) is released,
Copy link
Member

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?

https://dev.poktroll.com/protocol/upgrades/upgrade_list

Copy link
Member Author

Choose a reason for hiding this comment

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

At the moment of release, we don't know when the upgrade will happen. My thinking, this should be a separate PR. But! We can prepare some changes in advance - that's a good idea.

Copy link
Member

Choose a reason for hiding this comment

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

But! We can prepare some changes in advance - that's a good idea.

Let's do it!

Wdyt of creating another PR (updating the docs that's a draft), and leave a TODO here.

var allUpgrades = []upgrades.Upgrade{
	// v0.0.4 was the first upgrade we implemented and tested on network that is no longer used.
	// upgrades.Upgrade_0_0_4,

	// v0.0.10 was the first upgrade we implemented on Alpha TestNet.
	// upgrades.Upgrade_0_0_10,

	// v0.0.11 was the Alpha TestNet exclusive upgrade to bring it on par with Beta TestNet.
	// upgrades.Upgrade_0_0_11,

	// TODO(@okdas, #XX): Update the documentation once a block height has been selected.
	// Ref: https://dev.poktroll.com/protocol/upgrades/upgrade_list
	// v0.0.12 - the first upgrade going live on both Alpha and Beta TestNets.
	upgrades.Upgrade_0_0_12,

Copy link
Member

Choose a reason for hiding this comment

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

Nvm: I saw your changes in .md AFTER writing the message above. Leaving it as a reference.

Wdyt of adding the output of the CLI transaction to say "Please update docusaurus/docs/protocol/upgrades/upgrade_list.md` now that you've submitted the plan?

You know how they say "Go to where your users are", I'm trying to "Go where the dev's eyes are".

They're looking at the CLI when something says !!!!!!!!! :)

app/upgrades/types.go Outdated Show resolved Hide resolved
app/upgrades/types.go Outdated Show resolved Hide resolved
app/upgrades/types.go Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved

err := applyNewParameters(ctx)
if err != nil {
logger.Error("Failed to apply new parameters", "error", err)
Copy link
Member

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.
Copy link
Member

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")
Copy link
Member

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.
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you please elaborate? GetAllSuppliers gives us the current state from what I understand.

I do want to add a warning if there's a supplier with more than 1 revshare, which would signal us if we broke somebody's setup.

Co-authored-by: Daniel Olshansky <[email protected]>
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
@okdas okdas requested a review from Olshansk February 1, 2025 01:27
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

Looking great @okdas!

Just a handful of more comments & NITs but we should be g2g after the next set of changes.

@@ -11,9 +11,7 @@ import (
// The chain upgrade can be scheduled AFTER the new version (with upgrade strategy implemented) is released,
Copy link
Member

Choose a reason for hiding this comment

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

But! We can prepare some changes in advance - that's a good idea.

Let's do it!

Wdyt of creating another PR (updating the docs that's a draft), and leave a TODO here.

var allUpgrades = []upgrades.Upgrade{
	// v0.0.4 was the first upgrade we implemented and tested on network that is no longer used.
	// upgrades.Upgrade_0_0_4,

	// v0.0.10 was the first upgrade we implemented on Alpha TestNet.
	// upgrades.Upgrade_0_0_10,

	// v0.0.11 was the Alpha TestNet exclusive upgrade to bring it on par with Beta TestNet.
	// upgrades.Upgrade_0_0_11,

	// TODO(@okdas, #XX): Update the documentation once a block height has been selected.
	// Ref: https://dev.poktroll.com/protocol/upgrades/upgrade_list
	// v0.0.12 - the first upgrade going live on both Alpha and Beta TestNets.
	upgrades.Upgrade_0_0_12,

app/upgrades/historical.go Outdated Show resolved Hide resolved
@@ -23,7 +23,7 @@ metrics:
addr: :9070
pocket_node:
query_node_rpc_url: tcp://localhost:26657
query_node_grpc_url: tcp://localhost:36658
Copy link
Member

Choose a reason for hiding this comment

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

So confirming this should be left as is or no?

It's just a little confusing (without comments) why some ports are 26657 but the other is 9090

@@ -11,9 +11,7 @@ import (
// The chain upgrade can be scheduled AFTER the new version (with upgrade strategy implemented) is released,
Copy link
Member

Choose a reason for hiding this comment

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

Nvm: I saw your changes in .md AFTER writing the message above. Leaving it as a reference.

Wdyt of adding the output of the CLI transaction to say "Please update docusaurus/docs/protocol/upgrades/upgrade_list.md` now that you've submitted the plan?

You know how they say "Go to where your users are", I'm trying to "Go where the dev's eyes are".

They're looking at the CLI when something says !!!!!!!!! :)

app/upgrades/types.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Show resolved Hide resolved
}
keepers.SupplierKeeper.SetSupplier(ctx, supplier)
logger.Info("Updated supplier",
"supplier", supplier.OperatorAddress)
Copy link
Member

Choose a reason for hiding this comment

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

Owner & operator please!

app/upgrades/v0.0.12.go Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
return vm, err
}

logger.Info("Running module migrations", "upgrade_plan_name", Upgrade_0_0_12_PlanName)
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a log like this before every section / update?

@Olshansk Olshansk requested a review from red-0ne February 3, 2025 21:42
@okdas okdas requested a review from Olshansk February 4, 2025 18:40
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

A few NITs.

Preliminary approval so we can start working on the upgrade while tending to the discussion / comments in parallel.

Feel free to merge at your pace.

app/upgrades/historical.go Outdated Show resolved Hide resolved
// Parameter configurations aligned with repository config.yml specifications
// These values reflect the delta between v0.0.11 and current main branch
// Reference:
// - Comparison: https://github.com/pokt-network/poktroll/compare/v0.0.11..main
Copy link
Member

Choose a reason for hiding this comment

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

Moving conversation to discord to get this over the finish line.

https://discord.com/channels/824324475256438814/1332065342746525778/1336434350660784239

app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
app/upgrades/v0.0.12.go Outdated Show resolved Hide resolved
@okdas
Copy link
Member Author

okdas commented Feb 4, 2025

Had a successful upgrade locally (using this guide).
Will create a release and plan an upgrade on Alpha.

@okdas okdas merged commit 1617784 into main Feb 4, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol General core protocol related changes
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants