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
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.
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