#49390 [SC-Low] `UInt64SetLib#remove_item` would revert if the item is empty

Submitted on Jul 15th 2025 at 12:24:21 UTC by @pks271 for Audit Comp | Folks Smart Contract Libraryarrow-up-right

  • Report ID: #49390

  • Report Type: Smart Contract

  • Report severity: Low

  • Target: https://github.com/Folks-Finance/algorand-smart-contract-library/blob/main/contracts/library/UInt64SetLib.py

  • Impacts:

    • Contract fails to deliver promised returns, but doesn't lose value

Description

Bug Description

When items is empty, the last_idx = items.length - 1 = -1 will revert because the vm seems dont support negative value, but the remove_item function don't handle such case.

Impact

The remove_item function would revert instead of return false if the item is empty.

Recommendation

Check the item is empty or not before last_idx.

Proof of Concept

Proof of Concept

Insert the case into tests/library/UInt64SetLib.test.ts:

Result:

Was this helpful?