Omniscia Vendor Finance Audit
Address Code Style Findings
Address Code Style Findings
ADD-01C: Outdated Contract Check Implementation
Type | Severity | Location |
---|---|---|
Gas Optimization | Address.sol:L23-L34 |
Description:
The referenced isContract
implementation is meant to be copied from the OpenZeppelin implementation, however, it is outdated by two updates that have been performed in the original implementation which significantly optimize it.
Example:
contracts/utils/Address.sol
23function isContract(address account) internal view returns (bool) {24 // According to EIP-1052, 0x0 is the value returned for not-yet created accounts25 // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned26 // for accounts without code, i.e. `keccak256('')`27 bytes32 codehash;28 bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;29 // solhint-disable-next-line no-inline-assembly30 assembly {31 codehash := extcodehash(account)32 }33 return (codehash != accountHash && codehash != 0x0);34}
Recommendation:
We advise the code to be updated to match the optimized implementation of OpenZeppelin.
Alleviation:
The contract is no longer part of the codebase rendering this exhibit inapplicable.