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 package improvements: #1375

Closed
ValarDragon opened this issue Apr 29, 2022 · 0 comments · Fixed by #1379
Closed

Upgrades package improvements: #1375

ValarDragon opened this issue Apr 29, 2022 · 0 comments · Fixed by #1379

Comments

@ValarDragon
Copy link
Member

We need to make the following improvements to our upgrades packages:

Define a type alias for Create Upgrade Handler

func CreateUpgradeHandler(
	mm *module.Manager,
	configurator module.Configurator,
	keepers *appkeepers.Keepers
) upgradetypes.UpgradeHandler {

Make an interface with four methods, describing an upgrade:

type Upgrade interface {
  UpgradeVersion() String // e.g. v7
  UpgradeHeight() int64
  CreateUpgradeHandler(mm, configurator, keepers) upgradetypes.UpgradeHandler
  StoreUpgrades() store.StoreUpgrades
  
  // Perhaps should be a separate interface? It gets called in begin block once, to do some quick migration in case of a hard fork not going through upgrades module.
  RunForkLogic(ctx) 
}

Then we just make a list of upgrader structs in the app.go, and have a standalone routine that registers the handlers, beginblock & store loader updates.

@daniel-farina daniel-farina moved this to 🔍 Needs Review in Osmosis Chain Development Apr 29, 2022
@mergify mergify bot closed this as completed in #1379 May 4, 2022
mergify bot pushed a commit that referenced this issue May 4, 2022
Closes: #1375 

## What is the purpose of the change

Simplifies a lot of the upgrades management logic / boilerplate. The goal is that every new upgrade should from the app.go level, just require a one line update. And all the complexity would otherwise be held to within each upgrades module.

This PR is marked as draft until Changelog update + docs update to the `app/upgrades` README.

## Brief change log

* Introduces an Upgrade and Fork struct
* Adapt existing upgrades to use it

## Testing and Verifying

This should be covered by the existing test for the v4 upgrade, which tests that upgrade handler execution happens.

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? no
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? Needs to be Done
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented)
Repository owner moved this from 🔍 Needs Review to ✅ Done in Osmosis Chain Development May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant