Hyper Fragmented Liquidity, Fully Adversarial Mempool, Wat Do?

ETHCC 6 · July 2023 · 13:39

Xin Wan examines how customizable Uniswap v4 pools could increase liquidity fragmentation and complicate trade routing. The speaker considers the additional challenge of sophisticated mempool actors competing to extract value.

Speakers

Topics

From ETHCC 6, hosted by Ethereum France.

Transcript

foreign thanks for coming my name is shin and I'm a researcher at uniswap Labs today my talk topic is hyper fragmented liquidity adversarial menpool what do and to be honest to all of you these problems are not new problems I'm just kind of driving home the issue and hopefully by the end you guys can have a sense of the possible solutions so uh oops how do I okay so the first problem that I want to

talk about is this liquidity fragmentation problem so at first when uniswap launched and there's some other dexes there's maybe a few pools and it's very easy you check the pool State the liquidity and you route through it there's not much to do but then unit swap pools has grown exponentially in size I think last time we checked I have a I have a separate graph but there's about 200 000 pools in unit swap alone and so to search through that space is already pretty hard and I I think searching is a very hard Problem by itself and then you have all the forks and not

Forks but other decentralized exchanges and finally there's even a harder problem of routing through both D5 and C5 liquidity and it's just infeasible to do if you're going to find them one by one so this is one fact that I want to want to show so here is the cumulative number of pools just in the universe protocol and as you can see it's it's right now hovering around maybe 200 and 30 000.

and that's uniswap alone adding to the problem I've recently spoken to someone who is working on a sort of crypto data startup and the quote I got from from that person is there's only you know 70 000 Forks of uniswap um and that's you know by the end of 2021 so I don't know if you want to do multiply but at least you can do addition um so that gave us somewhere around three to five hundred thousand pools that you potentially need to route through if you really want to find the optimal on chain routing for any trade

um so so now you have this so let's say you're aspiring you know uh routing engine provider or um or someone just want to find the best trades then you either have to integrate millions of venues pretty soon and still missing a lot while all these new ones are launching and remember that the the integration steps is pretty manual like uh integrating unisoft Forks is relatively easy but as soon as they add any change it's kind of manual and you have to find them in the first place uh the second thing is uh the second option is you just say hey let me um not

do that but then you're not going to get the best execution out there because you know there's liquidity that that's that's not being utilized uh now we um we just launched units about V4 um a while ago and there is one fact that I want to put to people's attention which is um new pool deployment you know so V4 is really cheap how cheap uh it's basically as cheap as V4 on the order of uh five dollars per pool comparing comparing that to a V3 pool uh uh that will give you about a 99

reduction in full in full creation price and just one thing to remind everyone is you know when the price is low demand is usually high so if you compare the number of V2 pools here in in green to the number of V3 pools you can clearly see that you know demand curve Trends down so uh uh with unicewalk V4 pools as cheap as V2 pools we can kind of you know extrapolate what this graph will look like uh in a couple of years time

and one more thing is not only do you have a ton of pools coming your way that you might want to consider integrating each pool will have its own hook right and a V4 Hook is essentially just a smart contract that can execute more or less arbitrary logic within the pool subject to some checks that we're implementing um which is great for the entire sort of Dex design space because you can Implement all these new features but it will be a nightmare for anyone who is trying to Route because now for each pool you sort of have this custom logic

that you have to implement and consider when you're when you're comparing different routes so what do we do it is unclear uh okay so uh before I go to the solution I want to talk about the second problem again for swappers uh as the chain and the mempool is getting more and more hostile or adversarial um basically from the point when you decide to do a trade meaning you sign some transaction to the point where a transaction is confirmed there's this whole journey

where you think you're just sending a transaction but there's like you know 10 000 different automated bot uh watching your way right and if you make one misstep you kind of screw it over immediately guaranteed uh uh so yeah that's your padding transaction that's a Meb Searcher right there um and uh this this is a cool Lemma that I just made up today but uh you can't have two things at the same time right you can't have both a fully permissionless system meaning anyone can come to to the game and play according to the rules but

then do whatever they want according to the rules and at the same time have money left on the table right so anything that sort of um that you decide to do in a sub-optimal way will turn out to be sub-optimal right you can't just wave your hand and say hey like let me pray that my transaction actually lands on chain in the expected fashion uh as long as you allow some slippage you allow something to go around a little bit it will go along it will go wrong that much right exactly how much you allow it to go and we clearly don't want to sacrifice the permissionless nature of the blockchain so um are we just going to you know we can't get it but then

you'll have bad access coming what do we do so again here's some facts that I want to show so these are estimated not accurate it's just like some backup envelope math but estimated profit earned by sandwiches just on ethereum and that's daily number so on a daily basis that's around maybe thirty thousand dollars um and half of half of it is from this Jared guy from Subway but uh but you know it's it's substantial and it's sub-optimal because swappers while they're trying to Simply

swap are kind of losing money um almost every single time to to sandwich attacks and leaving money on the table um and these spots are really doing kind of really complicated things so uh this is just one uh top of block Arbitrage transaction that I'm showing and it's one transaction right they're sort of just like scraping all the pools that are in imbalance versus versus maybe an off-chain liquidity venue um and it's not something that you would um you would see normal people do um but but these spots are getting

increasingly sophisticated on a daily basis and furthermore there's some recent results by a group of researchers Miriam pranav and Tim on sort of the the um the effect of Mev on the kind of possible design result of transaction fee mechanisms and they're basically saying you know I'm not going to State the the whole uh kind of thing they proved but they're saying Mev are bad for consensus stability in addition uh to swapper execution quality

again uh what do we do there and sorry this talk might be a little bit too short here but I'm just going to quickly show some conventional wisdom so the the first possible solution uh is you have this really hard working aggregator and he's just diligently integrating every liquidity source as they come Unchained uh you know but again you face this dilemma of like do you have every liquidity integrated or should I um wait a bit until I swap

and the second thing is uh you can spin up you trust yourself you spin up this really beefy machine you have really complex math um but to my observation you know the the media and swapper are not these type of audience right and it's just impractical impractical to expect people to to be able to do this themselves um while you hope for you know Mass adoption at the same time uh the third thing that's kind of a trendy uh topic right now is the concept of ofas or order flow auctions and it's more of more or less of a

market oriented approach um and you have a few implementations in production already there's map share from flashbots Mev blocker by a group of people and I think a lot of the relayer operators also have their own sort of OFA service but the the exact benefit of those is still being kind of hotly debated on Twitter right you just Google or search on Twitter OFA and you will see oftentimes very contradicting opinions at the same time or even contradicting kind of facts

and in case this is not clear right these are commercial opportunities we have always tried to encourage people to build on V4 build on routing solutions for V4 and you know to the extent that you have your own proposal to solve them we would love to see and love to talk to you but uh one thing I would like to mention is no the the two problems are sort of related right [Music] um and sorry that's the end of the talk uh Hayden Hayden will continue this talk at 5 PM I'm going to leave it as is uh and yeah thank you for coming and

[Applause] [Music] [Music] foreign [Music]