ethereum/eips-161 State trie Clearing

Source: Internet
Author: User

EIP 161:state trie Clearing -makes it possible to remove a large number of empty accounts this were put in the state At very low cost as a result of earlier DoS attacks. With this EIP, ' empty ' accounts is removed from the state whenever ' touched ' by another transaction. Removal of the empty accounts greatly reduces blockchain state size, which would provide client optimizations such as Faste R sync Times. The actual removal process would begin after the fork by systematically performing "call" to the empty accounts that were C Reated by the attacks.

You can remove a large number of empty accounts that were placed in a state at a very low cost due to an earlier Dos attack. With this eip, an "empty" account is removed from the state when it is "touched" by another transaction. Removing the empty account greatly reduces the blockchain state size, which provides client-side optimizations such as faster synchronization times. The actual removal process begins after the fork, systematically executing a "call" to the empty account created by the attacker, once to delete the empty account.

EIP title author type category Status created
161 State trie Clearing (invariant-preserving alternative) Gavin Wood Standards Track Core Final 2016-10-24
eip-158 is associated with it, all empty accounts cleared, 161 replaced by 158Hard Fork

Spurious Dragon

Parameters
    • FORK_BLKNUM: 2,675,000
    • CHAIN_ID: 1 (main net)
Specification

A. Account creation transactions and The  CREATE  operation shall, prior to the execution of the initialisation code,  increment  the  nonce  over and above its Normal starting value By  one   (for normal networks, this would be a simply 1, however test-nets with Non-zero default starting Nonces'll be different).

< Span class= "Apple-converted-space" >< Span class= "Apple-converted-space" > account creation transactions and creation operations before the initialization code is executed, The nonce should be increased by 1 on top of its normal initial value (this would be a simple 1 for a normal network, but a test network with a non-0 default boot nonces would be different)

B. Whereas&NBSP; call  and&NBSP; suicide  would charge 25,000 gas when the destination are non-existent, now the charge Shall&NBSP; only  be levied if the operation Transfers&NBSP; more than zero value  and the destination account is&NBSP; dead .

although call and SUICIDE in destination account There is no case to charge $25,000 for gas charges, but now only in operation transfer more than 0 value and destination Account status is dead Charges will be charged.

C. No account could change state from non-existent to existent-but-empty. If An operation would does this, the account shall instead remain non-existent.

No account can change the non-existent state to an existing but empty state. If an operation does this, the account will remain non-existent

D. at the end of the transaction, any account touched by the execution of that transaction Which is now empty shall instead become non-existent (i.e. deleted).

At the end of the transaction, any account that was previously related to the execution of the transaction but is now empty will become non-existent

Where:

An account was considered to being touched when it was involved in any potentially state-changing operation. This includes, which is not limited to, being the recipient of a transfer of zero value.

The account is considered to be touched when it comes to any action that might change the state. This includes, but is not limited to, the recipient as a 0 value transfer

An account was considered empty when it had no code and zero nonce and Zero balance.

If the account has no code and there is no nonce and 0 excess, the account is considered empty.

An account was considered dead when either it was non-existent or it is empty.

If an account does not exist or it is empty, then it is considered dead.

At the end of the transaction is immediately following the execution of the suicide list, prior to the determination of the state trie root for Rec Eipt population.

At the end of the transaction, the suicide checklist is executed immediately prior to determining receipt population's state tree root .

An account changes State when:

    • It is the target or refund of a SUICIDE operation for zero or more value;

It is zero or more of the SUICIDE operation of the target account or funds to return the account,

    • It is the source or destination of a CALL operation or message-call transaction transferring zero or more value;

It is a call to pass 0 or more values for an operation or a message to invoke the source or destination of a transaction

    • It is the source or creation of a CREATE operation or contract-creation transaction endowing zero or mo Re value;

It is the creation of an operation or contract that gives 0 or more value to create a transaction or create an account;

    • As the block author ("Miner") it is the recipient of block-rewards or transaction-fees of zero or more Value.

As a block author ("Miner"), it is the recipient of a block reward or transaction fee that is worth zero or more .

Notes

In the present Ethereum protocol, it should is noted that very few state changes can ultimately result in accounts that AR e empty following the execution of the transaction. In fact there is only four contexts this current implementations need track:

In the current Ethereum protocol, it should be noted that very few state changes will eventually cause the account to be empty after executing the transaction. In fact, the current implementation only needs to track 4 contexts

    • An empty account had zero value transferred to it through CALL ;

Null account is transferred to its value zero by call

    • An empty account had zero value transferred to it through SUICIDE ;
    • An empty account had zero value transferred to it through a message-call transaction;
    • An empty account had zero value transferred to it through a zero-gas-price fees transfer.
Rationale

Same as #158 except that several edge cases is avoided since we do not break invariants:

    • That's the can go from have code and storage to not have code or storage mid-way through the execution of a T ransaction; [corrected]
    • That a newly created account cannot is deleted prior to being deployed.

CREATEAvoids zero in the nonce to avoid any suggestion of the oddity of CREATE D accounts being reaped half-way through their Creation.

Addendum (2017-08-15)

On 2016-11-24, a consensus bugs occurred due to the implementations have different behavior in the case of State reverts. [3] The specification was amended to clarify that empty account deletions be reverted when the state is reverted.

References
    1. EIP-158 Issue and discussion: https://github.com/ethereum/EIPs/issues/158
    2. EIP-161 Issue and discussion: https://github.com/ethereum/EIPs/issues/161
    3. https://blog.ethereum.org/2016/11/25/security-alert-11242016-consensus-bug-geth-v1-4-19-v1-5-2/

Details:geth was failing to revert empty account deletions when the transaction causing the deletions of empty accounts E Nded with a Out-of-gas exception. An additional issue is found in Parity, where the Parity client incorrectly failed to revert empty account deletions in a More limited set of contexts involving Out-of-gas calls to precompiled contracts; The new Geth behavior matches Parity ' s, and empty accounts would cease to BES a source of concern in general in about one we EK once the state clearing process finishes.

ethereum/eips-161 State trie clearing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.