Introducing EIP-7907: Increase the contract code size limit with gas metering - Qi Zhou

EthPrague 2025 · May 2025 · 13:19

At EthPrague 2025, Qi Zhou introduces EIP-7907, a candidate for Ethereum's Fusaka upgrade that would raise the contract code size limit from 24KB to 256KB by adding gas metering for larger contracts. The talk explains how the 24KB cap set by EIP-170 guards against denial-of-service attacks but forces developers to split large smart contracts into fragments, hurting usability and maintenance. It details the metering mechanism, why 256KB balances security including peer-to-peer considerations, and how deployers and callers pay in proportion to the resources they consume.

Speakers

Topics

From EthPrague 2025, hosted by ETHPrague.

Transcript

[Music] Um so it should be my colleague T but actually um due to the visa issue he cannot make it so that's why I'm here. Um first I'm the co-founder for quarken and storage and today I'm going to introduce EIP7907 increase the contract code size limit with gas metering. Sounds pretty technical but since I'm not engineer so I'm trying to explain everything in the pure language. So first a little bit about the team and us. Um so as I mentioned before so we jump into the area in 2018.

Before that um I was in Wall Street and also in Silicon Valley for data science and a PM graduate from Johns Hopkins and C which is the founder for um storage and quarkchain. So he got his PhD from Georgia Tech and he's very active um for the Ethereum ecosystem. So he's a co-author for this topic uh 0797 and also you can see the author for a lot of EIPs. Um before um so he's in uh Facebook and Google. Um so we graduate from the same university before. Um and what is a storage? Basically it's a module and decentralized storage layer for the whole Ethereum ecosystem. It can

be a layer two for the layer one. It also can be a layer three for all the other layer 2 and also is specify for programmable key value storage followed by the data availability. um before that so we are actually beginning our journey from quarkchen it's a layer one using state sharding technology because at that time is trying to do the state sharding um and then it pivot into a layer two so working with is storage for a new layer two called super world computer so what we are trying to do here is to function as experimental platform for ether and opt stack as you can see we did a lot of research search

including these uh 09 uh 0797 and also like the solo gas token which I'm going to explain tomorrow um it's also like a op new features so web3 access protocol it's a decentralized HTTP and also leverage e storage as a layer three um so everything is kind of like new features we just want to experiment in the new layer 2 and so others can implement that later and those are all The research areas we have been working on for example in the layer one scaling. So 7907 is one of that and we did the so gas token is how to you know just um you know shorten the way for web two user

into the web 3 um web access protocol some of them may already heard about that so it's a decentralized HTTP hosting everything fully onchain um the data availability so we got grants from the Ethereum foundation also OP stack um we did some parallel EVM and also the advanced fraud proof. Uh we are also the core contributor for the Ethereum portal network. Yeah. So if you are interested in any of the topic later so feel free to contact me or the team. Okay. Let's back to the topic. I'm going to introduce everything from the four section. What's the motivation for doing the 7907?

what's the real you know EIP7907 looks like and how do we implement that and some summary for that um some of you may know or might not know so before that um so there's like a EIP called 170 so before the EIP 170 there is no code limit size so but everyone knows so a resource of calling contract including CPU, storage, whatever. It's inlinear according to the contract size. That means if your contract size is bigger, you definitely will use more resource. But according to the Ethereum design, no matter how big

the contract is, you will always cost the same gas fee that is 2600. So how to understand that? So think about so we are taking a Uber ride. We go to a nearby place, we go to a very far away airport, but the cost is the same. We know that definitely not possible because the Uber driver have to spend more time, have to spend more oil if the distance is further, right? But according to the Eyeran design, it will always charge the constant gas cost. So in that way, it's very easy to cost Adidas. So let's do a rough calculation.

If we want to deploy a contract with size 256 KB, do you know how much the data you will generate in one block? It's about 2.8 gabyte data and that will take about 12 second to reach the consensus because usually we reach the consensus in one second. So the EIP 170 jump out and it introduced the 24 KB limit of the contract size to avoid all those det. So it says okay if the contract size is more than 24 KB you cannot implement that as a result um we can do a rough calculation. So basically the code re

read from the storage it will limit it by the 270 MB much much much smaller than the 2.8 gabyte data before but that also has some issues. So as time goes by there has been more complicated like the app came out. So we know the D5 summer we know the DAX we know a lot of more complicity um you know from the code needed. So basically the contract size becomes bigger and bigger. It definitely more than 24 KB. So basically if you want to deploy something you have to follow EIP 170. You have to break down your big contract size into some sub small

contract size otherwise you cannot deploy that but there have been a lot of you know pain point for the developers. So what is that? So definitely it will increase the maintenance cost and it will introduce very complexibility for the code and even some security concerns. So as you can see um if you want to deploy like a large uh contract code you have to break that into some sub small one and then deploy that. So that's why naturally we want to have a new EIP 7907. So basically two things one we want to remove the limit of 24 KB but

still because of some other constraints um there's there's some up limit so we set a limit of uh 25 uh6 uh KB and as you can see it's I think it's bigger in love for uh the current needs and what's next remember I said according to the Eeran design it will charge constant gas if we charge constant SS Then the ded is avoid it's not avoid right because so if you go to like a longer place you you deploy a bigger contract size the cost is the same. So definitely the structure is wrong. So we want to instead of you know charge

everything the same cost we want to introduce a dynamic gas metering cost. Uh but trying to make everything compel with before. So we had such design if the code size less than 24 KB it will exactly as what we before which is always the same cost as you know 2600 if it's bigger then it has to has some exit gas so how to you know calculate the ask gas so there's a function for that basically the original gas cost is 2600 and And so we will calculate what's the actual gas you have

to pay. So in that way you will definitely pay more if you want to deploy a bigger contract. So EIP um 7907 is already choosing as a candidates for the next uh Fukusa upgrade. So how do we implic uh how do we implic uh mend that this is what we did before. So um during during the old EIP 170 um as you can see so you always pay the same gas so 2600. So we will check whether the code size is less than 24 KB if it's greater than that refuse.

If it's yes okay continue after we have the 7907 so something changed but the reason I put you know the wrong case here is you have to be very cautious so even you said okay so we have a dynamic system you are going to pay more if you deploy a bigger contract size the wrong way is you read the whole codes no before you decide how much you should pay because if you already decided to read the whole code that already introduced the DOS attack. So what's the right way? So always just get the code size before you

read everything. What does that mean? So I still will take Uber as like a example. So when you just had another request to go to the airport instead of okay let's just driving there. So you need to estimate how much it will cost and ask the right ask the customers pay you first and then you begin the right. So that's a right way. So remember always get the code size get the estimate like gas cost before you begin to do everything read the whole account. So that's a right way. Um so definitely there is like more ways of implementation. uh there already been uh a lot of discussion in the

discord channels um for example one is the code and warm day what does that mean so basically the EIP 2929 saying like you don't need to pay you know twice the same gas cost if you visit the same contracts so the first time you pay 2600 and the second time you just need to take 100 gas if it's the same core and you don't you just don't need to repeat everything and we put that into uh you know the EIP7907 as well. So basically that will um helping us to reduce the gas costs as I mentioned before. So right now there has been a live discussion in

the Ethereum R&D discord channel. So if you have interest feel free um you know to join that. there has been a lot of suggestion for how to implement that and what should we do before uh you know the next upgrade and also so um there's a details about the EIP7907 and what's the old because it's based on the EIP 170 and also so we um you know using something from the EIP 2929 so I put everything here as well oh sorry Um so this one we need to give some credits for a lot of people here.

Um and uh yeah so without their help this cannot be done. Um also so she will have another technical talk pretty soon. So if you are interested for any technical details feel free to listen to this talk and also you can you know contact me or him directly and also can just follow us uh for the website. Yeah. So that's pretty much everything. Thank [Applause] you. I think we have uh quite some time for questions.

I know it's very technical, but hopefully there are enough smart people here to be able to ask questions. Yeah, we can talk later as well because I will be here for three days. Thank you guys. [Music]