sherlock-audit / 2024-06-velocimeter-judging

11 stars 7 forks source link

Mammoth Powder Moose - The return value of the `Voter.sol::factoryLength` function will never be decreased due to the form of removal in the code, which sets an address to 0 instead of removing it from the array. #712

Closed sherlock-admin4 closed 4 months ago

sherlock-admin4 commented 4 months ago

Mammoth Powder Moose

Low/Info

The return value of the Voter.sol::factoryLength function will never be decreased due to the form of removal in the code, which sets an address to 0 instead of removing it from the array.

Summary

The return value of the Voter.sol::factoryLength function will never be decreased due to the form of removal in the code, which sets an address to 0 instead of removing it from the array.

Vulnerability Detail

Even if you use the function to remove some factories, the size of the address[] factories array will not change.

Impact

The size of the array when calling the Voter.sol::factoryLength function will remain the same, due to the way the coding was done to remove a factories address from the array.

Code Snippet

https://github.com/sherlock-audit/2024-06-velocimeter/blob/main/v4-contracts/contracts/Voter.sol#L187-L199

Tool used

Manual Review

Recommendation

Change the way you remove an element from an array