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

1 stars 0 forks source link

Gas optimation proposal struct #238

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

goatbug

Vulnerability details

Impact

Use less storage slots

Proof of Concept

struct Proposal {
    uint256 licenseFee;
    string tokenName;
    string tokenSymbol;
    address proposer;
    address[] tokens;
    uint256[] weights;
    address basket;
}

License fee is a smaller number does not need to be uint256.

Could use an 8 bit value and pack it comfortable with one of the addresses to save a full storage slot.

Tools Used

Recommended Mitigation Steps

GalloDaSballo commented 2 years ago

Finding is valid, it would save an extra storage slot