code-423n4 / 2021-11-overlay-findings

1 stars 0 forks source link

Change unchanged storage variables to constants can save gas #109

Closed code423n4 closed 2 years ago

code423n4 commented 3 years ago

Handle

defsec

Vulnerability details

Impact

Some storage variables are only set once and never changed.

Changing them to constant can save gas.

Proof of Concept

The following variable can mark as constant.

https://github.com/code-423n4/2021-11-overlay/blob/914bed22f190ebe7088194453bab08c424c3f70c/contracts/shims/ComptrollerShim.sol#L15

https://github.com/code-423n4/2021-11-overlay/blob/914bed22f190ebe7088194453bab08c424c3f70c/contracts/OverlayV1UniswapV3Market.sol#L14

Tools Used

Code Review

Recommended Mitigation Steps

Consider changing to constant and using all caps for the names.

mesozoic-technology commented 3 years ago

Indeed, I think this would have been changed when we did final house cleaning and preparations for actual deployment.

mikeyrf commented 2 years ago

duplicate #85