Closed code423n4 closed 2 years ago
Dravee
SLOADs are expensive
Here, _min[_target] can be loaded twice from storage:
_min[_target]
379: function getMinDate(address _target) 380: external 381: view 382: override 383: returns (uint256) 384: { 385: if (_min[_target] == 0) { 386: return _min[address(0)]; 387: } else { 388: return _min[_target]; 389: } 390: }
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,
_min[_target]
can be loaded twice from storage:Tools Used
VS Code
Recommended Mitigation Steps
Cache the storage reading in a memory variable