译文/Translated:
华盛顿举办的#B1June活动宣布了关于EOSIO的一系列计划,其焦点是提高平台的性能和安全性。其中包括和WebAuthehn等Web标准集成、EOS虚拟机(EOS VM)、EOSIO的下一代版本EOSIO 2,它们都能进一步实现大规模使用区块链应用这一目标。EOS VM 开发者预览版还在开发阶段,还不会被用在生产环境中。我们即将发布EOS VM稳定版之际,我们很高兴地发布专为区块链设计的高性能WebAssembly解释器。
区块链工程师转为区块链应用构建
EOSIO区块链技术日益普及,能够支持安全的确定性执行的性能要求已经超过传统用在浏览器交互的WebAssembly引擎的容量。过去一年,我们测试了现有的解释器,如BInaryen和WABT,的性能。这些解释器用在其相应的领域很不错,但应用到区块链上之后,就产生了无限内存分配、加载时间超时、堆栈溢出等问题,这些都导致了整体性能和可靠性下降。单线程性能、贡献资源跟踪、本机代码的低开销调用是区块链性能至关重要的部分。考虑到这些因素,EOS VM是从下到上满足区块链应用具体需求的设计。
EOSIO 1.0最初是在2018年6月利用Binaryen解释器发布的。到了九月我们就发布了支持WABT的EOSIO1.3,这个版本带来了两倍的性能提高。今年晚些时候我会发布EOSIO 2,我们希望EOS VM能够把性能提高到6倍以上,这样就让EOSIO 2中的WebAssembly的执行比一年前EOSIO刚上线时提高了12倍。尽管我们很高兴能看到这样的性能提高,但是因为这是开发者预览版,我们的内部基准还不能完全反映现实场景,我们也还在进行进一步研发。
我们让EOS VM成为专门针对区块链应用的高性能解释器,但是,因为它关注低延迟和其它性能效率,所以它会成为很多WebAssembly用例的强敌。
EOS虚拟机的高性能属性
EOS VM具有以下特点
- 极快的执行力
- 极快的解析/加载
- 高效的时间限制执行
- 确定性执行
- C++/ Header Only集成
- 高度可扩展的设计
确定性执行以避免共识无效
区块链应用需要确定性执行才能正常运行;给定的输入必须是中产生相同的输出。使用传统的WebAssembly解释器时,非确定性操作,即值会随着状态改变的操作,可能会有共识延时的问题,从而影响到用户和构建在上面的应用程序。在EOS VM上,我们搭建了一个环境允许支持硬件的浮点运算和基于软件的浮点运算。使用基于软件的浮点(softfloat)能够真正实现浮点运算的确定性执行。因为这些系统内置的,所以这些”softfloat”操作的系统开销被最小化。对于不需要位级确定性的用例,可以把库设置成使用主处理器的硬件浮点单元。
有限的时间限制执行来管理资源
有效的资源管理是建立高效的区块链应用的关键。区块链网络各方只有有限的资源集,这些资源集被网络用户共享。这种情况下,区块链应用在其分配到的资源中高效运行的重要性就更加明显了。
EOS VM使用两个新工具让开发者能够通过追踪WebAssembly执行期间的操作,更好地进行资源分配管理。第一个工具是内置检查工具,用以检查已执行和在预设阙值数暂停的WebAssembly指令数量。这就可以检查有哪些进程已经开始执行但没有在设定的时间内正常地完成。第二个工具是外部的“观察者”,它会在一个预设的时间之后停止执行,从而停止可能挂起而无法正常退出的进程。
为真实世界的区块链发展而安全地建立
WebAssembly的设计意图是要在浏览器环境中运行不可信任的代码,但该环境下最糟糕的也就是网页标签挂起而已。但是区块链环境下,交易挂起会导致整个链暂停,所以整体的影响是更加严重的。
开发是一个容易出错、破解修复的过程,它需要调试和不断思考未来。所以,程序员总是会遇到检查和验证的问题。EOS VM的基本数据类型包括内置保护,如果遇到很多这类边角问题,它就会被激发、自动停止该执行过程。
为了保护内存,我们建立了一个保护分页机制,它会利用CPU和核心操作系统安全性来进行沙盒内存操作。该机制实现本地代码功能的通用部署,而不用担心因为诸如无限递归和数组访问等常见程序错误相关的内存溢出导致机器崩溃。
EOS VM内置的分配器足够模块化满足应用具体的需求,而不需要创建高内存的结构支持,因为分配器本身不“拥有”它们使用的内存。同步这些分配器的生命周期就不需要复制它们,这就允许了用户可根据需要进行独立于内容的WebAssembly模块集成而不会遭受任何性能上的损失。
轻松集成的C++/ Header Only集成
EOS VM可以没有外部或者预编依赖关系存在;它仅需要标头就可以存在。这就意味着构成EOS VM库的所有宏函数和类对头文件中的编译器都是可见的。这就让编译器能够更好地实现在集成代码基础的背景下让EOS VM最优化,因为它能调用所有函数/方法定义。这个设置中,集成到项目就像把EOS VM目录添加到项目的包含路径一样简单。
基于高度可扩展的组建设计
对EOS VM进行划分并创建自包含的组件让系统可以高度实应添加了新的定义逻辑的自定义后端工具。此外,通过一些简单的变成程序,用户可以相对轻松地构建新的延展,这样,当有需要的时候,我们就可以推出一系列强大的工具进行配置、调试等。
规模化区块链技术的未来
过去一年EOSIO蓬勃发展,我们的目标和我们的社区都在不断创建更多强大的工具包和库,让EOSIO成为世界上最高效、用途最广的区块链平台。当终端用户和企业能够通过应用感受到区块链带来的好处的时候,区块链技术的应用终将被带动。EOS VM的性能在不断提高,正如我们先前所有发布的EOSIO一样,我们在不断努力创造不同的工具帮助开发者实现更大的目标。我们会不断和社区一起工作,改进和开发EOSIO来支持这些努力。
EOS VM开发者预览版还没有正式发布开原版,请参考LICENSE(执照)获得完整的版权信息。如果您对改善EOS VM感兴趣,请参考Github上的发布的Contribution Guide(贡献指南)和Code of Conduct(行为准则)。
保持联系
如果您愿意给我们反馈并想和我们团队并肩让EOSIO软件更进一步,您给可以给我们的开发者关系小组发邮件:developers@block.one
您还可以订阅我们的邮件获得未来最新的信息。我们很高兴能够不断为开发者改进EOSIO软件的可用性,同时,我们也不断为区块链技术的大规模使用奠定基础。
重要信息:本文所提供的所有信息都遵循本重要通知,您必须熟悉这些条款。这个通知包含了重要的信息、限定和关于软件、发布、商标、第三方资源、前瞻性声明的限制。您在获得我们的任何信息的时候必须是接受和同意该通知的条款的。
原文/Original:
In Washington, DC at the #B1June event, announcements related to EOSIO™ focused on improved performance and security of the platform. From integration with web standards like WebAuthn, to the announcement of the EOS Virtual Machine (EOS VM), EOSIO 2, the next major version of EOSIO, will further our goal of the mass adoption of blockchain applications. The EOS VM Developer Preview release is still in development and not intended for use in production environments. As we progress toward releasing EOS VM stable, we are excited to be delivering a highly performant WebAssembly interpreter purpose-built for blockchains.
Built By Blockchain Engineers for Blockchain Applications
With the ever growing popularity of EOSIO blockchain technology, the performance needed to support the secure deterministic execution of blockchain applications has surpassed the capacity of conventional WebAssembly engines designed to interface with browsers. Over the past year, we tested the performance of existing interpreters like Binaryen and WABT which are well suited for their purpose, but when applied to blockchains have issues with unbounded memory allocation, extended loading time, and stack overflows which lead to decreased overall performance and reliability. Single threaded performance, shared resource tracking, and low-overhead calls to native code are critical to blockchain performance. With these tenets in mind, EOS VM has been engineered from the ground up to meet the specific demands of blockchain applications.
EOSIO 1.0 was originally released with the Binaryen interpreter in June 2018, by September we released EOSIO 1.3 with support for WABT seeing 2X performance gains. With the release of EOSIO 2 planned for later this year, we expect EOS VM to increase performance up to 6X more making WebAssembly execution in EOSIO 2 up to 12X faster than when EOSIO was released just one year ago. While we are excited for this improvement in performance, as this is a Developer Preview release, our internal benchmarks are not yet indicative of real world scenarios and further development is ongoing.
We built EOS VM to be a high performance interpreter specialized for blockchain applications, but its focus on low latency and other performance efficiencies will make it a competitive alternative for many WebAssembly use cases.
High Performance Attributes of the EOS Virtual Machine
EOS VM is designed with the following attributes in mind:
- Extremely Fast Execution
- Extremely Fast Parsing/Loading
- Efficient Time Bound Execution
- Deterministic Execution
- C++ / Header Only Integration
- Highly Extensible Design
Deterministic Execution to Avoid Consensus Failures
Blockchain applications require deterministic execution to properly run; given inputs must always produce the same outputs. In using traditional WebAssembly interpreters, non-deterministic actions, those whose values change from state to state, run the risk of delaying consensus affecting all users and applications built on it. With EOS VM, we have engineered an environment that allows for both hardware supported floating point operations and software based floating point operations. The use of the software-based floating point (“softfloat”), allows for true deterministic execution of floating point operations. Since these are built into the system, the overhead for the “softfloat” operations is mitigated as much as possible. For use cases where bit level determinism is not needed, then the library can be configured to use the hardware floating point unit of the host processor.
Efficient Time Bounded Execution to Manage Resources
Effective resource management is key to building performant blockchain applications. Parties of a blockchain network have a finite set of resources that are shared among users of the network. This makes it even more important for blockchain applications to run efficiently within their allotted specifications.
EOS VM implements two new tools that allow developers to better manage resource allocation by tracking the WebAssembly runtime execution. The first is a built-in check for the number of WebAssembly instructions that have executed and halt at a preset threshold. This creates a check for processes that start execution but fail to complete gracefully within a set timeframe. The second is an external “watcher” that will halt execution after a preset amount of time, stopping processes that may be hung up and fail to exit gracefully.
Securely Built for Real World Blockchain Development
WebAssembly was designed to run untrusted code in a browser environment where the worst that can happen is a hung browser tab. In the case of blockchain, a hung transaction can bring the chain to a halt so the overall consequences are much more severe.
Development is an error prone, break-fix process that requires debugging and constant thinking around corners. As a result, there are times when programmers may run into issues with checks and validations. EOS VM’s fundamental data types include built-in protections that trigger and automatically kill execution if many of these corner-cases are hit.
To protect memory, we built a guard paging mechanism that utilizes CPU and core OS security to sandbox memory operations. This mechanism allows for more versatile deployment of native code functions without the risk of crashing the machine due to memory overruns related to common programming errors such as unbounded recursion and array access.
Built in allocators in EOS VM are modular enough to serve application specific needs without creating memory intensive structures to support them because the allocators don’t “own” the memory they use. Synchronizing the lifetime of such allocators does away with the need to replicate them, allowing for context-independent integration of the WebAssembly modules as needed without any performance loss.
C++ / Header Only Integration for Effortless Integration
EOS-VM can be used in a way that it has no external or pre-compiled dependencies; it is a header only implementation. This means that all macro functions and classes that make up the EOS VM library are visible to the compiler in header files. This allows the compiler to more aggressively optimize EOS VM within the context of the integrating code base, as it has all of the function/method definitions available to it. In this configuration, integration into a project can be as simple as adding the EOS VM directory to the include path of a project.
Highly Extensible Component Based Design
Compartmentalizing EOS VM and creating self-contained components allows the system to be highly adaptable to custom backend tools that use newly defined logic alongside previously defined components. In addition, new extensions can be constructed with relative ease by following simple coding procedures, allowing for a robust series of tools capable of profiling, debugging, etc. to arise as necessity dictates.
Scaling the Future of Blockchain Technology
Over the past year growing EOSIO, our focus, along with the community, has been to continue creating more robust toolkits and libraries for EOSIO keeping it one of the most performant and utilized blockchain platforms in the world. Ultimately, the adoption of blockchain technology will be driven by applications which expose the benefits of blockchain to end users and businesses. With the performance advancements of EOS VM, as with all releases of EOSIO, we strive to create tools that will aid developers as they build towards that greater goal. We will continue to work with the community to improve and develop EOSIO to support these endeavors.
The EOS VM Developer Preview is not yet released open source. Please refer to the LICENSE for full copyright notice. If interested in contributing to EOS VM please review the Contribution Guide and Code of Conductnoted in the release notes on Github.
Stay Connected
If you are interested in providing feedback and working more closely with our team to improve EOSIO for developers, you can send our developer relations team an email at developers@block.one.
You can also keep up to date with future announcements by subscribing to our mailing list below. We are excited to be regularly improving the usability of the software for EOSIO developers as we continue to lay a foundation for the mass adoption of blockchain technology.
Important: All material is provided subject to this important notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources and forward-looking statements. By accessing any of our material, you accept and agree to the terms of the notice.
原文链接/Original URL: