Repository navigation
fix(x/feegrant): migrate fee allowance queue entries stored with an empty value - #26944
Open
dpdanpittman wants to merge 3 commits into
Open
dpdanpittman wants to merge 3 commits into
dpdanpittman wants to merge 3 commits into
Conversation
…mpty value The keeper reads the fee allowance expiry queue with collections.BoolValue, which cannot decode an empty value. The standalone cosmossdk.io/x/feegrant module and the in-tree v1 -> v2 store migration both wrote queue entries with an empty value, so on chains that upgraded to v0.55 with such entries RemoveExpiredAllowances fails in the EndBlocker once the first one expires, halting the chain. Add a v2 -> v3 store migration that rewrites every empty-valued queue entry to the BoolValue encoding of true, bump ConsensusVersion to 3, and make the v1 -> v2 migration write the encoded value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RGzi5xYvf1h3LR2v7cHMcQ
…26944 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RGzi5xYvf1h3LR2v7cHMcQ
Contributor
|
@greptile review |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryRepairs legacy fee allowance queue entries so expired grants can be removed without an encoding error.
|
Contributor
Author
|
@dhfang thanks for kicking off the Greptile pass. It came back clean, and I've updated the branch against main. Could you or another maintainer take a look when you have a minute? Happy to adjust anything. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
x/feegrantreads its fee allowance expiry queue (FeeAllowanceQueue, prefix0x01) withcollections.BoolValue, which cannot decode an empty value. Two writers store queue entries with an empty value:cosmossdk.io/x/feegrantmodule (v0.1.x, v0.2.0), which chains ran before v0.55;migrations/v2/store.gosets[]byte{}).The consensus version stayed at 2 and there is no migration, so a chain that upgrades to v0.55 with grants created before it keeps those entries. When the first one expires,
RemoveExpiredAllowancesfails in theEndBlockerwithcollections: encoding error: wanted size to be at least 1on every validator, and the chain halts.This halted XION's testnet (
xion-testnet-2) at height 19286361 on 2026-10-29. XION fixed it in its own upgrade handler (burnt-labs/xion v33.0.1); this PR moves that fix into the module so every chain gets it fromRunMigrations.Changes
x/feegrant/migrations/v3): rewrites every queue entry with an empty value to theBoolValueencoding oftrue. Entries that already have a value, and the allowance prefix, are left unchanged, so it is idempotent. Keys are collected before any write.Migrator.Migrate2to3, registered from version 2;ConsensusVersiongoes from 2 to 3.trueinstead of an empty value.key.go,migrations/v2/keys.goand the module README described the empty value; they now sayBoolValue (true). CHANGELOG (State Machine Breaking) and an UPGRADING.md section, following fix(enterprise/poa): truncate fee shares so allocations never exceed the balance #26875.Tests
keeper/migrations_test.go: seeds a grant plus an empty-valued queue entry, advances block time past expiry, and showsRemoveExpiredAllowancesfails withErrEncodingbefore the migration and removes both the grant and the queue entry after it.module/module_test.go: runs the realRunMigrationsfrom feegrant version 2 through the module's registered migrations, so the registration and the version bump are covered too.migrations/v3/store_test.go: empty values rewritten, non-empty and other-prefix entries untouched, idempotent on a second run, empty store.migrations/v2/store_test.go: entries written by the v1 → v2 migration now decode, and expire cleanly.Each test fails with the corresponding part of the fix reverted.
go test ./x/feegrant/..., the simapp migration tests andgolangci-lint(v2.15.0, repo config) pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01RGzi5xYvf1h3LR2v7cHMcQ