Skip to content

Conversation

@bit2swaz
Copy link

@bit2swaz bit2swaz commented Jan 2, 2026

Description

Closes #25724

Adds validation to prevent governance from setting bond_denom to a non-existent denom via MsgUpdateParams.

Problem

The staking module currently allows governance to update bond_denom without validating that the denom exists on-chain. This creates a governance footgun where:

  • Setting bond_denom to a non-existent denom places the chain in an unsafe state
  • New staking operations reference a denom with no backing supply
  • Core staking assumptions are violated

Solution

Add validation in the UpdateParams handler to check that the new bond_denom has non-zero supply in the bank module before allowing the update.

Changes

  • Add supply check in UpdateParams handler using bankKeeper.GetSupply
  • Return ErrInvalidDenom if bond_denom has zero supply
  • Add test case for non-existent denom validation scenario
  • Add ErrInvalidDenom error constant (code 46)
  • Fix unrelated autocli help message golden file

Testing

  • Added unit test for non-existent bond denom validation
  • All existing tests pass
  • Verified error message is clear and actionable

Fixes cosmos#25724

Add validation in MsgUpdateParams handler to check that bond_denom
has non-zero supply before allowing governance to update it. This
prevents governance from setting bond_denom to a non-existent denom
which would place the chain in an unsafe state.

The fix queries the bank module's GetSupply to verify the denom
exists on-chain. If supply is zero, the handler returns ErrInvalidDenom.

Changes:
- Add supply check in UpdateParams handler using bankKeeper.GetSupply
- Return ErrInvalidDenom if bond_denom has zero supply
- Add test case for non-existent denom validation
- Add ErrInvalidDenom error constant (error code 46)
- Fix autocli help message golden file (TimeoutTimestamp -> TimeoutDuration)
@aljo242
Copy link
Contributor

aljo242 commented Jan 6, 2026

closing as we require signed commits - please reopen with signed commits!

@aljo242 aljo242 closed this Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x/staking: MsgUpdateParams allows setting bond_denom to non-existent denom

2 participants