Thread
1/ @VitalikButerin provided some theoretical estimates of what fixed and variable gas costs might be for rollups.
How do theoretical estimates compare to the actual costs?
I checked and got some surprising results ๐
How do theoretical estimates compare to the actual costs?
I checked and got some surprising results ๐
2/ Rollups work by batching transaction data and periodically posting them back to L1.
Their L1 gas costs for this can be broken down into two buckets:
1. Fixed gas cost per batch
2. Variable gas cost per transaction
Their L1 gas costs for this can be broken down into two buckets:
1. Fixed gas cost per batch
2. Variable gas cost per transaction
3/ First I looked at @optimismFND, and arrived at the following cost breakdown on the network today.
- 280k fixed gas per batch
- 3,300 gas per tx
- 280k fixed gas per batch
- 3,300 gas per tx
4/ The fixed batch cost of 280k gas is significantly higher than Vitalik estimated in his article on rollups: vitalik.ca/general/2021/01/05/rollup.html
He estimated only 40K of gas per batch for optimistic rollups.
He estimated only 40K of gas per batch for optimistic rollups.
5/ I got even higher batch costs when I looked at @arbitrum, which were around 375k gas per batch.
This is 10x the cost estimated by Vitalik.
This is 10x the cost estimated by Vitalik.
6/ Significantly lower batch costs are cited as one of the pros of optimistic vs zk rollups. This data suggests it may not be as big an edge as initially thought.
7/ I also looked at @zksync to get a data point from a zk rollup. Here are the results I got for zkSync 1.0.
- 800k gas per batch
- 600 gas per tx
- 800k gas per batch
- 600 gas per tx
8/ The batch costs are in line with what Vitalik estimated (he estimated 500k of gas / batch)
However I was surprised by the variable cost of 600 gas / tx
However I was surprised by the variable cost of 600 gas / tx
9/ ZK rollups should be able to fit tx data into just a few bytes. @0xPolygonHermez notes that they will need only 14 bytes per transaction.
Since each byte of calldata costs 16 gas, this translates into 14x16 = 224 gas per tx.
Since each byte of calldata costs 16 gas, this translates into 14x16 = 224 gas per tx.
10/ I'm curious as to why the zkSync numbers are higher at 600 gas per tx.
One possible explanation is that zkSync 1.0 isn't fully optimized, and zkSync 2.0 will have lower calldata costs.
One possible explanation is that zkSync 1.0 isn't fully optimized, and zkSync 2.0 will have lower calldata costs.
11/ Here is a link to a Dune Analytics dashboard that I created which has these charts:
dune.com/sanjaypshah/optimism-zksync-arbitrum-gas-data
dune.com/sanjaypshah/optimism-zksync-arbitrum-gas-data
12/ Follow me @sanjaypshah for more threads on rollups and modular blockchains.
Retweet the first tweet (linked below) so this can make its way to the right people at @optimismFND, @arbitrum, and @zksync who can hopefully provide additional clarity.
Retweet the first tweet (linked below) so this can make its way to the right people at @optimismFND, @arbitrum, and @zksync who can hopefully provide additional clarity.
Mentions
See All
Vitalik Buterin @VitalikButerin
ยท
Jul 29, 2022
Present-day rollups are still far from optimal! Great thread by @sanjaypshah Still a lot of room to improve both fixed costs and per-transaction costs. Very much early days in terms of how many optimizations that are easy to find theoretically haven't yet actually been deployed.