Skip to content

Fix consensus failure on SDK 0.47→0.50 binary upgrade - #32

Merged
vNodesV merged 10 commits into
mainfrom
copilot/investigate-consensus-failure
Feb 11, 2026
Merged

Fix consensus failure on SDK 0.47→0.50 binary upgrade#32
vNodesV merged 10 commits into
mainfrom
copilot/investigate-consensus-failure

Conversation

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Chain panics with CONSENSUS FAILURE when swapping the 0.47.x binary for 0.50.x because module params (consensus, mint, etc.) are still in x/params subspaces but SDK 0.50 reads from collections storage, which is empty.

ERR failed to get consensus params err="collections: not found: key 'no_key' of type ...ConsensusParams"
ERR error in proxyAppConn.FinalizeBlock err="collections: not found: key 'no_key' of type ...mint.v1beta1.Params"
ERR CONSENSUS FAILURE!!!

Changes

app/app.go

  • Register consensus.NewAppModule in module manager — was initialized but never registered, so its gRPC services and migration hooks were inactive
  • Add PreBlocker calling mm.PreBlock() — required by SDK 0.50 for the upgrade module to detect and execute upgrade plans
  • Add missing crisistypes.StoreKey to NewKVStoreKeys — was used by crisis keeper but never allocated
  • Register baseapp.Paramspace subspace with ConsensusParamsKeyTable in initParamsKeeper — enables reading legacy consensus params during migration
  • Call RegisterUpgradeHandlers() before LoadLatestVersion

app/upgrades.go (new)

  • Upgrade handler v2-sdk50 that:
    1. Migrates consensus params from legacy x/params "baseapp" subspace → x/consensus collections via baseapp.MigrateParams()
    2. Runs all module migrations via mm.RunMigrations() (mint v1→v2, staking v4→v5, slashing v3→v4, etc.)
  • Configures UpgradeStoreLoader with Added: ["Consensus", "crisis"] for store keys new in SDK 0.50

Upgrade procedure

# On old 0.47 binary: schedule the upgrade
memed tx upgrade software-upgrade v2-sdk50 --upgrade-height <H> --from <validator> ...

# At height H: swap binary, restart validators
make install && systemctl restart memed

The PreBlocker detects the plan, runs the handler, migrates all params, and the chain continues.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 7 commits February 11, 2026 18:56
Integrate SDK 0.50 AutoCLI to generate query commands for all core
modules (auth, bank, staking, distribution, gov, slashing, mint,
params, feegrant, authz, evidence, upgrade). Uses ModuleOptions with
static proto descriptors from zero-value AppModule instances to avoid
nil keeper panics. Wasm module uses Modules map for custom command
detection. All 19 query subcommands now available.

Co-authored-by: vNodesV <100853686+vNodesV@users.noreply.github.com>
Co-authored-by: vNodesV <100853686+vNodesV@users.noreply.github.com>
Enable all module query commands via AutoCLI integration
Copilot AI and others added 2 commits February 11, 2026 20:33
…ler for SDK 0.47→0.50 migration

The consensus failure occurred because the chain database was in SDK 0.47 format
(params in x/params subspaces) but SDK 0.50 reads from collections storage.

Changes:
- Add consensus module to module manager for proper registration
- Add PreBlocker (required by SDK 0.50 upgrade module)
- Create upgrade handler (v2-sdk50) that migrates consensus params from
  x/params baseapp subspace to x/consensus collections store, and runs
  all module migrations (mint, staking, slashing, etc.)
- Add store loader for new store keys (Consensus, crisis)
- Add missing crisis store key to NewKVStoreKeys
- Register baseapp Paramspace in initParamsKeeper for consensus params migration

Co-authored-by: vNodesV <100853686+vNodesV@users.noreply.github.com>
Co-authored-by: vNodesV <100853686+vNodesV@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate and fix the consensus failure issue Fix consensus failure on SDK 0.47→0.50 binary upgrade Feb 11, 2026
Copilot AI requested a review from vNodesV February 11, 2026 20:39
@vNodesV
vNodesV changed the base branch from copilot/investigate-command-module-loss to main February 11, 2026 20:53
@vNodesV
vNodesV marked this pull request as ready for review February 11, 2026 20:54
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@vNodesV
vNodesV merged commit cf357ab into main Feb 11, 2026
8 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants