sherlock-audit / 2024-01-telcoin-judging

6 stars 5 forks source link

0xGreyWolf - `CouncilMembers::_retrieve()` loops over an array of `balances` to stream `individualBalance` and as the array size (council members) grow, gas cost expands until it becomes unusable. #162

Closed sherlock-admin closed 6 months ago

sherlock-admin commented 6 months ago

0xGreyWolf

high

CouncilMembers::_retrieve() loops over an array of balances to stream individualBalance and as the array size (council members) grow, gas cost expands until it becomes unusable.

Summary

Vulnerability Detail

Impact

Code Snippet

Tool used

Manual Review

Recommendation

Use mapping to track balances per tokenId then implement the code around it.

--    uint256[] public balances;
++    mapping (uint256 tokenId => uint256 balance) balances;
nevillehuang commented 6 months ago

Invalid, it is extremely if not impossible that an OOG will occur given council members will not reach that kind of lengths, since it is admin approved