In SnapshotModuleBase.sol , the function _findScheduledMostRecentPastSnapshot uses an uninitialized return variable time within an if condition. Return variables are default-initialized to zero, so time will be 0 inside the function body.
Because time is always 0 , the condition time != 0 is always false. This makes the second part of the ||
condition, which appears to be an optimization to exit early, unreachable.
While this does not seem to break the
core logic of the function, it renders the optimization ineffective and leads to unnecessary gas consumption by always proceeding to the loop that follows.
if (
currentArraySize == 0 ||
(($._currentSnapshotIndex + 1 == currentArraySize) && (time != 0))
) {
return (0, currentArraySize);
}