Why calldata gas cost reduction is crucial for rollups

Polynya
8 min readNov 24, 2021

--

We will be discussing the draft EIP to decrease calldata gas costs: Call data gas cost reduction with total calldata limit — HackMD. I’m not going to dive into technical and implementation details, but I’ll definitely dive into what this means for rollups and the end users. Please note that everything here is purely my personal opinion on the matter.

First, a brief recap of rollups. They execute transactions, generate proofs, and compress transaction data to commit to Ethereum. For all rollups running at scale, the compressed transaction data component becomes the dominant gas cost as the primary bottleneck. (Addendum: the definition of “at scale” varies by the nature of rollup and their respective fixed batch costs. More on this later.) This is what is committed to Ethereum as calldata, and as a result, reducing cost of calldata has a dramatic impact on the end users’ transaction fees on rollups.

Tl;dr: this EIP will reduce transaction fees on rollups by ~5x, while the limit will ensure that it remains safe. Given how transaction fees & blockchain demand work, I believe the net impact will be far greater than 5x.

There’s been a lot of talk about reducing calldata this week. Louis from StarkWare has a great thread about it, responding to a prompt from @PhABCD. I had briefly covered the cost implications, but will dive into it more here.

Over the last year or so, we have seen exponential demand for Ethereum smart contract transactions, whether it be DeFi, NFT or memecoins, which has led to skyrocketing gas prices. Unfortunately, because rollups must compete with these use cases, there’s been unnecessary contention, leading to calldata being overpriced in absolute terms. This draft EIP effectively subsidizes rollups so they can make better use of Ethereum blockspace. With significantly lower costs on rollups, this will also reduce the cost of DeFi, NFT, memecoins and other smart contracts on rollups, hopefully incentivizing more people & developers to migrate from Ethereum mainnet to rollups. This will, in turn, lead to reducing demand and gas prices on mainnet, which in turn will further decrease transaction fees on rollups. Hopefully, this will kickstart a positive feedback cycle and incentivize transition to rollup-centric usage of Ethereum.

The question then becomes — but this will surely lead to a bloated chain, right? This is where the cap on the max calldata there can be per block comes in. Today, the average target for calldata is 937,500 bytes, assuming the entirety of Ethereum is calldata and nothing else. With this EIP, the max calldata is capped at 1,048,576 bytes. So, really, when we consider worst-case scenarios, nothing much changes from now. What will happen is the ratio between calldata and other transactions will increase, thus leading to larger blocks. But as covered, this is still within bounds, and history expiry as proposed by EIP-4444 will mitigate this in the future. I’m oversimplifying, of course, please read the EIP for more details.

The other concern to be addressed is — will it delay The Merge? The early feedback I’ve seen is that this is a relatively simple change, not much more complex than Arrow Glacier’s bomb defusal so it should not impact The Merge’s timeline — which is getting close to spec freeze — by more than a week or two. Of course, there’ll be a lot of discussion about this in the upcoming Ethereum Core Devs call, and we’ll see clarity around timelines emerge then. But generally, it’s possible we can have this EIP rolled out as early as Q1 2022, before The Merge. The other possibilities are with The Merge itself, or the fork after The Merge. But given the urgency of the situation, we should try to make the pre-Merge fork happen. Personally, I’d argue that reducing transaction fees on rollups by 5x actually has a much greater impact in the short term, so any small delays in The Merge will be well worth it. What do you think?

How much will transaction fees on rollups reduce? Tl;dr: by 5x or so, but this is a complex topic. If you want to get into the weeds, read on, otherwise feel free to skip this section.

Fees on rollups have three components broadly: fees by the rollups, batch/verification fees, and transaction data (as calldata). Only the calldata will be affected, but as mentioned above, for a rollup running at scale, this will be 99% of the fees. But, of course, rollups are not yet running at scale, so let’s look at a few examples.

The last Uniswap V3 trade on Optimistic Ethereum had a total transaction fee of $2.95 (I’m using OE as their recent EVM-equivalence upgrade makes comparisons easier). The L2 component is relatively negligible. While they don’t break it down, I’ll assume the L1 gas is largely calldata at 6,290 gas (this is not strictly accurate, but for illustrative purposes in this post, I’ll make the assumption). At the time of this transaction, this amounted to $1.95. As an early rollup, they have a buffer, where each transaction is charged 1.5x to mitigate gas price volatility etc. I believe this is far too high, and will reduce down to close to 1x over time as rollups scale up and mature. Given that, after this EIP, the cost for a transaction fee could potentially reduce to only $0.36.

Now, of course, that’s a naïve illustration. In reality, the matter is far more complex. For example, if we see more developers & users move from Ethereum to Optimistic Ethereum to benefit from this massive reduction in costs (from $50 swaps to $0.5!) we could see gas prices reduce on Ethereum, which could ignite a positive feedback loop as discussed above. On the other hand, at sub-$0.5 there’ll surely be higher demand from outside the Ethereum ecosystem. As long as within the rollup’s limits, this won’t impact the L2 fees. However, the rollups could start bidding up the gas price if they start using a significant amont of calldata, but on the fourth hand, rollups’ batched transactions will be far more efficient than users directly interacting on Ethereum. On the fifth hand, I haven’t even mentioned calldata compression techniques, which ORs like Optimistic Ethereum & Arbitrum One have yet to implement, which could lead to another 10x reduction in costs. So, potentially, with compression, we could have AMM swaps on ORs sub-$0.05! Arbitrum has their first implementations of calldata compression rolling out with Nitro, and the Optimism team is also working on it. Anyway, the point is — there are many dynamics at play! It’s nigh impossible to predict where fees and demand will finally land, but you get the picture — much lower transaction fees on rollups!

Things get a little more complicated when we consider ZK rollups. While optimized ORs have a relatively low batch costs, it’s more expensive to verify the validity proof. Especially for STARKs, this costs ~5 million gas. If we look at the case of dYdX, we’ve seen batches with 13,000 transactions. This leads to a 384 gas cost per transaction. (Note: for the user, dYdX has zero gas fees, as it’s abstracted from the user, but there’s a gas cost that dYdX pays.) Due to ZKRs’ highly efficient compression techniques, and the nature of dYdX making it particularly compressible, the calldata cost is actually only 86 gas. With this EIP, this calldata cost will reduce to 16.1 gas. But overall, the transaction fee will reduce from 470 gas to 400 gas. At the time of writing this post, that would be from $0.15 to $0.125. Not the most dramatic improvement, but here’s where things get interesting. The batch cost is poly-log, so practically fixed. If dYdX’s activity increases 100x, the batch costs will decrease to only 4–5 gas per transaction, in which case the calldata reduction would have a huge impact. If dYdX did do 100x the TPS they are doing today, the total on-chain cost will reduce to only 21 gas, which is $0.007. At this point, the bottleneck becomes prover costs for the ZKR as much as on-chain gas fees! I should also note that PLONK-rollups like zkSync have much lower verification costs, with a fixed batch cost of ~0.5M gas, so they need less ~10x less activity to amortize the batch cost. On the other hand, they do have higher prover costs, and STARKs have other benefits, and as demonstrated above at scale the gas costs become negligible any way. More on this fascinating topic here. Either way, the point is — as ZKRs start ramping up activity, we’re easily looking at $0.0X transaction fees post this EIP.

What about capacity? If we assume that Ethereum is 100% rollup transactions, then the peak capacity for rollups is not going to change much. In line with the max calldata limit as per the EIP, we’re looking at a ~12% increase. So, for optimized, compressed 16 byte transactions, this is 5,000 TPS across rollups. For highly compressive usecases like dYdX, 15,000 TPS. I believe this is a ton of headroom given all blockchain activity combined is less than 1,000 TPS (not counting consensus votes and such).

By the way, I’ll point out that monolithic blockchains are struggling to keep up even with this tiny, tiny level of activity. Rollups & specialized DA layers like data shards are inevitable. Since I wrote that post, Polygon PoS has bumped their gas floor 30x, Solana has occasional instability (usually short-lived, but up to 18 hours downtime), Binance Smart Chain is in meltdown, Avalanche C-chain gas prices tend to skyrocket when blocks are full etc. All of these projects have seen any real activity for only a few months, there’s zero chance they can sustain over decades. The evidence is mounting, at this point I have zero doubts about the rollups, volitions, data shards & DA layers being pervasive throughout the blockchain industry. Sorry, you know I had to mention it!

Anyway, back to rollups. Even if we saturate 5,000 TPS, further, we have StarkNet & zkSync 2.0 releasing volition systems in early 2022 with alternative DA solutions, which are much, much easier to parallelize and scale than stateful blockchains. Not as secure as rollups, to be sure, but still more so than centralized L1s. So, we have plenty of throughput left to exploit. By the way, here’s a nice site to follow along where Ethereum sidechains & rollups activity is at.

The long-term solution remains data sharding, of course. That’ll get us 10,000x scale incrementally over the next 4 years, and speculatively 1 million x over the decade. In the short-term, though, this EIP will be a huge boon that’ll have an outsized impact in bootstrapping adoption for rollups. When data sharding does release, rollups will be ready.

I hope you will all join me in supporting this EIP! If you have any questions & concerns, please do post them here.

PS: how can you support this? Comment below, in as much detail as you’d like! Talk about it on Reddit, Twitter, social media, let as many people as you can know.

Discussion here: Why calldata gas cost reduction is crucial for rollups : ethfinance (reddit.com) & polynya on Twitter: “You may have seen the draft EIP to reduce calldata gas costs. This will lead to an upto ~5x reduction in transaction fees on rollups. For the next few days, I’ll exclusively discuss this on Twitter. https://t.co/a9DnOzTD2u" / Twitter

--

--

Polynya

Rants and musings on blockchain tech. All content here in the public domain, please feel free to share/adapt/republish.