Steemhunt/mint.club-v2-contract

Audit: Revert if `start>stop`

Closed this issue · 3 comments

There is an unchecked keyword it doesn't matter

 unchecked {
            uint256 lockUpsLength = lockUps.length;
            if (stop > lockUpsLength) {
                stop = lockUpsLength;
            }

            uint256 count;
            for (uint256 i = start; i < stop; ++i) {
                if (lockUps[i].token == token) ++count;
            }

            ids = new uint256[](count);
            uint256 j;
            for (uint256 i = start; i < stop; ++i) {
                if (lockUps[i].token == token) {
                    ids[j++] = i;
                    if (j == count) break;
                }
            }
        }

It won't revert with custom error if start < stop

because

uint256 count;
for (uint256 i = start; i < stop; ++i) {
    if (tokenBond[tokens[i]].reserveToken == reserveToken) ++count;
}

it will just set the count zero, and an empty address is returned

Agreed