40,000 USDC
View results
Submission Details
Severity: gas
Valid

The use of a logical AND in place of double if is slightly less gas efficient

Summary

The use of a logical AND in place of double if is slightly less gas efficient

Vulnerability Details

The use of a logical AND in place of double if is slightly less gas efficient in instances where there isn't a corresponding else statement for the given if statement
Using a double if statement instead of logical AND (&&) can provide similar short-circuiting behavior whereas double if is slightly more efficient.

File: /src/Escrow.sol
67: if (msg.sender != i_buyer && msg.sender != i_seller) {
revert Escrow__OnlyBuyerOrSeller();

Impact

Save gas

Tools Used

Manual

Recommendations

Use double If instead of "AND" operator

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.