How much does the storage refund need to decrease before you start using a different value to represent 0?
The London hard fork in July will almost certainly modify the behavior of refunds. There have been several iterations, but the latest is EIP-3529: Reduction in refunds.
I recommend reading the EIP as it is very thorough and explains the past proposals, however the main case we care about for this thread is setting a nonzero storage element to zero and the refund that incurs.
EIP-3529 reduces the storage clearing refund from 15,000 to 4,800. The reasoning is that for gas tokens to work, the refund needs to be greater than the cost of zeroing out the storage element.
Since clearing a storage element costs 4,800 and it refunds 4,800, therefore there is no net-gain to clearing storage, and it can’t be used as a battery for locking up gas during periods of inactivity and deployed during congestion.
Aside - this thread isn’t about gas tokens or the importance of reducing the elasticity of blocks. I recommend reading the EIP, reviewing the last few ACDs, and directing discussions on these topics to ethereum magicians forum.
Before Berlin, it cost 20,000 to initialize a new storage element and 5,000 to modify and existing one. Therefore, it never made *not* to zero out storage elements when zeros occurred naturally, since you’d be refunded 15,000.
After Berlin, it costs 22,100 to initialize a new storage element and it costs 5,000 to modify an existing one. The difference of 17,100 can be considered the refund inflection point at which you’d always clear storage.
With the current refund of 15,000, you would need to be 15,000/17,100 = 87.7% sure that you’ll reuse that slot before you should consider using a nonzero value to represent zero.
After EIP-3529, the refund would be 4,800, so you need to be 4,800/17,100 = 28.1% sure that you will not reuse that slot at a later point. If you think there is a decent chance of reusing the slot, you’re better off using a nonzero value to represent zero.
This then yields the question for developers - would this reduction cause you to change the way you write your contract?
I would guess the answer would be “yes” for many if this was to be the expected behavior long term. So, it’s important to mention though that in the next 1.5-3 years there will be modifications to state trie that will completely remove the concept of cross-tx refunds.
The state trie considers zero and nil as the same thing. When a element is zeroed out, it is dropped from the trie. In the future, there will be a distinction between the two. The reasons and mechanisms are for another thread, but for those curious - check out “regenesis”.
Once zero and nil are each unique values, there will be no advantage to representing zero with a nonzero value. In fact, it will most likely be technical debt confusing users and developers alike.
So to reframe the above question, would the refund reduction cause you to change the way you write contracts, *even if* the advantage will only last for 1.5-3 years?
In the last month, users spent $23,830,482 on ERC-20 approvals. EIP-3074 would reduce that number by at least 30%, saving users millions while freeing up block space (thread).
Anyone whose nonce is greater than ten has likely experienced the approve+transfer flow that defi applications use to interact with ERC-20 tokens. The approve method is a relic of the original ERC-20 design.
There have been many attempts to alleviate the burden of token approvals, but none have succeeded. We believe EIP-3074 will resolve the issue because it addresses the two problems that have beleaguered other approaches.
Ethereum wallets may be getting a significant upgrade soon. With the proposed change, EOAs will immediately be able to send batch txs, expiring txs, unordered txs, and more. (thread)
My colleagues, @_SamWilsn_ and @adietrichs, and I have been working on improving the UX of interacting with Ethereum. After many iterations, we've come up with EIP-3074: AUTH and AUTHCALL opcodes.
To use these opcodes, an EOA signs a message off-chain, provides the message to a relayer, the relayer passes the signature and calldata to a contract on-chain (called an invoker), the contract verifies the signature using AUTH, and then relays the EOA's call with AUTHCALL.
so far, the most interesting IMO (as a non-dapp dev) are EIP-2535 Diamond Standard (@mudgen), EIP-3009 Transfer with Authorization (@petejkim), EIP-3000 Optimistic enactment of governance (@izqui9), and EIP-3156 Flash Loans (@acuestacanada)
but i feel like there are interesting conversations happening in some lower number EIPs that I'm just not following. any standards to improve the readability of tx data when signing (or signing standards in general)?
Yesterday's chain split will be cemented in Ethereum's history as an inadvertent hard fork. Let's look at exactly what the vulnerability was & how this transaction exploited it (thread): etherscan.io/tx/0x57f7f9ec3…
I also want to preface that this is completely an outsiders account of the incident & therefore everything posted here is only to the best of my knowledge. I look forward to the go-ethereum team's full disclosure of the vulnerability!
On 2019-11-07, Geth v1.9.7 was released. It contained a few fixes and optimization, including PR #20177 titled "core/evm: avoid copying memory for input in calls".
Geth's transaction pool (aka mempool) can be boiled down to a few key data structures and processes. Transactions are the main building block. They are stored on the heap while references to them populate four objects: "all", "priced", "queue", and "pending".
The "all" object is a mapping of the transaction's hash to the actual transaction object on the heap. It is the canonical source of transactions in the mempool and is used to build (and rebuild) the "priced" object.
The "priced" object is a heap (data structure) that orders the transactions in the mempool highest to lowest priced. When the mempool is completely saturated, "priced" is asked to find the N cheapest transactions so that they can be fully evicted from the mempool.