code-423n4 / 2021-09-defiprotocol-findings

1 stars 0 forks source link

settleAuction should be external and arguments should use calldata #108

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

t11s

Vulnerability details

Impact

Gas is wasted making settleAuction public, and using memory Instead of calldata for its arguments.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/52b74824c42acbcd64248f68c40128fe3a82caf6/contracts/contracts/Auction.sol#L69

GalloDaSballo commented 2 years ago

Agree with the finding, would appreciate the explanation as to why that's the case.

From my understanding, a public function will copy it's values from callData to memory, already declaring those array to memory drastically increases the cost of using them