L2 Sequencing

Where are we? Where are we heading?

Terence Tsao
Core Dev @ Offchain Labs


Agenda

  • Why do we sequence?
  • Sequencing vs. execution
  • Sequencer
    • Dos and Donts
    • Decentralized design goals
    • Today's landscape vs. tmw
    • Interaction with MEV

Why do we sequence?

  • Txs can be ordered by the parent chain
    • Not economical
  • Aggregate off-chain, batch, and commit on-chain under a single tx
    • Compression
    • Minimizes user cost
  • At the very least, users can still use parent chain
    • Censorship prevention
    • Worse UX and higher cost

Sequencing vs. execution

  • Separation of concern is a feature, not a bug!
  • Once tx is sequenced, (& posted on parent chain) it's final
  • Why separate?
    • Because they are!
    • Proposer requires the sequence
    • Sequencer doesn't require the state

Sequencing vs. execution


ref


Sequencer main role

  • Receive txs from users
  • Emit ordered and timestamped sequence from users txs
  • Emit soft commit (ms)
  • Emit hard commit (parent chain finalization time)
  • Proposers take sequenced txs and propose L2 blocks

Sequencer cannot do

  • Change the result of the txs
  • Can not censor you forever
  • Invariants:
    • Collect execution fee
    • How much to charge for gas
  • Protocol only trusts sequencer for one thing, and that is order txs

Sequencer Design goals

  • Liveness
  • Minimize the following
    • Tx latency
    • Toxic MEV (front-running)
  • Reduce co-location incentive
  • Resolve latency by bidding
  • Censorship resistance

Sequencer designs

  • Centralized
  • Partial/full decentralized
  • Shared/outsourced

Outsourced designs

  • Your sequencer can be outsourced to another
    • Sequencer
    • L2 chain
    • L1 chain

Break down the problems

Sequencer committee is just a set of computers[1] that implements some ordering policies[2] through some consensus algorithms[3]


Ordering policy

  • First come, first serve
  • MEVA (full block auction)
  • Time boost
    • Continuous time
    • Discrete time

Ordering policy: FCFS

  • Easy to understand
  • Minimize TX latency
  • Minimize Toxic MEV (front-running)
  • Can't resolve race by bidding

Ordering policy: MEVA

  • Anyone can become a sequencer by bidding
  • Highest bid wins to sequence at a future time
  • Rational profit-maxi actor will maximize value
  • Bid should be as close as the value extracted
  • Unknowns: timing & censorship

Ordering policy: Time boost

  • Allow bidder to buy time / bid up time for adjusted timestamp
    \(t_\mathrm{adjusted}(T) = t_\mathrm{arrival}(T) - \frac{gB(T)}{B(T)+c}\)
  • No tx can be held for more than \(g\) time
  • Resolve race by bidding, no front running if sequencer is honest
  • Dist time vs. cont time
    • Under analysis which is more efficient

Ordering policy comparisons

ordering policy latency reduce toxic MEV resolve race by bidding trusting sequencer to not reorder
FCFC ✅✅
MEVA
Time-boost

Sequencer consensus policy

  • Leader auction
  • Random leader election
  • Economic competition
  • Threshold cryptography

Consensus + ordering policy

  • Ordering policy can be applied to any design
  • Committee reaches consensus on ordering
  • Pre-determined safety assumption
  • Tradeoffs between latency & size

Decentralize via committee

  • No longer a single sequencer
  • Committee can be elected by gov
  • Ordering policy is voted through protocol
  • Front run can be detected and slashed out of band
  • Reserved sequencer for liveness
  • Requires manual intervention

Decentralize via BFT

  • Round-based single-leader selection
  • Txs are gossiped through p2p network
  • Better liveness
  • Likely slower
  • Manual intervention is no longer required

Decentralize via committee + threshold decryption

  • Leaderless, anyone can batch post
  • Encrypted tx goes to all parties
  • Parties work together to decrypt a tx
  • Parties reach a consensus on ordering
  • Require automatic broadcast protocol. Non-trivial latency

Comparisons

Consensus Liveness Latency Reduce co-location incentive Censorship resistance Trustless
Centralized ✅✅✅
Committee ✅✅
BFT
Committee + Threshold ✅✅ ✅✅

Shared sequencing

  • Can achieve efficient data packing
  • Cross-domain value extraction
  • Automatic inclusion, not execution!
    • How to achieve cross-rollup composition?
    • Unless it runs every \(STF\)?
  • How to distribute value extraction back to individual rollup?

Finally. What's next❓

  • Sequencer will be decentralized
  • Ordering policy will be adopted
  • Proposals will go through governence vote
  • May the best one win (multiple winners?)

Thank you! Enjoy rest of ethCc!

Find me @terencechain


Select a repo