-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Problem
When a user withdraws a very small amount of pool coins (e.g. 130 out of ~23.6 trillion total supply), the transaction succeeds (code 0) but the batch execution silently fails β the user sees a successful tx but receives no tokens back. Pool coins are refunded via EndBlocker, but the UX is confusing.
Root cause: the module calculates proportional reserve returns, and when the withdrawal share is too small, one or both reserve amounts round to zero. The module rejects zero-amount withdrawals internally (ErrBadPoolCoinAmount) but this happens at batch execution time, not at tx submission.
Expected Behavior
The frontend should calculate the minimum pool coin amount required for a valid withdrawal (both reserve returns >= 1 unit) and block the transaction with a clear error message before submission.
Calculation
min_pool_coins = max(
ceil(total_supply / reserve_coin_A_amount),
ceil(total_supply / reserve_coin_B_amount)
)
For pool 1 (boot/hydrogen) at current reserves: ceil(23.6T / 125B) = 189 pool coins minimum.
Evidence
- tx E26340...9AFBEE at height 22830634
- EndBlocker event:
withdraw_from_poolwithsuccess: failure - User report: pool 1 (BOOT/H), 130 pool coins
Related: go-cyber#802