“`html
Since the previous C++ DEV Update, numerous developments have taken place in the engine room that were not particularly apparent externally. This article aims to provide a summary of our ongoing projects.
Besides the features aspect, Bob has been focused on a suggested process for re-licensing the C++ runtime client code to Apache 2.0, as mentioned on several occasions in the past month or two. Anticipate further updates on that shortly.
Eth Unit-Test Mode
Not only is it crucial for executing our Solidity end-to-end tests through IPC, but Dimitry Khoklov and others have also introduced new RPC endpoints to the eth client, enabling significantly greater flexibility for smart contract testing. If you utilize eth –test -d /tmp/test and connect to the ipc port at /tmp/test/geth.ipc (we suggest using ethereum-console as it already incorporates these features), you can:
- alter the blockchain settings (e.g., eliminate proof of work verification and pre-fund specific accounts)
- mine a specified number of blocks (at roughly 30 blocks per second)
- adjust the timestamp of the current block (to test timeouts in your contracts, for instance)
- revert the blockchain to a specific block number
This functionality allows us to execute our existing 305 Solidity end-to-end tests in approximately 46 seconds on a standard computer. Each of these tests consists of at least two (often more) transactions, along with an equivalent number of mined blocks.
Additional details regarding these features can be found at https://github.com/ethereum/ethereum-console.
Please be aware that this is presently only available for the binary provided via the ubuntu dev ppa.
Virtual Machine Speedup
Greg Colvin has spent recent months enhancing the C++ implementation of the EVM interpreter. He seized the opportunities he refers to as low-hanging fruits (having previously worked for Oracle on the Java interpreter…). The key enhancements thus far involve substituting 256-bit calculations with 64-bit calculations for gas metering and ensuring that no more metering calculations occur for each VM operation than are necessary. These and other modifications have contributed to the following outcomes for Paweł Bylica’s emerging benchmark suite. The chart below depicts the speed improvements relative to the previous cpp ethereum interpreter (cpp int (old)).
To be fair, it’s important to clarify what these benchmarks reflect. The first benchmark (where the evmjit shows an astounding speedup of 472x) consists of a million empty loops and highlights the sluggishness of the EVM’s computed goto compared to the direct jump of a JIT – addressing that is the next item on the agenda. The second benchmark involves a poorly performing random number generator that executes a million loops with four multiplications and four additions per loop. It is primarily affected by 256-bit calculations, rendering a JIT less impactful. (Note that the Go JIT compiles to a faster interpreted representation rather than native code.)
In practice, these enhancements will strictly be significant for “number-crunching” contracts as the computation duration is typically dominated by storage access. Conversely, the “rng” benchmark closely resembles cryptographic operations, tugging such matters further into the territory of legitimate on-chain implementations.
Paweł Bylica is developing a C-language interface connecting the virtual machine implementation and the hosting client, aiming to enable the integration of various VMs into an Ethereum client. Consequently, geth could potentially reap the benefits from our tweaks to the C++ virtual machine and particularly from the LLVM just-in-time compiler.
It is important to note that these modifications have not yet been released, but they are included in the ubuntu dev ppa.
Remix
Yann Levreau and Liana Husikyan are engaged in our new EVM debugger remix. We launched the alpha version a few days ago:
Currently, you can “only” use it to scrutinize every single step in the execution of any transaction on the blockchain, observe the current stack, memory and storage contents, and see the sequence of commands. The subsequent phase will involve enabling source-level debugging, allowing you to see the current position in the source code, progress at line or instruction level, and view the decoded values of the variables (rather than just the raw hex values).
The debugger is designed for you, the community, and we were thrilled to learn that etherscan has already integrated Remix into their blockchain explorer.
Repository Reorganisation
Bob Summerwill is committed to returning C++-Ethereum to its original location, https://github.com/ethereum/cpp-ethereum, thereby eliminating the unnecessary and perplexing division into multiple sub-repositories. We are making excellent strides in this area; one of the first noticeable actions was to decouple the Solidity testing infrastructure from the virtual machine implementation. The Solidity tests can now be compiled independently of the virtual machine and executed by interacting with a specifically configured eth process (the one referenced above) over the standard IPC interface.
The next steps involve untangling the remaining code, adjusting the test automation and continuous integration accordingly, and executing the actual transition.
Alongside this action, we regrettably have to part ways
“`to Mix and AlethZero (the essence of mix will persist in the upcoming remix initiative). The load they carry would be excessively large, as it encompasses Qt and a strong dependency on Solidity. As previously detailed in earlier communications, a flexible IPC-based association of these utilities to a compact client implementation grants us significantly greater adaptability, and the community backing that accompanies a transition to JavaScript and web-centric tools like remix and browser-solidity is simply unparalleled in comparison.
Formal Verification
We are enhancing the current formal verification instruments incorporated with Solidity to accommodate cross-contract interactions. This would facilitate automated proofs that, for instance, a recursive call assault is infeasible against a specific contract. Additionally, since why3 (the utility we rely on for substantial processing) has recently been adapted for browsers, we can likely anticipate its availability directly within browser-solidity and other utilities like blockchain explorers!
A preliminary proof of concept accompanied by explanations demonstrates how automated verification can be utilized to confirm that it is impossible to misappropriate funds from a Solidity contract, even if recursive calls are permitted.
This proof of concept is expected to develop into a practical tool in the coming weeks.
Numerous individuals from the community as well as from within the Foundation are presently engaged in developing tools for Solidity or the EVM in general. These encompass:
- Solidity AST analysis for alerts by Dave Hoover (@redsquirrel)
- A Read-Eval-Print variant of Solidity by raineorshine: Solidity-repl
- Control-flow analysis diagram also by raineorshine
- EVM disassembler by Nick Johnson
