Closed code423n4 closed 2 years ago
Dravee
SLOADs are expensive
Here, _lockup[_target] can be loaded twice from storage:
_lockup[_target]
325: function getLockup(address _target) 326: external 327: view 328: override 329: returns (uint256) 330: { 331: if (_lockup[_target] == 0) { 332: return _lockup[address(0)]; 333: } else { 334: return _lockup[_target]; 335: } 336: }
VS Code
Cache the storage reading in a memory variable
https://github.com/code-423n4/2022-01-insure-findings/issues/320
Handle
Dravee
Vulnerability details
Impact
SLOADs are expensive
Proof of Concept
Here,
_lockup[_target]
can be loaded twice from storage:Tools Used
VS Code
Recommended Mitigation Steps
Cache the storage reading in a memory variable