Sequencers unveiled: Fact vs Fiction in Blockchain Scaling

ETHCC 7 · 10 Jul 2024 · 24:20

Arthur Breitman, co-founder of Tezos, gives an educational talk on rollups and sequencers. He argues rollups are only a scaling technology, compares optimistic and validity rollups, and explains why he thinks optimistic is better for now. He says a sequencer only orders transactions and gives fast confirmation, and that it cannot corrupt rollup state or censor beyond a short delay. The real costs, he says, are MEV capture and monopoly fees, which decentralized sequencers can reduce. He also presents Tezos and Etherlink.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

All right. All right, thanks for waiting a bit. And this is my I I was told this was uh an Ethereum t-shirt, I think. That's the uh that's a color scheme and it's uh exciting technology. So uh uh today I'm gonna talk about sequencers, uh facts and fiction around uh blockchain scaling. What are sequencers? What do we do we want sequencers? Do we do we need them? Uh and we'll go over a little bit uh weather rollups. It's uh this is a talk that's a little bit on the uh um educational side more than anything, but I like uh uh I like talking about this. So that's me.

Uh I'm an early architect uh of the Tezos protocol, because the co-founder of Tezos. My main background is in math, uh like especially uh qualitative math uh and and uh I have a financial background, but I also did uh some work in uh AI and machine learning on uh cell driving car uh a while back and then I fell into uh uh blockchain design, which is also a super interesting topic, and that's what I'm going to be talking about today. Uh so first, what is Tezos? Because I mentioned uh I uh I'm a co-founder here. So Tesos is a blockchain that's designed to evolve.

Um it has a robust technological foundation, um advanced developer tools, a credible scaling roadmap. Uh if you come to Tesdev tomorrow, we can talk about that. Uh a passionate community of builders and users, and sixty sixteen successful decentralized upgrades. So the main thing that Tezos is known for is that that people can go on a chain and vote to uh upgrade it and make it better over time. And recently, over the past couple of years, a lot of the upgrades have been around allowing layer two and rollups to run uh in an enshrined fashion on the uh on the protocol that is as part of the core protocol, we natively support rollups. So we're gonna start with a rollup refresher.

You know, what is a rollup essentially? We'll talk about sequencers, what they are, why you might want to use them, uh, what's the catch? I'll have a quick word about the concept of shared sequencers, and then I'll open up for uh a few quick questions. So uh rollups are scaling technology for blockchains. Some people uh know that, not everyone knows that. There's still a notion that um your rollups do more than just scaling, that they are, oh, you could use a rollup for XYZ. No, they are scaling technology, and if you do not have a scaling problem, you formatly do not really need a rollup. Um so they handle the ordering and the execution of transactions.

Uh transactions can be published on the underlying blockchain or elsewhere. So you publish some transactions somewhere, and the rollups will just decide in what order they should come and execute them. And the the key part of a rollup is that the transactions are not interpreted by the chain validator but by a rollup operator, and that is what makes them interesting. So they are a scaling technology, they are a great scaling technology, they are only a scaling technology. Sometimes you'll hear things like, oh, but if we put our oracle on a rollup, therefore, no. Like there's nothing that you can do with a rollup that you cannot do with a blockchain.

Nothing. Like the only benefit you get is you get scaling, which is fantastic. I'm not saying this is not great, but they're not magical. So why do we build roll-ups? Well, if you look at the um original monolithic designs of um blockchains like Bitcoin, Ethereum or Tezos, the validators essentially have three functions. One is to order transactions. That seems boring, but that's how you prevent double spends. The other one is provide data availability, which is a very confusing word and very confusing concept. But it's best to think of it as proof of publication.

You want to prove that at some point any person who was online and honest had an opportunity to see the data that was being presented. And that's important because otherwise, uh, you know, you might you might not be able to uh to to do to do a double spend, but you might not be able to verify that the double spend hasn't happened. And execute transactions to maintain the state of the ledger. And if you want to scale, uh well, you have to unbundle this function essentially. You have to outsource them.

So outsourcing execution. Um in general, you think of execution as a harder problem, right? It's kind of like, well, you know, ordering transactions, putting data, that's that all sounds very easy. Executing, that's difficult. That's you know, that that's what you're doing. You're securing the chain by executing the transaction, verifying the signatures. But that's actually the easiest part to outsource. Um the uh simple way you outsource execution is you just don't not do not execute transactions. Like there's no real need to execute all these transactions. So you go you could have your full nodes, um, they could only execute a subset of the transactions, maybe the one that have to do with sticking, maybe the one that have to do with being paid some fees, for example, and they ignore everything else. And that's been uh an approach taken by roll-ups like uh MasterCoin or counterparty, which were early uh layer twos of uh of Bitcoin to increase the functionality of Bitcoin.

Now that approach has limits, uh, it's recently been rebranded as uh sovereign uh rollup, which sounds better than orphan rollup, but really the problem is that they are kind of orphaned because they can't safely share their state between these different zones. Um so you can move stuff, you can move state from the L1 to these uh to these roll-ups, they can observe everything that's going on on the layer one chain, but then they can't prove their own state back to the layer one or back to other zones like this. Um so that's very um very limited, and these ledgers are condemned essentially to uh to completely stay apart. So, roll-ups, what's uh what's a real rollup?

Well, the idea is like they can talk to each other by posting cryptographic commitments to their own states. So the main chain then acts as a communication hub between these different rollups. So, okay, but who puts a commitment? Anyone. Anyone can come in and commit to the state of the rollup. And how do you know that the commitment is correct? Well, you have two approaches. You can do it interactively, or you can do it non-interactively. So the optimistic rollup is the interactive version. You play a refutation game.

Um, anyone can make a commitment to the state of the rollup, but you can make a bad commitment, and it can be challenged. So you can place the challenge by bisecting the execution trace. So you know, you'll say, well, it's kind of like debugging a program. You know, you have your program, there's a bug, and you're like, well, up to that point it's good. Okay, do we have a problem before that? Do you have a problem after that? So if you make a bad commitment, someone can say, all right, well, if you think that's the uh outcome of the execution, what was the outcome at the midpoint? What was the outcome before that? Before that, before that. And so in logarithmic time, you um you can come to uh a disagreement, which can be agitated on chain. And so uh importantly, the challenge cannot show that the commitment is correct.

Um, it only allows an honest actor to refute incorrect commitments. And because you can basically one by one remove all the incorrect commitments and slash them, um you uh you get to remove the commitments. And so it's it's oftentimes that the slashing of bad commitments can be about economic incentives that but they or economic security. It's not that, it's really anti-spam. Like you don't want bad commitments to take all your time for refutation, so you just make them pay uh if somehow they wasted your uh they wasted your time. So you remove all the commitments one by one, and the commitment that remain unchallenged after some point just becomes you know your accepted as being correct.

And all you need for that to work is you need one honest party online who's going to be uh posting uh honest commitments for lifeness, defending them, uh, and also attacking bad commitments. The validity rollup is uh same idea, but instead of uh having these games, you are just going to post a cryptographic proof that the commitment is correct. Uh in a way, it's way, way simpler because you don't have all this logic and all these games that you're playing. In another way, it's much more complicated because now you have um to transform your entire execution into cryptographic circuits, and there's a high overhead in uh in uh in in making proofs for those. So pros and cons.

So optimistic roll up, you have no overhead to execution. You can run on your happy path very, very quickly, you can run as fast as the machine runs, and you're only going to slow down when you know someone is foolish enough to try to attack the system. You can use native code directly, so you could um directly use uh any type of assembly you want. Uh whereas for validity rollups, where are you gonna have a thousand X or so overhead for proof generation? And it's gonna come down and it has come down, but it's still very high. And you can parallelize it, but it's still the compute overhead is very high.

You can't really use native code directly, you're gonna have to uh convert to special mathematical forms, and again, you could try to take an assembly and convert that into the mathematical form, but it's going to have quite a bit of overhead if you do that. On the counts of the optimistic rollup, you have a lot of complicated state management and age cases for challenges. Uh whereas for the validity rollup, you're gonna have to deal with the complicated math once. But after that, it's very simple to check that your verifier is correct. For optimistic rollup, you need a single honest party for safety. Uh for validity rollup, you're safe by default, you just need a single honest party just for liveness for things to just move through.

Um optimistic rollup, if you have censorship from the block producers, um you could introduce safety faults because they could the block producers could collude to prevent people from uh putting challenges. Whereas for validity rollup, uh the block producers could uh uh censor only by they they can only um censor by introduce liveness fault. Like they can stop the chain. Uh but uh they can't do um they can't do much more than that. Uh no, sorry, that's not what I meant. So they can they can censor transaction and introduce liveness faults in your uh in your rollup. The uh the flip side also of um of this of the fact that block producers can introduce uh safety fault is that you want long withdrawal period, like several weeks.

And the reason for it is if you detect censorship is going on, you might want to hard fork the blockchain. So your defense against block producer censorship is hard forking. So you have this like week-long type of withdrawal period because it could be censorship, because challenges could be playing out. That's that's a long time to wait for your assets to move from the rollup back to the main chain. Whereas with ZK rollups or validated rollups, sorry, you have near instant withdrawal. And despite all that, I would say that optimistic is better for now. Um, because while the refutation game complexity is very annoying, you only need to get it right once. You know, the fact that it's complicated doesn't mean you can't get it right, it just means it's difficult to do it.

Uh but once you've done it, it's not going to you know magically like get it wrong. The over the overhead of uh of zero knowledge proofs is currently way too high, and it will remain so for the foreseeable future if you want to have a lot of through put. The long withdrawal windows can be addressed. Um, one thing you can do is you can detect that censorship is not happening. Uh and one way to do this, for example, is if you have a proof of stake system, you can look at the slots, and if every slot is being taken by whoever should be making the block, then you know that you don't have block censorship happening. Now you could have maybe 99% of all the block producers participating in censoring a challenge, but that's very unlikely.

So you can get that down from maybe a few weeks to a few hours. And the long withdrawal is also not an issue if everything takes place in a single rollup, and we'll talk a little bit about that. So a single rollup, wait. Isn't the whole point of rollups to you know to scale horizontally that you know you have all these uh different roll-ups and they each have their own validators and now they can share state and they can talk by posting commitments on the L1. That's what we're talking about, right? And whenever you talk about rollups, people always think horizontal scaling. We're gonna have many, many, many rollups in parallel, and they'll each have limited capacity, but they run in parallel, and so they can talk to each other. And the reality is that rollups are actually awesome for vertical scaling.

So vertical scaling is a type of scaling where you just throw more computing resources, more performance in a single ledger. And it, you know, it vertical scaling is easier. You don't have to care about all the composability issues, you're gonna have to carry care about withdrawals, you don't have to take care about a lot of things. The problem is that you might say, well, you know, isn't vertical scaling centralizing? And it's true that vertical scaling is centralizing if you do it with your validators. If you ask your whole validator set to run these very powerful machines uh in order to uh to run a rollup, or you know, even worse, like do the proofs for a uh a validity rollup, that's very, very centralizing. And that's a problem because you need an honest majority uh for your consensus.

However, the majority, the the honesty assumption for uh uh an optimistic rollup is not an honest majority, it's a single honest party. And while an honest majority is hard to achieve, a single honest party is pretty weak assumption. You know, you're making the assumption that there's at least one honest person in the world who cares about this. If if you don't have a single honest person in the world who care about the content, then you know maybe it's not that important. So if that single honest party, you uh also require that they have very high hardware requirements, you don't really threaten, you know, that's not um that doesn't really strengthen security at all. Um, and in a nutshell, that's what a lot of talented engineers working on Tezos have been working on a single vertical scaling rollup on top of Tezos.

And why are we using a rollup? Because it remains, it allows the validators, the block validators to have very low hardware requirements while the chain still offers lots of throughput. And because everything happens in one rollup, you don't have to care about withdrawals. You need some withdrawals so that you can move tests, for example, between the main chain and uh and the rollup, but not a ton of different assets. So that's a design for uh Tezzo 6, which is one rollup with ultra high throughput. Uh support for mainstream programming language.

So that that actually directly comes from high throughput. Because if you want to support a lot of mainstream programming languages uh in your VM, you need to kind of have a low-level VM and run it very efficiently, so that you need to basically be okay with the overhead of compilation. You know, it needs to be the case that you can go through many abstraction layers so that you'll happily, for example, run a JavaScript interpreter or a Python interpreter. And in order to do that without having a massive performance hit, you need to have this type of performance, you need to have optimistic rollups. Um, and it's powered by the Tezzo Smart Rollup engine, which uh is an optimistic rollup uh mechanism that's built in straight into the protocol, and the Tesla's Dell, which is the sharded data availability layer.

So, this being an Ethereum conference. Uh, if you want to understand the Tezos Dell, it's extremely close to uh the Dank sharding proposals, it uses CAD commitments and data valuability sampling uh between the validators and uh people running full nodes. So I said I would talk about sequencers, so I'm getting to that part. What are sequencers? So, sequencers are a technological solution that can complement a rollup. And they're used for the ordering of transaction, and they are a great way to reduce latency. And that's it.

Um they're not necessary. The default for a rollup is to use a base layer. So working on Titles initially, that's what we were doing. There was no sequencers, and everything was supposed to happen on the base layer, you post your transaction on the base layer, and then it just gets uh caught into the rollups. And that's weird to people because initially the concept of rollups was very, very centered on the idea of compression, right? It was very centered on the idea of let's save a lot of data availability. We're going to give all our transactions to a sequencer. The sequencer will aggregate them, will compress them, it won't take as much space and it will be posted onto the chain.

That was like key to the idea. It was about saving data availability space. However, if you don't, if you if you have abandoned data availability, because maybe you have a data ability layer and sharded data availability, then the rollup becomes much more about execution. And if you think about the rollup about execution uh as like something about execution, um it doesn't really uh the compression doesn't become particularly important. So now I know that they've been renamed based uh rollup, and based rollups are uh are are a great idea, and they show that you don't need a sequencer. Sequencers have nothing to do with posting commitments to the rollup states, and that's a confusing part because we have seen a lot of kind of roll up solutions, uh like optimism and like Arbitrum, which have sequencers, and then they overload the sequencer with a ton of functions.

Oh, well, the sequencer is also going to guarantee, you know, the sequencer is also the party that's going to post fraud proofs, or it's only it's the party that's the only party authorized to put commitments. So it's generally uh been acting in a lot of ecosystem as a trusted party. And as a result, people have started building the idea that somehow the sequencer is this very important to trusted party that could be centralized, that could be decentralized, but that you're placing a lot of trust in it. And you don't. Actually, we'll see that the sequencers, if they are doing only their function, can't do all that much. So they have nothing to do with defending on S commitments.

They have nothing to do with challenging this on S1, that could really be everyone if you have a good rollup uh system that can be completely open. And they have nothing to do with uh bridging trustlessly between chains and uh rollup. None of that, all of that are functions of rollups, they have nothing to do with sequencers. And that's important to really disentangle, otherwise, sequencers are gonna get a bad rap. So if they don't do any of these things, why do you want to use them? Uh you want to use them for two reasons. Improve user uh experience by low latency confirmation. Because the sequencer chooses the order of transaction, um, essentially you can give very, very fast confirmation to the user.

It's not going to be a perfect confirmation if you really, really care about a strong confirmation. You can wait until it's posted on a chain, and that will happen uh typically within a few seconds. There's about like 20 seconds, uh, 10 second latency for blocks on Tezos and 20 seconds to finality. So wait a little bit if you want to be super sure. But if you want just the user experience of being through uh uh of using a website and then clicking and then going through action after action, um, you'll get a much, much easier UX flow. The reason being that the dApps connect to a node, the node tells them exactly what is the current state, and that's very that and that's very powerful. So that's what I call access to the speculative state of the rollup.

You maintain a speculative state and say that's how it's going to be, and that makes it 10 times easier to write dApps uh when you have that. So what's the catch? You know, why uh is there a danger to using a sequencer? Well, the first thing is sequencers, if they only sequence, they cannot corrupt the state of the rollup. The state of the rollup is defended by its commitments and the fact that the commitments can be challenged. So they're not going to introduce safety faults. They cannot censor transactions. Why? Because if your sequencer is down or if your sequencer is censoring, you can go back to a base rollup. Now you see this is a roll-up.

Some rollups will say, well, if the sequencer is down for 48 hours, then we'll move into a mode where you can post your transaction on chain and within seven days you can exit or something like that. You don't have to do anything like that. Like honestly, you could have your sequencer, you could have your roll-up take transactions from both the sequencer and the chain. You want to give priority to the sequencer so that you can have the speculative state. But in practice, um you can build a delayed inbox on your L1 and have a delay of like 10 minutes. You know, you could it could be the case that you know post your transaction on the L1, and if it's not picked up by the sequencer within 10 minutes, um, then it has to be executed. So there you go.

Like you can maybe delay transactions by 10 minutes, but you can't really censor them. Now delaying is not nice, you know, it's a form of censorship, but it's not a huge form of censorship if somehow they're just like forcing you to have a little bit of delay. And they also cannot reorganize the rollup because the ordering of the rollup is not determined by the sequencer. The sequencer gets to pick the order, but that order is basically validated and notarized by the L1. So they really do not have that much power at all. So again, what's the catch? Okay, so there's a real catch.

One is that they can collect all the MEV. Uh, if you have a bunch of MEV, your sequencer can um reorder everything and uh extract all that MEV. Um if you have a uh a single party running a sequencer, they could uh impose arbitrarily high fees. Say, well, if you want to be sequenced, you know, gonna have to charge with this much high of a monopoly. And if they misbehave, they can um significantly degrade the UX. Um so they're still interesting because of because of this problem with centralized sequencers, you probably want a decentralized sequencer. And what a decentralized sequencer can do is one, they can do threshold encryption to avoid uh MEV being uh extractable.

Uh if you can't see the transactions, you can't really reorder them to your own profit. Um, they could also use um algorithms that guarantee first in, first out ordering of transactions, or at least an approximation of that. Um if you sense uh if your sequencer is decentralized, you can't uh impose arbitrary high fees. And uh if it's misbehaved, you can slash it and you can replace it. So a decentralized sequencer doesn't have a lot of these uh problems. But uh unfortunately they uh uh uh an argument is that if you have a decentralized sequencer, you have an L1. Why do you need a decentralized sequencer?

Isn't an L1 a decentralized sequencer? And the answer is no, they make different trade-offs. Um the trade-off that they make is because they have so very um little um security issues, uh your decentralized sequencer can afford to have much, much lower latency uh because you don't need to have as many of a set of people running uh the sequencer as you need your L1. And because it faces a different set of trade-offs than the L1, uh it makes sense to separate it. Shared sequencers, they do not do anything interesting. Uh, if you're being told that a shared sequencer for an optimistic roll-up allows bridging, it's actually a custodial bridge because they have to validate each chain. Uh if you're using a shared sequencer for a validity roll ups, then yes, they can do bridging, but you don't really need it.

Like if you're using a bunch of ZK rollups, you do not need a super chain or anything like that. Your ZK rollup just put just post your commitments in your L1 and then you have your transfers. Sorry, I'm I ran out of time, so I'm running quickly. Etherink, um, that's a roll-up that just launched on uh Tezos. It's fully in VM compatible. Uh L2 built on Tezos. It has a decentralized sequencer. It's a single node, but the node is elected, uh, which provides low latency. Uh propose a high throughput, low fees, and we're working on uh MVP protection with threshold encryption. So check it out, uh, fully compatible with uh uh with Ethereum.

And thank you so much for your time.

Related talks