code-423n4 / 2021-09-yaxis-findings

0 stars 0 forks source link

Cache storage access #88

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

There are places where the same storage variable is accessed multiple times in the same function. It would be more gas efficient to cache these variables and re-use them where necessary. E.g. function addStrategy accesses _vaultDetails[_vault] 5 times. Similarly with function withdrawAll and other functions.

Recommended Mitigation Steps

Cache storage access and reuse variables.

GalloDaSballo commented 2 years ago

Duplicate of #56

Would like to see links to examples and mitigations, instead of quick copy paste of function names