code-423n4 / 2021-08-notional-findings

3 stars 0 forks source link

Gas savings: variables can all be a multiple of each other #23

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

tensors

Vulnerability details

Impact

Consider Market.sol, L44-47. We have 3 storage variables that are declared, that will all be multiples of each other (at least throughout Market.sol). You can store 1 variable and just scale by the needed amount to get the other variables. This will save gas.

Proof of Concept

https://github.com/code-423n4/2021-08-notional/blob/4b51b0de2b448e4d36809781c097c7bc373312e9/contracts/internal/markets/Market.sol#L44-L46

jeffywu commented 3 years ago

This makes no sense to me.

ghoul-sol commented 3 years ago

Not a clear description. Invalid.