Skip to content

Block dust withdrawal in /warp β€” validate minimum pool coin amount before txΒ #1377

@saint-Joy

Description

@saint-Joy

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_pool with success: failure
  • User report: pool 1 (BOOT/H), 130 pool coins

Related: go-cyber#802

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions