ethereum/EIPs-158 State clearing 被EIP-161取代

eip title author type category status created superseded-by
158
State clearing
Vitalik Buterin
Standards Track
Core
Replaced
2016-10-16
161

 被EIP-161取代了

Specification

For all blocks where block.number >= FORK_BLKNUM (TBA):git

  1. In all cases where a state change is made to an account, and this state change results in the account state being saved with nonce = 0, balance = 0, code empty, storage empty (hereinafter "empty account"), the account is instead deleted.在全部狀況下,若是對賬戶進行了狀態更改,而且此狀態更改致使賬戶狀態保存爲nonce = 0、balance = 0、代碼爲空、存儲爲空(如下簡稱爲空賬戶),則將刪除該賬戶
  2. If a address is "touched" and that address contains an empty account, then it is deleted. A "touch" is defined as any situation where if the account at the given address were nonexistent it would be created.若是地址被「touch」,而該地址包含一個空賬戶,則刪除該地址。「touch」被定義爲若是給定地址上的賬戶不存在,將建立該賬戶的狀況,下面有寫
  3. Whenever the EVM checks if an account exists, emptiness is treated as equivalent to nonexistence. Particularly, note that this implies that, once this change is enabled, there is no longer a meaningful difference between emptiness and nonexistence from the point of view of EVM execution.每當EVM檢查賬戶是否存在時,空被視爲等同於不存在。特別要注意的是,這意味着,一旦啓用了這個更改,從EVM執行的觀點來看,空和不存在之間就再也不有有意義的區別了
  4. Zero-value calls and zero-value suicides no longer consume the 25000 account creation gas cost in any circumstance零值calls和零值suicides在任何狀況下都再也不消耗25000個帳戶的建立費用

The cases where a "touch" takes place can be enumerated as follows:github

  • Zero-value-bearing CALLs
  • CREATEs (if the code that is ultimately saved is empty and there is no ether remaining in the account when it is saved)
  • Zero-value-bearing SUICIDEs
  • Transaction recipients
  • Contracts created in contract creation transactions
  • Miners receiving transaction fees (note the case where the gasprice is zero, and the account does not yet exist because it only receives the block/uncle/nephew rewards after processing every transaction)

Specification (1b)

When the EVM checks for emptiness (for the purpose of possibly applying the 25000 gas cost), emptiness is defined by is_empty(acct): return get_balance(acct) == 0 and get_code(acct) == "" and get_nonce(acct) == 0; emptiness of storage does not matter. This simplifies client implementation because there is no need to add extra complexity to make caches enumerable in the correct way and does not significantly affect the intended result, as the cases where balance/code/nonce are empty but storage is nonempty where this change would lead to an extra 25000 gas being paid are pathological and have no real use value.緩存

這簡化了客戶端實現,由於不須要添加額外的複雜性經過正確的方法來使緩存可列舉並不明顯影響了預想的結果,在balance/代碼/ nonce爲空但存儲非空的狀況下,這種變化將致使額外的25000年自然氣支付是病態的,沒有真正的使用價值。app

Specification (1c)

Do not implement point 2 above (ie. no new empty accounts can be created, but existing ones are not automatically destroyed unless their state is actually changed). Instead, during each block starting from (and including) N and ending when there are no null accounts left, select the 1000 null accounts that are left-most in order of sha3(address), and delete them (ordering by hash is necessary so as to allow the accounts to be easily found by iterating the tree).less

Rationale

This removes a large number of empty accounts that have been put in the state at very low cost due to flaws in earlier versions of the Ethereum protocol, thereby greatly reducing state size and hence both reducing the hard disk load of a full client and reducing the time for a fast sync. Additionally, it simplifies the protocol in the long term, as once all "empty" objects are cleared out there is no longer any meaningful distinction between an account being empty and being nonexistent, and indeed one can simply view nonexistence as a compact representation of emptiness.ide

此外,從長遠來看,它簡化了協議,由於一旦全部的「空」對象都被清除,一個賬戶是空的和不存在的之間就再也不有任何有意義的區別了,ui

Note that this proposal does introduce a temporary breaking of existing guarantees, in that by repeatedly zero-value-calling already existing empty accounts one can create a state change at a cost of 700 gas per account instead of the usual 5000 per gas minimum (with SUICIDE refunds this goes down further to 350 gas per account). Allowing such a large number of state writes per block will lead to heightened block processing times and increase uncle rates in the short term while the existing empty accounts are being cleared, and eventually once all empty accounts are cleared this issue will no longer exist.this

相關文章
相關標籤/搜索