On V4, the skill ceiling for finding exchange routes is notably higher than on V3. Aggregators and seekers need to find increasingly complex exchange routes within large-scale expanded pools while also considering the uncertainty of hooks. Encryption researcher pote.eth tweeted about exploring methods to optimize exchange routes for aggregators and the challenges that exist with this method on V4.
How can an aggregator optimize the exchange route between tokens A and B? 1) Calculate a large number of potential exchange routes from A to B; 2) Simulate on-chain exchange scenarios for each route and AMM; 3) Choose the best route while considering gas costs. This method does not require indexing the state below the chain, nor does it require re-implementing each AMM in backend language, and it ensures that the currently deployed contract version is being referenced. However, there are some challenges in V4.
First, hooks make simulating exchanges more difficult. They can read the state from any contract and execute different logic based on that state. This means there may be more variables in the exchange, and the state during simulation may be very different from the state during execution. There may be “Salmonella” hooks that look profitable during simulation, but are malicious during execution.
- The five major Layer 2 evolution paths: Why they are all heading towards the super chain and L3
- LSDFi – Financial Derivatives of Liquidity Collateralization
- Explaining BIP 158 Compact Block Filters
The second challenge is that hooks will greatly increase the number of pools on Uniswap, thus greatly increasing the search space. In V3, there are only four WETH/USDC pools, one for each fee level. But in V4, there may be hundreds of pools between any two tokens, each with unique hooks, different gas costs, and execution side effects. In addition, V4’s singleton design will lower the cost of creating pools and executing multi-pool exchanges. Therefore, not only will there be more pools, but the optimal exchange route will also be more complex.
Reference: https://twitter.com/willpote/status/1674185783157071873
Like what you're reading? Subscribe to our top stories.
We will continue to update Gambling Chain; if you have any questions or suggestions, please contact us!