bosonprotocol / contracts

[DEPRECATED] Boson Protocol v1
GNU Lesser General Public License v3.0
69 stars 17 forks source link

Potential Tight-Packing Optimization #331

Closed zajck closed 2 years ago

zajck commented 2 years ago

UHS-01C: Potential Tight-Packing Optimization

Type Severity Location
Gas Optimization Informational UsingHelpers.sol:L55-L61

Description:

THe DepositsReleased struct contains two variable declarations in sequence one of which is a uint8 and the other being a uint256.

Example:

struct DepositsReleased {
    // bool issuer;
    // bool holder;
    // bool pool;
    uint8 status;
    uint256 releasedAmount;
}

Recommendation:

We advise the capability of the uint256 to be downgraded to be assessed and if possible to downgrade it to a uint248 variable permitting both values to be packed to a single storage slot and thus cause a single SSTORE operation to be executed when both values are written to.