Omniscia Tokemak Network Audit
AddressRegistry Code Style Findings
AddressRegistry Code Style Findings
ARY-01C: Inefficient Hash Specification
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | AddressRegistry.sol:L22 |
Description:
The linked variable is assigned to a keccak256
instruction and is declared as constant
.
Example:
22bytes32 public constant REGISTERED_ADDRESS = keccak256("REGISTERED_ROLE");
Recommendation:
We advise it to be set as immutable
instead to cache the result of the keccak256
instruction as otherwise it is performed each time redundantly.
Alleviation:
The linked variable was properly set as immutable
from constant
taking advantage of the gas optimization.
ARY-02C: Redundant & Abnormal Assignments
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | AddressRegistry.sol:L36-L38 |
Description:
The linked assignments are ineffectual as they assign uninitialized EnumerableSet.AddressSet
variables to uninitialized entries and do not compile in future pragma
versions.
Example:
29function initialize() public initializer {30 __Context_init_unchained();31 __AccessControl_init_unchained();32
33 _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());34 _setupRole(REGISTERED_ADDRESS, _msgSender());35
36 addressSets[AddressTypes.Token] = tokenAddresses;37 addressSets[AddressTypes.Controller] = controllerAddresses;38 addressSets[AddressTypes.Pool] = poolAddresses;39}
Recommendation:
We advise them to be omitted from the codebase. Alternatively, if deletion of the existing entries in an upgrade-able implementation is desired we advise the delete
operator to be used on the mapping
entries instead.
Alleviation:
The redundant assignments have been properly removed from the codebase.