Context
In the origin Cosmos SDK delegate behavior, stakers can stake their unclaimed rewards via a hook that calls BeforeDelegationSharesModified → distribution.WithdrawDelegationRewards. This withdraws the user's rewards to their balance before the delegation runs, enabling reward auto-compounding within a single transaction.
In our multi-staking delegate, we lock the bonded token before calling cosmos staking.Delegate, which means the hook fires after the bonded token is already locked. As a result, unclaimed rewards are not available to cover the delegation amount at the time of escrow.
This is not a security bug but a UX limitation — users need one additional transaction to delegate the rewards that were auto-withdrawn by the previous delegate message.
Resolve approach
- Add withdraw user reward before locking token in delegate, redelegate
- It not a security bug so we can just announce to validator
Context
In the origin Cosmos SDK delegate behavior, stakers can stake their unclaimed rewards via a hook that calls
BeforeDelegationSharesModified → distribution.WithdrawDelegationRewards. This withdraws the user's rewards to their balance before the delegation runs, enabling reward auto-compounding within a single transaction.In our multi-staking delegate, we lock the bonded token before calling cosmos staking.Delegate, which means the hook fires after the bonded token is already locked. As a result, unclaimed rewards are not available to cover the delegation amount at the time of escrow.
This is not a security bug but a UX limitation — users need one additional transaction to delegate the rewards that were auto-withdrawn by the previous delegate message.
Resolve approach