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

0 stars 0 forks source link

`clearingPrice()` can Cache Function Results #82

Closed code423n4 closed 2 years ago

code423n4 commented 3 years ago

Handle

leastwood

Vulnerability details

Impact

DutchAuction.clearingPrice() and HyperbolicAuction.clearingPrice() can both be improved such that the initial results for tokenPrice() and priceFunction() are cached in memory and used to return the correct output.

Proof of Concept

https://github.com/sushiswap/miso/blob/master/contracts/Auctions/DutchAuction.sol#L227-L234 https://github.com/sushiswap/miso/blob/master/contracts/Auctions/HyperbolicAuction.sol#L218-L224

Tools Used

Manual code review

Recommended Mitigation Steps

Consider caching the results to limit the number SSTORE accesses.

Clearwood commented 2 years ago

Duplicate of #105