Open code423n4 opened 2 years ago
WatchPug
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L253-L261
function lockInternal() internal { require(unlocked == 1, "re"); unlocked = 2; } modifier lock { lockInternal(); _; unlocked = 1; }
lockInternal() is unnecessary as it's used only once. Therefore they can be inlined in lock to make the code simpler and save gas.
lockInternal()
lock
Change to:
modifier lock { require(unlocked == 1, "re"); unlocked = 2; _; unlocked = 1; }
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L253-L261
lockInternal()
is unnecessary as it's used only once. Therefore they can be inlined inlock
to make the code simpler and save gas.Recommendation
Change to: