code-423n4 / 2021-11-streaming-findings

0 stars 0 forks source link

`++currStreamId` is more gas efficient than `currStreamId += 1` #263

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L819-L819

currStreamId += 1;

Using ++currStreamId is more gas efficient than currStreamId += 1 for storage.

We suggest to use unchecked { ++currStreamId } to even better gas performance.