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

Re-entrant guard can be removed from resolveDispute

Summary

Due to the function following CEI pattern and the inState modifier the resolveDispute function is already protected from reentrancy and does not need the nonReentrant modifier.

Vulnerability Details

The resolveDispute has both a nonReentrant modifier and an inState modifier. However the inState modifier already works as a pseudo re-entrant guard due to its value being updated during the function before any external calls that could be used to reenter. If the Arbiter tried to reenter s_state would no longer be equal to disputed and the function would revert. Therefore the nonReentrant guard can be safely removed to save gas.

Impact

resolveDispute With Guards No Guard Gas Savings
Avg Runtime 27,017 26,794 223
Deployment 591,900 551,375 40,525

Tools Used

Manual Review
Foundry Gas Estimates

Recommendations

Remove the re-entrant modifier on the resolve dispute function & remove the import/inheritance of ReentrancyGuard.

Support

FAQs

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