sherlock-audit / 2024-02-leverage-contracts-judging

1 stars 0 forks source link

ptsanev - Address deviation will not work on ZKSync #2

Closed sherlock-admin2 closed 6 months ago

sherlock-admin2 commented 6 months ago

ptsanev

medium

Address deviation will not work on ZKSync

Summary

The functionality used in computePoolAddress uses the exact same calculation method for the pool address, using the tokens and fee, which would not work on ZK.

Vulnerability Detail

Due to different precompilers and bytecodes on ZK, the returned address from the method would be wrong, resulting in the swaps on Uniswapv3 to revert or force overpay. This issue has been addressed in the past, but has remained unchanged by the team, contrary to their intentions in the README to deploy to ZK.

Impact

Medium. Unlikely to happen but would result in short-term DOS and more fees paid by the borrower.

Code Snippet

https://github.com/sherlock-audit/2024-02-leverage-contracts/blob/main/wagmi-leverage/contracts/abstract/ApproveSwapAndPay.sol#L251-L271

Tool used

Manual Review

Recommendation

Consider calling the Uniswap factory getter getPool() to get the address of the pool.

Duplicate of #35