One computer decides the order
Most rollups have a single sequencer that decides which transfers go in each batch, and in what order. That makes them fast.
It also raises a fair question: what if the sequencer ignores you, or stops? Today you see what it can and cannot do, and how long leaving takes.
By the end of this lesson
Note
I can work out the earliest slot a withdrawal can leave a rollup.
Key words
| Word | What it means |
|---|---|
| Censorship | a sequencer leaving out somebody's transfers |
| Inbox | a list on the main chain where users post transfers themselves |
| Forced inclusion | a rule that a transfer in the inbox must enter a batch in time |
| Withdrawal | moving funds from the rollup back to the main chain |
| Upgrade key | the power to change the rollup's contract |
The cells students fill in are left blank in this preview.
A sequencer can delay but not steal
Every batch must follow the rollup's rules, and a wrong root is caught by a fraud proof or refused for want of a valid proof. So a sequencer cannot take funds or invent balances.
What it can do is choose the order and leave transfers out. If it ignores you, you post your transfer in the main chain's inbox. After a delay, it must be in the next batch, or anybody may post that batch.
Find the lab's three time limits
docker exec jupyter grep -n "SLOTS =" l1.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Work out when a withdrawal can leave
docker exec jupyter python3 steps/withdraw.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Worked example: what the lab printed
| Case | In a batch at slot | Earliest exit at slot | Days after asking |
|---|---|---|---|
| Optimistic, not censored | 2400 | 52800 | 7.1 |
| Validity, proof after 600 slots | 2400 | 3000 | 0.1 |
| Optimistic, censored and forced in | 9200 | 59600 | 8.0 |
The cells students fill in are left blank in this preview.
Try it: a shorter window
SLOT_SECONDS = 12
def days(slots):
return round(slots * SLOT_SECONDS / 86400, 1)
asked = 5000
included = 5300
for window in (50400, 21600):
out = included + window
print("window", window, "slots: exit at slot", out, "which is", days(out - asked), "days after asking")
# Make included 12000, as if the sequencer waited. What changes?
Leaving waits for the batch to be final
A withdrawal is a transfer to the main chain. It is paid out only once the batch that holds it is final. That is after the window in an optimistic rollup, and after the proof in a validity rollup.
A shorter window means faster exits but less time to catch a wrong batch. That trade-off is why windows are measured in days.
A common mistake
Warning
Many people think the sequencer is the part of a rollup you must trust most. It can only delay you. Whoever holds the upgrade key can change the contract itself, so ask who holds it and how long a change must wait.