Iâm in support of this EIP. It cleans up EVM mechanics in a way that feels worth the downsides that Iâve seen thus far.
FWIW, I donât have any skin in the game here (so to the extent to which anyone is looking at âthese arguments are motivatedâ: Iâm immune).
My goal is only to make it so that my contracts are as gas efficient as possible; to such end, all of my test cases report how much gas they used, so I can attempt to optimize whatever I can. I try try try to not fret tens of gas, but I consider the tradeoffs carefully for hundreds of gas, I consider thousands of gas to be worthy of going to great lengths to avoid, and when I see tens of thousands of gas I will spend a full week figuring out if I can somehow remove it.
The current specificationâthe status quoâthereby has a kind of beauty to it: developers like me are incentivized to minimize storage. If you think I am simply not doing that, you are being needlessly hyperbolic. Meanwhile, users are also likewise incentivized: they are encouraged to delete their accounts and clean up their state, rather than leave it to rot.
The idea thatâas @wjmelements points outâusers are going to get no refund (or even discount) for setting a storage slot to 0 and yet are dinged 15,000 gas for setting it from 0 to not 0 feels really horrible. It is the kind of ridiculous special caseâone that absolutely will change the way I develop contracts, as that 15,000 gas âtransition through 0â penalty will light up my test cases as a very large and annoyingly-avoidable (by using â1 is the new 0â) costâthat should make one pause and realize âwe have incorrectly modeled thisâ.
If one wants to make new rules, those rules need to at least be consistent! Here is thereby another suggestion (which actively leans into the idea of what you want): if the cost for changing a storage slot away from 0 is going to somehow cost money in a way that isnât later consistent with changes back and forth through 0, it sounds like what you actually want to charge for is something like âstorage allocationâ. As such, you should make it only 5000 (not 20000) to re-write to a storage slot that has ever been written to before.
Obviously, this means that nodes essentially no longer get to reallocate anything, as they will need to remember this storage slot for all time⌠but thatâs theirâand this idea of not giving people refundsâfault, and cannot just be avoided by not doing this: doing what you want without this change still does this, because â1 is the new 0â: only an idiot contract developer will ever clear a storage slot to 0 anyway in your model (due to having to pay 15,000 every time it is reset from 0), and so that storage is effectively burned.
What this alternation to your mechanism does, though, is it makes the development process a bit less âdisgustingâ: it internalizes to the platform this really horrible behavior you want to incentivize of avoiding clearing stateâeven if you semantically needed to clear state!!!âso that I donât have to go through my contract and remove every single place where I not only purposefully, but even accidentally, set anything to 0 (which is such a sufficiently obviously âbad for the developerâ incentive that I donât understand how this proposal is getting as far as it seems to have gotten).