code-423n4 / 2022-01-sherlock-findings

0 stars 0 forks source link

Gas Optimization: Struct layout #236

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

gzeon

Vulnerability details

Impact

https://github.com/code-423n4/2022-01-sherlock/blob/c763f10c4b5fe2127677d6c25b83adcf3bcec212/contracts/interfaces/managers/ISherlockClaimManager.sol#L57

  struct Claim {
    uint256 created;
    uint256 updated;
    address initiator;
    bytes32 protocol;
    uint256 amount;
    address receiver;
    uint32 timestamp;
    State state;
    bytes ancillaryData;
  }

can be reordered to save 1 storage slot

  struct Claim {
    uint256 created;
    uint256 updated;
    uint256 amount;
    address initiator;
    bytes32 protocol;
    address receiver;
    uint32 timestamp;
    State state;
    bytes ancillaryData;
  }