Omniscia Arcade XYZ Audit

CallWhitelist Code Style Findings

CallWhitelist Code Style Findings

CWT-01C: Inefficient mapping Lookups

Description:

The linked statements perform key-based lookup operations on mapping declarations from storage multiple times for the same key redundantly.

Example:

contracts/vault/CallWhitelist.sol
72if (whitelist[callee][selector]) revert CW_AlreadyWhitelisted(callee, selector);
73
74whitelist[callee][selector] = true;

Recommendation:

As the lookups internally perform an expensive keccak256 operation, we advise the lookups to be cached wherever possible to a single local declaration that either holds the value of the mapping in case of primitive types or holds a storage pointer to the struct contained.

Alleviation (45ccaa43fa72dfe818736e5dc737af4afb2b2af3):

The referenced optimization has been applied properly, caching the interim whitelist[callee] lookup to a storage variable that is consequently utilized for both access statements.