code-423n4 / 2021-12-amun-findings

0 stars 0 forks source link

Avoid unnecessary storage read can save gas #207

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

https://github.com/code-423n4/2021-12-amun/blob/98f6e2ff91f5fcebc0489f5871183566feaec307/contracts/basket/contracts/facets/shared/Reentry/ReentryProtection.sol#L11-L12

s.lockCounter++;
uint256 lockValue = s.lockCounter;

Can be changed to:

uint256 lockValue = s.lockCounter = s.lockCounter + 1;