Open code423n4 opened 2 years ago
Dravee
SLOADs are expensive
Here, attributions[_target] can be loaded twice from storage:
attributions[_target]
Vault.sol 400: function underlyingValue(address _target) 401: public 402: view 403: override 404: returns (uint256) 405: { 406: if (attributions[_target] > 0) { 407: return (valueAll() * attributions[_target]) / totalAttributions; 408: } else { 409: return 0; 410: } 411: }
VS Code
Cache the loaded storage value in a memory variable
implement with this together https://github.com/code-423n4/2022-01-insure-findings/issues/344
Handle
Dravee
Vulnerability details
Impact
SLOADs are expensive
Proof of Concept
Here,
attributions[_target]
can be loaded twice from storage:Tools Used
VS Code
Recommended Mitigation Steps
Cache the loaded storage value in a memory variable