Talk: Liveness in L2 Protocols
Secureum Talks · 21:02
A speaker from the Arbitrum team explains what trustless liveness means for layer 2 protocols: anyone being able to force a valid transaction to execute and settle on Ethereum, at reasonable cost, whatever the sequencer does. The talk walks through how a modern rollup works, from the sequencer feed and batch posting to the state transition function, and how users can force inclusion through a layer 1 queue. A Q&A covers what exiting funds looks like for an ordinary user.
Topics
From Secureum Talks; community: Secureum.
Transcript
[Music] okay um i would like to talk about liveness in l2 protocols and i'll spend most of my time talking about that but i do have to talk about my own system for a minute so my ethereum layer two system is more secure than others because my system uses a more advanced form of cryptography that's not susceptible to quantum it employs novel consensus mechanism mechanism more resistant to forks and
double spending and it has a higher degree of decentralization which makes it more resistant to 51 attacks but actually this slide was written by gpt-3 i gave the ai the prompt up at the top and asked it to complete and this is the completion it gave me including the bullet points it somehow knew that i was asking for a powerpoint slide so uh this proves that security shilling can in fact be automated the other interesting thing about this is that according to the makers of gpt-3 they have only trained on on data up to 2019 so this is apparently state of the art shilling as of 2019. we'll see what it does when it gets 2022 data
okay having done that i do want to have one uh one actual security shilling slide before i get on to the uh the more technical topic um about sort of how we think about security in arbitrary arbitrary was designed for security from the beginning the first part that we designed and built was the fraud proof mechanism and everything is really built around the idea of security being security researchers all three of the founders are security researchers we're very much mindful of the truism in security that is difficult to build a working system and then graft security on later so we thought about security sort of from the beginning our fraud proofs and all of our security have been
not only working but fully integrated with the system since 2018 we've never released a system without fully working security mechanisms and that's something that and will never do and will never do otherwise to be a little bit precise about the guarantee that the arbitram protocol gives you provided that we've implemented it correctly is that if ethereum provides safety and liveness and if at least one honest party is participating in our l2 protocol then the arbitram protocol guarantees both safety and liveness at l2 including for transfers to and from the l1 so you can always force and exit yourself according to the protocol design
okay with that said i want to talk to the i want to switch to the more generic topic that i'll spend most of my time talking about which is trustless liveness this is a really important property of l2 protocols people tend to focus a lot on the safety guarantees that these protocols give which are of course really important right safety meaning that the protocol never accepts an invalid transaction never produces an incorrect result but liveness is important as well that the protocol is guaranteed to make progress regardless of what anyone other than you does so when i say trustless loudness what i mean is anyone can force the chain to execute any valid transaction
and settle that transaction back to the l1 in practice not just in theory but actually in practice it's a thing that an ordinary person can do and that they can do it reasonable cost if the cost is unreasonable if you need a special purpose super computer you need to buy something new spend a huge number of cpu cycles even if you can hire it from aws or something like that that's a real impediment in practice so when i say trustless liveness i mean this you can force force the chain to execute any valid transactions settle it to l1 and that's the thing you can really practically do in in with a reasonable degree of difficulty and cost right and this is often talked about less but it's an equally important part
of this protocol of these protocols and this is sometimes discussed as an exit problem the idea that if you have a fund fund say if you have eth on an l2 chain that you can get those eth back to l2 but it's really important that you can force execution of any valid transaction because your assets might be locked up inside of some other vehicle they might be held in an account inside some dap and you need to be able to do everything you can to actually extract your funds if you want to get out so it's important that it's not just exit of sort of funds held at top level but it's any valid transaction okay so in order to illustrate some of the issues that come up here i want to talk
a little bit about how arbitrarum works although what i describe here would apply to most l2s i think everything i say about this would apply to optimism as it's being built and presumably to zk systems as well as they get built out all right so um let me walk through this step by step this is basically the design of a modern rollup so you have um on the upper left you have like uh you have the sequencer this might be a single centralized um might be a single centralized machine or it might be a distributed system operating in some sort of k out of end
trust guarantee or something like that its job is to receive transactions submitted by users either sent directly as a transaction signed by an eoa or perhaps posted on the l1 chain by someone it takes those and it puts them into order that's the sequence to transactions up on the upper right the sequence transactions then feed into a state transition function which is a deterministic function depending only on the sequence of transactions and on the state over on the side so when the chain starts this state is initialized to something according to the genesis state of that chain and then the state transition function takes the next transaction and the current state produces some outp up updates to the state and perhaps emits
an l2 block but importantly the state transition function is deterministic and depends only on those inputs in order to be deterministic that means it can't peak at the state of the l1 chain or ask what time it is or anything like that it can only use information that is encoded into those transactions plus any tags that the sequencer has put on them and by the way we don't we don't want to trust the sequencer for anything other than ordering we don't want to trust it to be truthful about anything else that we can't check anyway the state transition function executes that way now um the sequencer has to tell people what its sequence is and it has to commit the sequence and it will do that in two stages the first thing it does is it
produces a sequencer feed this is a feed of transactions that anyone could subscribe to and it so if your transaction is put into the sequence in a fraction of a second your transaction will be pushed out on the sequencer feed and the sequencer feed is a soft guarantee of transaction ordering that is the sequencer has the that is the sequencer's promise that your transaction will be at that point in the sequence um the sequencer has the power to keep that promise but the sequencer might be dishonest if you trust the sequencer's promise then you already know the transaction sequence you can execute the state transition function for yourself because it's fully deterministic and then you know with that soft guarantee what the
result of every transaction is in a fraction of a second if you want a hard guarantee then you have to wait for the sequencer to post the sequence onto the l1 chain so every few minutes the sequencer will take a contiguous batch of transactions the next ones in the sequence that haven't been posted yet takes them as a batch compresses them for efficiency and then posts them onto the l1 chain and as soon as that post to the l1 chain has l1 finality now the sequence of that part of the sequence of transactions is fully final and because the state transition function is fully deterministic these the outcome of the transactions is final at that point every honest party in the world knows the result
except the l1 ethereum chain doesn't why doesn't it well it can't do what you can do which is to compute the state transition function on every transaction ethereum doesn't have the computational throughput to do that that's why we have an l2 in the first place so ethereum doesn't know and so therefore you need some other proof protocol to settle those l2 blocks to the l1 chain and get them fully confirmed and notarized and there you have an optimistic roll-up protocol a zk roll-up protocol or whatever we use optimistic but for our purposes it just matters that you have a sound protocol for doing this so this is the basic um this is the basic um operation that all of these systems have now if you want to give a liveness guarantee of trustless
liveness let me talk about a few things that you need to do one thing that you need to do right is that you need to be able to force your transaction into the sequence the sequencer might be hostile it might refuse to put your transaction into the sequence and so there needs to be some backup mechanism by which you can force your transaction into the sequence no matter any what what anyone else does and so what we do in arbitram and what optimism also does something like this is basically if you have an eoa signed transaction the sequencer seems to be refusing to sequence it or you just don't trust the sequencer you can post that onto the l1 chain it goes into a queue that is managed by the l1 chain
now the sequencer if it's well behaved will take the items from that queue and merge them into its sequence soon typically after about 10 minutes because it might it's afraid that your right to the l1 chain might get re-orgged away but once it's confident that your uh that your transaction's been in the queue for more than a reorg interval it will be happy to include your transaction into its sequence if it's honest if it's dishonest after some time interval delta t has passed then you can do another l1 transaction that forces your uh your queued transaction into the sequence whether the sequencer likes it or not that will only happen if the sequencer is either malicious or is down for a long time so but you need to be able to force your
transaction into the sequence even if there is a sequencer and these chains typically have sequencers because the one second soft guarantee is a huge user experience advantage that everyone seems to want okay another thing you need to be able to guarantee is that you're able to settle your transaction to l1 right so if you can force your transaction into the sequence then every honest node will see your transaction in the sequence it will be recorded on the l1 chain if the sequencer refuses to put it into one of the compressed batches it'll be in a special batch that you did with that force inclusion operation but everyone will see it every honest node will see your your transaction and be able to execute it
and so every honest party will know your transaction happened and what its result was but you need to be able to settle it back to the l1 because the l1 is the official final archival state of the system and it's also the one that is used for bridging assets off of the l2 chain so you need to be able to force any party needs to be able to force the settlement of valid transactions onto the l1 chain and by the way if there's a set of transactions ahead of yours in the sequence you need to be able to force them on chain two because they will be settled in order okay right also everyone needs to be able to execute the state transition function that means that you need to be able to know the state and so if you're
a node who came along late you need to be able to find out what the current state is in an optimistic roll-up because all of the inputs because the genesis state is known and all of the inputs are recorded on the l1 chain everyone can just play along from the beginning if they want to and so you need to be able to get the state that all needs to be possible okay challenges for optimistic rollups for getting a transaction sequenced you have the slow path for inclusion i talked about that getting the state well you can compute the state yourself if need be because all of the inputs to the state are recorded on the l1 chain or if someone gives you the current state you can verify that against the hash that's recorded in the on the l1 chain
computing the state transition function well you can compute that yourself it needs to be there needs to be some sort of gas limit system to make sure that you can actually do that on a reasonable node for settling to l1 you need it needs to be the case first that anyone can propose a settlement transaction and then the remaining issue is delay attacks this is a situation in an optimistic protocol where remember in an optimistic protocol someone posts a claim about what the correct outcome is someone else can dispute that and then there's a challenge protocol that goes on to figure out who's right or wrong and the person who's wrong will get slashed and then you'll somehow go on but you need to be careful so it's not the case that a liar who is willing to
lose a stake who's willing to lose stakes can cause a delay so for example it can't be the case that the loser after getting slashed can show up in with a different from a different address and make another claim cause another delay and burn another stake now it's true for example the original academic paper version of arbitrary had this issue that a party who was willing to burn an unlimited number of stakes could cause an unlimited delay but in a production protocol that's not acceptable the protocol design needs to be able to establish and prove some kind of maximum on the delay that can be caused and that maximum needs to be reasonable it can't be like eight years right and that needs to be the case no
matter what byzantine behavior people engage in and no matter how much stake a malicious adversaries are willing to burn this is not an easy property to have unless you're very careful about how the protocol is designed for zk roll ups you have a different set of challenges how do you get your transaction sequenced well that'll probably work similarly to optimistic systems there probably needs to be some sort of mechanism on the l1 chain to demand inclusion and then if you don't get it to force inclusion i'm assuming that that's going to work in the same way because it's hard to think of an alternative how you get the state well it's easy to get the state if all of the inputs to the state are posted on chain but many zk systems talk about
what they call compression which really consists of not putting in many cases of not putting all of the inputs to the state transition function on the l1 chain if they just provide a proof that there they know a set of inputs that would produce the current state in through valid execution that's not enough for you to find out the state and if you don't know the current state then you can't generate a proof that your transaction of what the result of your transaction is and you can't force inclusion so there needs to be some guarantee of data availability in a zk system so it's not trustless if only the prover or the sequencer knows the full state computing the state transition function
similar everyone can do that themselves and settling to l1 the main issue here for zk systems is cost and practicality can you really compute a zk proof not only of your one transaction but of all the ones that are queued in front of it in the sequence is that something you can really do with equipment that you have or that you can hire at a cost that you can that a regular person can afford um on some external service if you need to hire a million gpus from amazon then you can't really practically do it so this is the main question cost and practicality can you really do it using stuff that you have we don't in my view we don't really know enough about the zk roll up systems to answer that question i think this is an excellent question to
ask them about what their plans are for this and what they're going to assume and um but i think we're going to have to learn about this as we go forward okay i am out of time i see i see i'm out of time i'm happy to talk more about these problems and how you can address them in different systems i think liveness is an underappreciated aspect of security for these systems but it is crucial because an attack that can keep you from executing valid transactions keep you from reclaiming your assets if someone tries to stop you from doing that is a serious attack and in many scenarios it's virtually as bad as one that just openly steals your funds so i look forward to talking more with folks about this and to engaging with other protocols about this issue going
forward thanks questions thank you so much any questions yes corey you mentioned in the beginning of the talk um it's safe assuming you had the implementation correct yes how do you gain confidence that that's so it's a few things one is the code being open and available to everyone to kick the tires on number two is the work that we do internally in due diligence in testing and fuzzing and everything and the third one is security audits right external security audits are key for
for this stuff um and we do all of those things um uh and and of course also it's important to have a bug bounty program so that when if someone does discover a critical issue that they can um they can come to us and that it can be resolved in an effective way um i mean it's all the things you need in any system really and you know we work to do these things other teams work to do these things as well thanks thank you so we do have time for uh one more question someone to the left of the aisle yeah uh thank you so uh i just had more uh one question that kind of dived a little bit more into like the ux of doing an
exit for a normal user so assuming the sequencer and any other party that you're relying on is trust worthy what does that actually look like in practice to you or at least where you think it's going like yep the example i see is like for example strike and lightning is kind of the thing in bitcoin but you're kind of relying if you don't know what strike is it's like but they're relying on you're trusting someone else to run a lightning node they have the data yeah how would you avoid that in a rollup situation so right so this here's how this works assuming that the sequencer is working assuming that there is a working node that you trust to do it or that you're willing to run a node yourself right that's necessary um so there are a few cases one case is where you hold eth in
your l2 account and in that case there is a precompile you can call to withdraw your eth to l1 you just call that precompile your eth will get put into a sort of output queue which is certified by the l2 chain and then there is an outbox contract on the l1 and so you do that pre-compile in l1 that that sends the withdrawal certified withdrawal event back to the l1 contract in in some sort inside of some sort of inside of merkel structure and then there's some tooling you can use on the l1 after the challenge period is passed um you'll send a transaction to that outbox to claim your funds and there's tooling that automates that that's eth if you have a token then um you call the token contract
and there's a token bridge it's a similar system but there's a token bridge there's a token bridge contract on l2 that you can use and it will send a certified cross chain message down to a buddy contract down in l1 which will release the funds to you after the challenge period has occurred gotcha so for each of these it's probably going to be there's going to be tooling to help people along yeah there's tooling so i we have our arbitrary bridge tooling which is a web-based um user interface that people can use to do these things um there are other tools that other people have built um yeah i mean the mechanics of it the sort of on-chain on l1 on l2 chain is calls calls to certain contracts or pre-compiles to say that it happens and and there's ui around that thank you
yeah one more piece of that is of course if your funds are in some dap and then you need to do you know whatever that dap needs to get them back into your account um into your account but you know that's the same as on l1 thanks [Music]
Related talks
- Introducción a Arbitrum y la Escalabilidad de Ethereum
- The Rise of Ethereum Rollups: Scaling through Arbitrum
- SotN #48 - Arbitrum LAUNCH, w/ Arbitrum Team
- Ethereum Just Leveled Up | Arbitrum's Steven Goldfeder & Harry Kalodner (SotN 9/7)
- Offchain Labs Building the ETH Ecosystem
- The Future of Layer 2: Research, Development, and Next-Gen Technologies by Ed Felten | Devcon SEA
- The Semantics of Rollup Finality
- Optimistic Rollup
- Arbitrum Tooling and Technology - LORENZO DEVREL @ ARBITRUM FOUNDATION
