Skip to content

x/upgrade: enforce valid genesis state #11550

Open
@alexanderbez

Description

Summary

It's technically possible to have an on-chain upgrade with invalid genesis state that would result in a functional network.

Consider the upcoming Hub's Theta upgrade. This upgrade includes an SDK version bump to 0.45 which has x/bank metadata changes. Assuming the developers are unaware of these changes and what would constitute a valid state, then it's completely possible to miss setting the correct and expected metadata for assets.

However, the upgrade and network will still "work" in this particular case.

Proposal

My proposal is simple, require that the SetUpgradeHandler method in x/upgrade calls ValidateGenesis after executing the upgrade closure function.

  1. Update SetUpgradeHandler to accept the ModuleManager as an argument
  2. Update the ModuleManager interface to have a method that validates genesis state. There already is one but that only works on raw data. We need a method to call on already existing data in state. Perhaps ValidateState or ValidateGenesisState.
  3. Call the method in (2) after the closure function is called in SetUpgradeHandler.

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions