Skip to content

Conversation

@wanesurf
Copy link

@wanesurf wanesurf commented Jan 7, 2026

Summary

This PR adds a new integration test (TestMaxUnbondingDelegationEntries) to verify and document the behavior of the max_entries staking parameter, which limits the number of concurrent unbonding delegations per delegator-validator pair.

Motivation

The max_entries parameter is a critical but often overlooked constraint in Cosmos SDK-based chains. Several DeFi protocols on Coreum rely heavily on delegation and undelegation mechanics to generate yield:

  • Pulsara Liquid Staking - Manages staking positions on behalf of users
  • Cruise Control Lending & Borrowing (soon) - Uses staking mechanics as part of its yield strategy

The challenge is that the max_entries threshold can be reached relatively quickly during normal protocol operations, potentially blocking further undelegations until existing entries complete their unbonding period.

What This Test Validates

  1. Parameter enforcement: Confirms that the chain correctly rejects undelegation requests once max_entries is reached
  2. Per-pair scoping: Demonstrates that the limit applies per delegator-validator pair, not globally per delegator — meaning a delegator can still create unbonding entries with other validators even when at the limit with one
  3. Error handling: Verifies the expected error message (too many unbonding delegation entries) is returned

Why This Matters for DeFi Developers

Understanding this parameter is essential when building protocols that programmatically manage delegations. Without proper handling, a protocol could find itself unable to process user withdrawal requests.

Recommended Mitigation Strategies

DeFi developers can work around this limitation by:

  • Implementing a dedicated smart contract that batches and manages undelegation entries
  • Designing withdrawal queues that respect the max_entries limit
  • Spreading delegations across multiple validators to increase effective undelegation capacity
  • Monitoring unbonding entry counts and proactively managing the queue

Test Coverage

The test performs the following sequence:

  1. Queries the current max_entries parameter from chain state
  2. Creates a validator and funds a delegator account
  3. Delegates tokens to the validator
  4. Creates exactly max_entries unbonding delegations (all should succeed)
  5. Attempts to create one additional unbonding delegation (should fail)
  6. Verifies the error message and that no extra entry was created
  7. Creates a second validator and confirms undelegation works (proving per-pair scoping)

File Changed

integration-tests/modules/staking_test.go → Added TestMaxUnbondingDelegationEntries

Testing

make integration-tests-modules 

This change is Reviewable

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.

1 participant