Omniscia Seen Haus Audit

SeenConstants Code Style Findings

SeenConstants Code Style Findings

SCS-01C: Inefficient Hash Constants

TypeSeverityLocation
Gas OptimizationInformationalSeenConstants.sol:L17-L22

Description:

The linked constant declarations are meant to be assigned to the result of a keccak256 instruction. Contrary to the expected, constant variables are evaluated as expressions and as such the gas optimization of caching the result of the keccak256 instruction is actually not achieved here.

Example:

contracts/domain/SeenConstants.sol
17bytes32 internal constant ADMIN = keccak256("ADMIN"); // Deployer and any other admins as needed
18bytes32 internal constant SELLER = keccak256("SELLER"); // Approved sellers amd Seen.Haus reps
19bytes32 internal constant MINTER = keccak256("MINTER"); // Approved artists and Seen.Haus reps
20bytes32 internal constant ESCROW_AGENT = keccak256("ESCROW_AGENT"); // Seen.Haus Physical Item Escrow Agent
21bytes32 internal constant MARKET_HANDLER = keccak256("MARKET_HANDLER"); // Market Handler contracts
22bytes32 internal constant UPGRADER = keccak256("UPGRADER"); // Performs contract upgrades

Recommendation:

We advise the immutable keyword to be utilized instead to actually take advantage of the gas benefit of pre-calculating the keccak256 hash. For more information, consult this issue in the Solidity compiler.

Alleviation:

The Seen Haus team initially applied this change but reverted it as it would significantly complicate inherited contract utilizations of the said variables within their constructor declarations.