Omniscia XFai Audit
xfai Static Analysis Findings
xfai Static Analysis Findings
XFA-01S: Redundant Literal Equality
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | xfai.sol:L323, L337, L376 |
Description:
The linked conditionals conduct an equality comparison (==
) between a variable and a bool
literal which is considered redundant.
Example:
contracts/xfai.sol
323if (user.enrolled == false) {324 userAddresses.push(msg.sender);325 user.enrolled = true;326}
Recommendation:
We advise these instances to be replaced by the variable itself either as is or negated (!
) to represent what they are meant to compare.
Alleviation:
The first of the comparisons was omitted from the codebase, however, the latter two remain and still conduct a literal comparison of bool
variables.