Skip to content
Cosmopediaby Unity Nodes
Documentationcosmos/cosmos-sdk-migration-mcpcosmos/cosmos-sdk-migration-mcp › src › cosmos_migration_mcp › migration_spec › v50-to-v54View on cosmos/cosmos-sdk-migration-mcp ↗

── verification ────────────────────────────────────────────────────────────

id: epochs-keeper-pointer title: EpochsKeeper value → pointer version: v50+ -> v54 description: | The EpochsKeeper field on the app struct changed from a value type to a pointer type in v54. The initialisation pattern must also change: the keeper is first created as a local variable, then assigned via pointer before any hooks are set.

v53 pattern: app.EpochsKeeper = epochskeeper.NewKeeper(...) app.EpochsKeeper.SetHooks(...)

v54 pattern: epochsKeeper := epochskeeper.NewKeeper(...) app.EpochsKeeper = &epochsKeeper app.EpochsKeeper.SetHooks(...)

This is handled as two text replacements:

  1. Rewrite the assignment to a local variable declaration.
  2. Insert the pointer assignment before the SetHooks call.

upstream_sources:

  • docs://upgrading/v0.54
  • docs://changelog/v0.54-breaking

depends_on:

  • core-sdk-migration

detection: sdk_version: max_exclusive: v0.54.0-0 imports: - github.com/cosmos/cosmos-sdk/x/epochs/keeper patterns: - app.EpochsKeeper = epochskeeper.NewKeeper( - app.EpochsKeeper = *epochsmodulekeeper.NewKeeper( - EpochsKeeper epochskeeper.Keeper - EpochsKeeper epochsmodulekeeper.Keeper

changes:

── text replacements ─────────────────────────────────────────────────

text_replacements: - old: "EpochsKeeper epochskeeper.Keeper" new: "EpochsKeeper *epochskeeper.Keeper"

- old: "EpochsKeeper epochsmodulekeeper.Keeper"
  new: "EpochsKeeper *epochsmodulekeeper.Keeper"

# Step 1: Convert field assignment to local variable
- old: "app.EpochsKeeper = epochskeeper.NewKeeper("
  new: "epochsKeeper := epochskeeper.NewKeeper("

# Step 2: Insert pointer assignment before SetHooks
- old: "\tapp.EpochsKeeper.SetHooks("
  new: "\tapp.EpochsKeeper = &epochsKeeper\n\n\tapp.EpochsKeeper.SetHooks("

# Some chains use a chain-local epochs keeper constructor that already
# returns *Keeper. After the field type changes to a pointer, only the
# explicit dereference needs to be removed.
- old: "app.EpochsKeeper = *epochsmodulekeeper.NewKeeper("
  new: "app.EpochsKeeper = epochsmodulekeeper.NewKeeper("

── verification ────────────────────────────────────────────────────────────

verification: must_not_contain: - pattern: app.EpochsKeeper = epochskeeper.NewKeeper( - pattern: EpochsKeeper epochskeeper.Keeper - pattern: EpochsKeeper epochsmodulekeeper.Keeper must_contain: - pattern: "app.EpochsKeeper = &epochsKeeper"