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.
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.
resolveDispute | With Guards | No Guard | Gas Savings |
---|---|---|---|
Avg Runtime | 27,017 | 26,794 | 223 |
Deployment | 591,900 | 551,375 | 40,525 |
Manual Review
Foundry Gas Estimates
Remove the re-entrant modifier on the resolve dispute function & remove the import/inheritance of ReentrancyGuard.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.