F-2025-0006·rounding-error

Dust/leftover reserves in bins will be forced to stay idle

TL;DR

Bins are removed from the swap tree only when total shares hit zero, but rounding-down on burn can leave non-zero reserves with zero shares, locking dust funds in the curve state.

Severity
MEDIUM
Impact
MEDIUM
Likelihood
MEDIUM
Method
MManual review
CAT.
Complexity
LOW
Exploitability
LOW
02Section · Description

Description

Bins are removed from the tree (which is essential for swaps) when the total shares left for that bin are zero; however, this condition does not assure the bin's reserve in turn will be empty, as the shares burned from users are rounded down, allowing for possible leftover reserves in such a bin while having zero total shares.

code
if (new_total_shares == 0) {
remove_bin_from_tree(storage_keys, internal_bin_id);
}

This will cause some reserves to remain unused when swapping, leading to idle funds left in the curve state.

03Section · Impact

Impact

Dust amounts of token reserves can be locked in bins that have been removed from the swap tree. The amounts are small per bin but accumulate over time and remain inaccessible to swaps or LP withdrawals.

04Section · Recommendation

Recommendation

Ensure the shares burned align with the actual reserve returned to the user, or turn the leftover reserves into protocol fees.

05Section · Resolution

Resolution

Fixed in commit 96aa6677a491063d37c81e5fbce252aa97f16873.

Status
Fixed
Fix commit
96aa6677a491
F-2025-0006

oog
zealynx

Smart Contract Security Digest

Monthly exploit breakdowns, audit checklists, and DeFi security research — straight to your inbox

© 2026 Zealynx