ethereum/EIPs-161 State trie clearing
EIP 161: State trie clearing - makes it possible to remove a large number of empty accounts that were put in the state at very low cost as a result of earlier DoS attacks. With this EIP, 'empty' accounts are removed from the state whenever 'touched' by another transaction. Removal of the empty accounts greatly reduces blockchain state size, which will provide client optimizations such as faster sync times. The actual removal process will begin after the fork by systematically performing `CALL` to the empty accounts that were created by the attacks.
可以删除由于早期DoS攻击攻击者以非常低的成本放入状态的大量空帐户。有了这个EIP,“空”账户在被另一个交易“触及”时就会从状态中删除。删除空帐户大大减少了区块链状态大小,这将提供更快的同步时间等客户端优化。实际的删除过程将在fork之后开始,系统地对攻击者创建的空帐户执行“调用”,一次来删除空账户。
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与它相关,都是空账户的清除,161取代了158
Hard fork
Parameters
FORK_BLKNUM
: 2,675,000CHAIN_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 will be simply 1, however test-nets with non-zero default starting nonces will be different).
帐户创建事务和创建操作在执行初始化代码之前,应将nonce在其正常初始值之上增加1个(对于正常的网络,这将是简单的1,但是具有非零默认启动nonces的测试网将是不同的)
b. Whereas CALL
and SUICIDE
would charge 25,000 gas when the destination is non-existent, now the charge SHALL only be levied if the operation transfers more than zero value and the destination account is dead.
虽然CALL
和SUICIDE
会在destination账户不存在的情况下收取25,000美元的燃气费用,但现在只有在操作转账超过零值且destination账户状态为dead时才会收取费用。
c. No account may change state from non-existent to existent-but-empty. If an operation would do this, the account SHALL instead 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).
在交易结束时,任何之前与交易执行有关但现在为空的账户都将变为不存在状态
Where:
An account is considered to be touched when it is involved in any potentially state-changing operation. This includes, but is not limited to, being the recipient of a transfer of zero value.
当涉及到任何可能改变状态的操作时,帐户被认为是被触动的。这包括,但不限于,作为零值转移的接收者
An account is considered empty when it has no code and zero nonce and zero balance.
如果帐户没有代码,且没有nonce和零余额,则认为该帐户为空。
An account is considered dead when either it is non-existent or it is empty.
如果一个帐户不存在或者它是空的,那么它就被认为是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 receipt population.
在交易结束后,在确定receipt population的状态树root之前立即执行自杀清单。
An account changes state when:
- it is the target or refund of a
SUICIDE
operation for zero or more value;
它是价值为零或更多的SUICIDE
操作的目标账户或资金退还账户,
- it is the source or destination of a
CALL
operation or message-call transaction transferring zero or more value;
它是一个调用传递0或更多值的操作或消息调用事务的源或目的地
- it is the source or creation of a
CREATE
operation or contract-creation transaction endowing zero or more value;
它是创建赋予零或以上价值的操作或合同创建事务的来源或创建账号;
- as the block author ("miner") it is the recipient of block-rewards or transaction-fees of zero or more value.
作为块作者(“矿工”),它是价值为零或更多的块奖励或交易费用的接受者。
Notes
In the present Ethereum protocol, it should be noted that very few state changes can ultimately result in accounts that are empty following the execution of the transaction. In fact there are only four contexts that current implementations need track:
在当前的Ethereum协议中,应该注意到很少的状态改变最终会导致在执行事务后账户为空。实际上,当前的实现只需要跟踪4个上下文
- an empty account has zero value transferred to it through
CALL
;
空帐户通过call转移到它的值为零
- an empty account has zero value transferred to it through
SUICIDE
; - an empty account has zero value transferred to it through a message-call transaction;
- an empty account has zero value transferred to it through a zero-gas-price fees transfer.
Rationale基本原理
Same as #158 except that several edge cases are avoided since we do not break invariants:与#158相同,只是由于我们没有打破不变量,避免了一些边缘情况
that an account can go from having code and storage to not having code or storage mid-way through the execution of a transaction;[corrected]- that a newly created account cannot be deleted prior to being deployed.无法在部署之前删除新创建的帐户
CREATE
avoids zero in the nonce to avoid any suggestion of the oddity of CREATE
d accounts being reaped half-way through their creation.
CREATE方法避免nonce为0,以避免
在创建过程中
中途收到任何关于创建帐户的奇怪建议
Addendum (2017-08-15)附录
On 2016-11-24, a consensus bug occurred due to two implementations having different behavior in the case of state reverts.[3] The specification was amended to clarify that empty account deletions are reverted when the state is reverted.
在2016年11月24日,由于两个实现在状态恢复的情况下具有不同的行为,导致了一个一致的bug。规范进行了修改,以声明在状态恢复时将恢复空帐户删除。
References
- EIP-158 issue and discussion: https://github.com/ethereum/EIPs/issues/158
- EIP-161 issue and discussion: https://github.com/ethereum/EIPs/issues/161
- 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 ended with an an out-of-gas exception. An additional issue was 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 will cease to be a source of concern in general in about one week once the state clearing process finishes.
当导致空帐户删除的交易以out-of-gas异常结束时,Geth未能还原空帐户删除。在奇偶校验中发现了另一个问题,奇偶校验客户机在一组更有限的上下文中没有正确地恢复空帐户删除,这些上下文中涉及到对预编译合约的out-of-gas调用;新的Geth行为与奇偶性匹配,一旦状态清除过程完成,空账户将在大约一周内不再是普遍关注的问题
ethereum/EIPs-161 State trie clearing的更多相关文章
- ethereum/EIPs-607 Hardfork Meta: Spurious Dragon硬分叉相关
eip title author type status created requires 607 Hardfork Meta: Spurious Dragon Alex Beregszaszi Me ...
- ethereumjs/ethereumjs-vm-3-StateManager
https://github.com/ethereumjs/ethereumjs-vm/blob/master/docs/stateManager.md StateManager 要与本博客的ethe ...
- go ethereum源码分析 PartIV Transaction相关
核心数据结构: core.types.transaction.go type Transaction struct { data txdata // caches hash atomic.Value ...
- ethereum/EIPs-1271 smart contract
https://github.com/PhABC/EIPs/blob/is-valid-signature/EIPS/eip-1271.md Standard Signature Validation ...
- ethereum/EIPs-1078 Universal login / signup using ENS subdomains
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1078.md eip title author discussions-to status ...
- 【转】干货 | 【虚拟货币钱包】从 BIP32、BIP39、BIP44 到 Ethereum HD Wallet
虚拟货币钱包 钱包顾名思义是存放$$$.但在虚拟货币世界有点不一样,我的帐户资讯(像是我有多少钱)是储存在区块链上,实际存在钱包中的是我的帐户对应的 key.有了这把 key 我就可以在虚拟货币世界证 ...
- ethereum/EIPs-1
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1.md 介绍了什么是EIP等等的详细信息: eip title status type a ...
- ethereum/EIPs-100 挖矿难度计算
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-100.md 创世纪区块的难度是131,072,有一个特殊的公式用来计算之后的每个块的难度. ...
- ethereum/EIPs-712 Ethereum typed structured data hashing and signing
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md eip title author discussions-to status ...
随机推荐
- MVC分部视图@Html.Partial
加载分布视图的方式: //1.以视图名使用当前文件夹下的视图(如果没有找到,则搜索 Shared 文件夹) @Html.Partial("_test") //加载对应文件 /Vie ...
- [MongoDB] MongoDB增删查改
MongoDB的三元素,数据库.集合.文档,集合就是表,文档就是行 开启MongoDB,cd切换到MongoDB的安装目录下的bin目录里,使用命令mongod 开启,参数:--dbpath 路径,把 ...
- SSL连接并非完全问题解决
教程所示图片使用的是 github 仓库图片,网速过慢的朋友请移步>>> (原文)SSL 连接并非完全安全问题解决. 更多讨论或者错误提交,也请移步. 最近拿到了 TrustAsia ...
- MySQL分库分表浅谈
一.分库分表类型 1.单库单表 所有数据都放在一个库,一张表. 2.单库多表 数据在一个库,单表水平切分多张表. 3.多库多表 数据库水平切分,表也水平切分. 二.分库分表查询 通过分库分表规则查找到 ...
- layui 图片上传+表单提交+ Spring MVC
Layui 的上传是最常用的, 不可或缺, 记录一下代码, 以后复制都能用!! 1.前端HTML: <div class="layui-form-item"> < ...
- npm 走 privoxy 代理经常出现 shasum check failed 的解决办法
今天在下载一个比较大的项目,经常 shasum check failed ,太烦了,于是想切淘宝源,分别尝试 nrm 切换和传递 --registry ,结果都出现 Unexpected end of ...
- 怎么在ReactNative里面使用Typescript
今天来搞一搞怎么搭建一个可以使用Typescript的ReactNative环境好吧,一句废话不多说,直接开始好吧 1.全局安装create-react-native-app yarn global ...
- python之初始面向对象
1. 初识面向对象 面向过程: 一切以事务的发展流程为中心. 面向对象: 一切以对象为中心. 一切皆为对象. 具体的某一个事务就是对象 2. 类. 对象 类: 就是图纸. 创建对象的第一步. 先画图 ...
- 警告!中国90%AI初创企业将在两年内落败出局
https://mp.weixin.qq.com/s/-RkyLda1jovaHBlBTsi-BA 近年来,中国涌现了一大批AI初创企业,但AI热潮也伴随着泡沫.由于近期市场资金紧缩,投资者发出警告, ...
- Flume Source 实例
Flume Source 实例 Avro Source 监听avro端口,接收外部avro客户端数据流.跟前面的agent的Avro Sink可以组成多层拓扑结构. 1 2 3 4 5 6 7 8 9 ...