code-423n4 / 2022-03-volt-findings

0 stars 0 forks source link

Gas Optimizations #85

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago
  1. Immutable instead of constant https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/peg/NonCustodialPSM.sol#L49
  2. reason string with length > 32 bytes takes more gas, it increases deployed bytecode size https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/peg/NonCustodialPSM.sol#L277 https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/peg/NonCustodialPSM.sol#L402 https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/peg/NonCustodialPSM.sol#L445
  3. Should be immutable https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/volt/Volt.sol#L11 https://github.com/code-423n4/2022-03-volt/blob/f1210bf3151095e4d371c9e9d7682d9031860bbd/contracts/pcv/compound/ERC20CompoundPCVDeposit.sol#L16
  4. Can be in single slot, timestamp and duration fit in 128 bits https://github.com/code-423n4/2022-03-volt/blob/main/contracts/utils/Timed.sol#L8-L11