5

How does the EVM achieve smart contract storage allocation and also be able to isolate each contract's storage so that it's not externally accessible by other contracts?

From a Solidity developer's perspective, it seems like each time I deploy a new contract I get 24KB of maximum storage space reserved for that contract. What if someone keeps deploying new contracts, is contract deployment infinitely scalable? Where does that new allocated storage come from?

2

What if someone keeps deploying new contracts, is contract deployment infinitely scalable? Where does that new allocated storage come from?

It's not infinitely scalable, which is why deploying a new contract is not free. That cost is in theory meant to reflect the resources needed to store that contract indefinitely.

In practice, even at the current high gas prices storing your ~24 kB of bytecode for eternity is probably hugely underpriced and indeed won't scale. Something will need to be done and that something seems to be state expiry. This is a big area of research now. If you want to know more, check out this post: A Theory of Ethereum State Size Management.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.