github.com/Finschia/finschia-sdk@v0.48.1/x/upgrade/types/handler.go (about)

     1  package types
     2  
     3  import (
     4  	sdk "github.com/Finschia/finschia-sdk/types"
     5  	"github.com/Finschia/finschia-sdk/types/module"
     6  )
     7  
     8  // UpgradeHandler specifies the type of function that is called when an upgrade
     9  // is applied.
    10  //
    11  // `fromVM` is a VersionMap of moduleName to fromVersion (unit64), where
    12  // fromVersion denotes the version from which we should migrate the module, the
    13  // target version being the module's latest version in the return VersionMap,
    14  // let's call it `toVM`.
    15  //
    16  // `fromVM` is retrieved from x/upgrade's store, whereas `toVM` is chosen
    17  // arbitrarily by the app developer (and persisted to x/upgrade's store right
    18  // after the upgrade handler runs). In general, `toVM` should map all modules
    19  // to their latest ConsensusVersion so that x/upgrade can track each module's
    20  // latest ConsensusVersion; `fromVM` can be left as-is, but can also be
    21  // modified inside the upgrade handler, e.g. to skip running InitGenesis or
    22  // migrations for certain modules when calling the `module.Manager#RunMigrations`
    23  // function.
    24  //
    25  // Please also refer to docs/core/upgrade.md for more information.
    26  type UpgradeHandler func(ctx sdk.Context, plan Plan, fromVM module.VersionMap) (module.VersionMap, error)