40,000 USDC
View results
Submission Details
Severity: gas

Mark payable functions guaranteed to revert

Summary

Make functions guaranteed to revert when called by normal users as 'payable'

Vulnerability Details

Making certain access controlled functions payable can save the right caller gas. If not made payable there will be costly checks in opcodes that make the function more expensive for the right caller

Impact

  1. Make payable Escrow.sol confirmReceipt() payable ....saves buyer gas when calling function

  2. Make payable Escrow.sol initiateDispute() payable... saves buyer and seller gas when calling function

  3. Make payable Escrow.sol resolveDispute() payable... saves arbiter gas when calling function
    The following opcodes avoided are CALLVALUE(2),DUP1(3),ISZERO(3),PUSH2(3),JUMPI(10),PUSH1(3),DUP1(3),REVERT(0),JUMPDEST(1),POP(2), which costs an average of about 21 gas per call to the function

Tools Used

Manual Analysis

Recommendations

It is recommended the suggested functions are made payable; to save gas for the caller who has the right privileges to call the function

Support

FAQs

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