Vitalik最新文章:以太坊Purge阶段需要清除哪些东西

币圈资讯 阅读:34 2024-04-22 02:38:36 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

作者:Vitalik,以太坊创始人;翻译:善欧巴,比特币买卖交易网

最近的 Dencun 硬分叉中不太知名的 EIP 之一是EIP-6780,它删除了操作码SELFDESTRUCT的大部分功能。

klqAB5jfUOJ5uHATmdlRiz9eyjOkxWGzUrf0EUv1.png

该 EIP 是以太坊协议开发中经常被低估的部分的一个关键示例:通过消除复杂性和添加新的安全保证来简化协议的努力。这是我所说的“PURGE”的一个重要部分:精简以太坊和清除技术债务的项目。将会有更多的 EIP 具有类似的精神,因此值得了解 EIP-6780如何实现的目标,以及未来Purge中可能会清除哪些其他EIP。

EIP-6780如何简化以太坊协议?

EIP-6780 减少了操作码SELFDESTRUCT的功能,它会销毁调用它的合约并清空其代码和存储,因此只有在同一交易期间创建合约时它才有效。这本身并没有降低规范的复杂性。然而,它确实通过引入两个新的不变量来改进实现

1、EIP-6780 后,单个区块中可以编辑的存储槽数有最大数量(大致为:gas limit / 5000)。

2、如果合约在交易或区块开始时具有非空代码,则在该交易或区块结束时它将具有相同的代码。

之前,这些不变量都不是True:

1、SELFDESTRUCT拥有大量存储槽的合约可以在单个区块内清除无限数量的存储槽。这将使Verkle树的实现变得更加困难,并且使以太坊客户端的实现变得更加复杂,因为它们需要额外的代码来有效地处理这种特殊情况。

2、合约的代码可以通过SELFDESTRUCT从非空变为空,事实上合约甚至可以在之后立即用不同的代码重新创建。这使得账户抽象钱包中的交易验证更难使用代码库而不容易受到 DoS 攻击。

现在,这些不变量都是True,使得构建以太坊客户端和其他类型的基础设施变得更加容易。几年后,希望未来的EIP能够完成这项工作并SELFDESTRUCT完全消除。

哪些其他“purges”正在进行?

  • Geth 最近删除了数千行代码,删除了对pre-merge PoW网络的支持。

  • 这个 EIP正式体现了这样一个事实:我们不再需要代码来担心“空帐户”(请参阅:EIP-161 ,它引入了这个概念作为上海 DoS 攻击修复的一部分)

  • Dencun 中 blob 的存储窗口为 18 天,这意味着以太坊节点只需要约 50 GB 来存储 blob 数据,并且此数量不会随着时间的推移而增加

前两个显著改善了客户端开发人员的体验。后者显著提高了节点运营商的寿命。

还有哪些其他可能需要Purge的东西?

预编译(Precompiles)

预编译是以太坊合约,它没有 EVM 代码,而是具有必须由客户端自己直接实现的逻辑。这个想法是,预编译可用于实现无法在 EVM 中有效实现的复杂形式的密码学。

如今,预编译的使用非常成功,特别是通过椭圆曲线预编译启用基于 ZK-SNARK 的应用程序。然而,还有其他很少使用的预编译:

  • RIPEMD-160:引入哈希函数是为了支持与比特币更好的兼容性

  • Identity:返回与其输入相同的输出的预编译

  • BLAKE2:引入哈希函数是为了支持与 Zcash 更好的兼容性

  • MODEXP引入非常大的模幂以支持基于 RSA 的加密

事实证明,对这些预编译的需求远远低于预期。Identity被广泛使用,因为它是复制数据最简单的方法,但自从 Dencun 以来,操作码MCOPY已经取代了它。不幸的是,这些预编译都是共识错误的巨大来源,也是新 EVM 实现的巨大痛苦来源,包括 ZK-SNARK 电路、形式验证友好的实现等。

有两种方法可以删除这些预编译:

  1. 只需删除预编译即可,例如。EIP-7266删除了 BLAKE2。这很简单,但会破坏任何仍在使用它的应用程序。

  2. 将预编译替换为执行相同操作的 EVM 代码块(尽管不可避免地会产生更高的 Gas 成本),例如。本草案 EIP就是为了身份预编译而这样做的。这比较困难,但几乎肯定不会破坏使用它的应用程序(除非在极少数情况下,新 EVM 代码的 Gas 成本超过了某些输入的区块 Gas 限制)

历史区块 (EIP-4444)

如今,每个以太坊节点都有望永久存储所有历史区块。长期以来,人们一直认为这是一种非常浪费的方法,并且由于高存储要求而使得运行以太坊节点变得不必要的困难。在 Dencun 中,我们引入了 blob,它只需要存储约 18 天。使用EIP-4444,一段时间后,以太坊区块也将从默认以太坊节点中删除。

需要解决的一个关键问题是:如果旧历史记录并没有被每个节点存储,那么用什么存储它呢?实际上,区块浏览器等大型实体将会这样做。然而,使 p2p 协议来存储和传递该信息也是可能的,而且并不困难,这对于任务来说更加优化。

以太坊区块链是永久性的,但要求每个节点永远存储所有数据是实现这种永久性的一种非常“矫枉过正”的方式。

一种方法是针对旧历史的简单点对点torrent网络。另一种是针对以太坊使用进行更明确优化的协议,例如门户网络。

或者,以模因格式:

kKp39xlQQkPePH7S8xt3RjVJWPVnhvHTMlI9KTMP.png

减少运行以太坊节点所需的存储量可以大大增加愿意做节点的人数。EIP-4444 也可以减少节点同步时间,这也简化了许多节点运营商的工作流程。因此,EIP-4444可以大大提高以太坊节点的去中心化。潜在地,如果每个节点默认存储一小部分历史记录,我们甚至可以像今天一样在网络上存储每个特定历史记录的大致相同数量的副本。

日志改革

直接引用这个EIP草案:

日志最初的引入是为了让应用程序能够记录有关链上事件的信息,以便去中心化应用程序(dapp)能够轻松查询这些信息。使用bloom过滤器,dapp 将能够快速浏览历史记录,识别包含与其应用程序相关的日志的几个块,然后快速识别哪些单个事务具有所需的日志。

实际上,这种机制太慢了。几乎所有访问历史记录的 dapp 最终都不是通过对以太坊节点(甚至远程托管节点)的 RPC 调用,而是通过集中式额外协议服务。

我们可以做什么?我们可以删除bloom过滤器,并简化LOG操作码,这样所做的就是创建一个将哈希值放入状态的值。然后,我们可以构建单独的协议,使用 ZK-SNARK 和增量可验证计算(IVC)来生成可证明正确的“日志树”,它表示给定的所有日志的易于搜索的表topic,以及需要日志和想要的应用程序去中心化可以使用这些单独的协议。

转向SSZ

如今,以太坊的大部分区块结构(包括交易和收据)仍然使用基于RLP和 Merkle Patricia 树的过时格式进行存储。这使得开发使用该数据的应用程序变得不必要的困难。

以太坊共识层已转向更清洁、更高效的SimpleSerialize (SSZ):

TZ215m0bMFNz67Nk7ftASzdtzKHBp4M6YAFIZF8w.png

资料来源:https://eth2book.info/altair/part2/building_blocks/merkleization/

但是,我们仍然需要完成转换,并将执行层移至相同的结构。

SSZ 的主要优势包括:

  • 规范更加简单和清晰

  • 与现状的六叉 Merkle Patricia 树相比,大多数情况下 Merkle 证明的长度缩短了 4 倍

  • 与极长的最坏情况相比,Merkle 证明的长度有界(例如,证明合约代码或长收据输出)

  • 无需实现复杂的位操作代码(RLP 需要)

  • 对于 ZK-SNARK 用例,通常可以重用围绕二元 Merkle 树构建的现有实现

如今,以太坊中存在三种类型的加密数据结构:SHA256 二叉树、SHA3 RLP 哈希列表和十六进制 Patricia 树。一旦我们完成向 SSZ 的过渡,我们将只剩下两个:SHA256 二叉树和 Verkle 树。从长远来看,一旦我们在 SNARKing 哈希方面做得足够好,我们很可能会用使用 SNARK 友好哈希(一种适用于所有以太坊的加密数据结构)的二进制 Merkle 树来取代 SHA256 二叉树和 Verkle 树。


One of the less well-known hard bifurcations of Shanouba Bitcoin Trading Network recently is that it deletes most of the functions of operation code, which is a key example of the often underestimated part in the development of Ethereum protocol. This is an important part of what I call the efforts to simplify the protocol by eliminating complexity and adding new security guarantees. The project of streamlining Ethereum and clearing technical debts will have more similar spirit, so it is worth knowing how to achieve it. The standard and what other things may be removed in the future how to simplify the Ethereum protocol reduces the function of the operation code. It will destroy the contract calling it and empty its code and storage, so it will only be effective when the contract is created during the same transaction. This in itself does not reduce the complexity of the specification. However, it does improve the number of memory slots that can be edited in a single block by introducing two new invariants. The maximum number is roughly if the contract has a non-empty code at the beginning of the transaction or block. At the end of the transaction or block, it will have the same code. Before that, these invariants were not contracts with a large number of storage slots. An infinite number of storage slots can be cleared in a single block, which will make the implementation of the tree more difficult and make the implementation of the Ethereum client more complicated because they need extra code to effectively deal with this special situation. In fact, the contract can even be recreated with different codes immediately after that. It is more difficult to use the code base to verify the transaction in the abstract wallet of the account, and it is not easy to be attacked. Now these invariants make it easier to build Ethereum clients and other types of infrastructure. In a few years, I hope that the future can complete this work and completely eliminate what others are doing. Recently, thousands of lines of code have been deleted, and the support for the network has been deleted. This officially reflects the fact that we no longer need code to worry about empty accounts. Please refer to it and introduce this concept as. The storage window in the part of Shanghai attack repair is days, which means that Ethereum nodes only need about to store data, and this number will not increase with the passage of time. The first two have significantly improved the experience of client developers, and the latter has significantly improved the life of node operators. What other things may be needed? Precompiling precompiled is an Ethereum contract, which has no code but logic that must be directly implemented by the client itself. This idea is that precompiling can be used to achieve the goal that cannot be realized in. Nowadays, the use of precompilation is very successful, especially the application based on elliptic curve precompilation. However, there are other precompilations that are rarely used. Hash function is introduced to support better compatibility with Bitcoin, and the precompilation that returns the same output as its input is introduced to support better compatibility. It is proved that the demand for these precompilations is far lower than expected. It is widely used because it is the simplest way to copy data, but the operation code has replaced it since then. Unfortunately, these precompilations are a huge source of consensus errors and a great source of pain for new implementations, including the friendly implementation of circuit form verification. There are two ways to delete these precompilations, just delete them, for example, which is simple, but it will destroy any application that is still using it and replace them with code blocks that perform the same operation, although it will inevitably For example, this draft is done for identity precompilation, which is more difficult, but it will almost certainly not destroy the application that uses it, unless in rare cases, the cost of new code exceeds some input blocks, historical blocks, and now every Ethereum node is expected to permanently store all historical blocks. People have long thought that this is a very wasteful method and it is unnecessary to run Ethereum nodes because of high storage requirements. We have introduced it and only need to store it for about days. After using it for a period of time, the Ethereum block will also be deleted from the default Ethereum node. A key problem to be solved is that if the old historical record is not stored by each node, what should be used to store it? In fact, large entities such as block browsers will do so. However, it is also possible and not difficult to make the protocol to store and transmit this information. This is more optimized for the task. The Ethereum block chain is permanent, but it requires every node to be forever. Storing all data is a very overkill way to achieve this permanence. One method is a simple peer-to-peer network with an old history, and the other is a protocol that is more clearly optimized for the use of Ethereum, such as portal network or meme format. Reducing the storage required to run Ethereum nodes can greatly increase the number of people who are willing to be nodes and reduce the synchronization time of nodes, which also simplifies the workflow of many node operators, so it can greatly improve the access of Ethereum nodes. Centralization Potentially, if each node stores a small number of historical records by default, we can even store roughly the same number of copies of each specific historical record on the network as we do today. The reform of direct reference to this draft log was originally introduced to enable applications to record information about events on the chain so that decentralized applications can easily query this information. Using filters, we will be able to quickly browse the historical records and identify several logs related to their applications. Block and then quickly identify which single transaction has the required log. In fact, this mechanism is too slow. Almost all access history records are ultimately not through calls to Ethereum nodes or even remote managed nodes, but through centralized additional protocol services. What can we do? We can delete filters and simplify opcodes so that all it does is create a value that puts the hash value into the state, and then we can build a separate protocol usage and incremental verifiable calculation to generate verifiability. Knowing the correct log tree, which represents the easy-to-search table of all the logs given and the decentralization of the logs and the desired applications, can be turned by using these separate protocols. Today, most of the block structures of Ethereum, including transactions and receipts, are still stored in outdated formats based on sum trees, which makes it unnecessary to develop applications using this data. The consensus layer of Ethereum has turned to cleaner and more efficient data sources, but we still need to complete the conversion and move the execution layer to the same structure. The main advantages include simpler and clearer specifications. Compared with the current sextuples, most situations. 比特币今日价格行情网_okx交易所app_永续合约_比特币怎么买卖交易_虚拟币交易所平台

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=53897

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友