Omniscia 0xPhase Audit
ERC20PermitUpgradeable Code Style Findings
ERC20PermitUpgradeable Code Style Findings
ERP-01C: Redundant In-Memory Variable
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | ERC20PermitUpgradeable.sol:L63, L65 |
Description:
The referenced success variable is declared and utilized in the immediate ensuing statement.
Example:
lib/token/ERC20/ERC20PermitUpgradeable.sol
63bool success = SignatureChecker.isValidSignatureNow(owner, hash, sig);64
65require(success, "ERC20PermitUpgradeable: invalid signature");Recommendation:
We advise the function invocation itself to be performed within the require check, rendering the local success variable redundant.
Alleviation (3dd3d7bf0c2693b2f9c23bacedfa420393f7ea84):
The SignatureChecker::isValidSignatureNow function is directly evaluated within the require check referenced, optimizing the code's gas cost.
