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

Double && operator costs more gas

Summary

Double && operator costs more gas than using a nested if statement

Vulnerability Details

It costs ~30 extra gas to use the double && operator instead of using a nested if statement.

Impact

Costs more gas

Tools Used

Foundry

Recommendations

Use a nested if statement instead

modifier onlyBuyerOrSeller() {
if (msg.sender != i_buyer) {
if (msg.sender != i_seller) {
revert Escrow__OnlyBuyerOrSeller();
}
}
_;
}

Support

FAQs

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