Closed code423n4 closed 2 years ago
Czar102
_atPhase internal function of LaunchEvent may potentially call currentPhase() 4 times, that's unnecessary.
_atPhase
LaunchEvent
currentPhase()
function _atPhase(Phase _phase) internal view { if (_phase == Phase.NotStarted) { require( currentPhase() == Phase.NotStarted, "LaunchEvent: not in not started" ); } else if (_phase == Phase.PhaseOne) { require( currentPhase() == Phase.PhaseOne, "LaunchEvent: not in phase one" ); } else if (_phase == Phase.PhaseTwo) { require( currentPhase() == Phase.PhaseTwo, "LaunchEvent: not in phase two" ); } else if (_phase == Phase.PhaseThree) { require( currentPhase() == Phase.PhaseThree, "LaunchEvent: not in phase three" ); } else { revert("LaunchEvent: unknown state"); } }
Manual analysis
Cache the return value of the call.
Duplicate of #162
Handle
Czar102
Vulnerability details
Impact
_atPhase
internal function ofLaunchEvent
may potentially callcurrentPhase()
4 times, that's unnecessary.Proof of Concept
Tools Used
Manual analysis
Recommended Mitigation Steps
Cache the return value of the call.