Omniscia vfat Audit
ConnectorRegistry Code Style Findings
ConnectorRegistry Code Style Findings
CRY-01C: Inefficient Duplicate Storage Read
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | ConnectorRegistry.sol:L86, L87 |
Description:
The ConnectorRegistry::updateCustomRegistry
function will inefficiently read the customRegistries[index]
value twice from storage; once to store it as the oldRegistry
and once to utilize it in accessing the isCustomRegistry
mapping.
Example:
contracts/ConnectorRegistry.sol
86address oldRegistry = address(customRegistries[index]);87isCustomRegistry[customRegistries[index]] = false;
Recommendation:
We advise the local oldRegistry
variable to be re-used, optimizing the function's gas cost.
Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):
The duplicate storage read was optimized as advised, re-using the local oldRegistry
variable.