Ethereum

C++ DEV Update – July version

Since the last C++ DEV update, a lot of things have happened in the engine room that are not visible to the outside. This post aims to provide an overview of what we are currently working on.

Beyond the functionality aspect, as I’ve mentioned a few times over the last month or two, Bob is working on a proposed process for relicensing the C++ runtime client code to Apache 2.0. Expect more news on this soon.

Eth unit test mode

Not only is it essential to perform Solidity end-to-end testing via IPC, but Dimitry Khoklov and others have added several new RPC endpoints to the eth client that allow for much more flexibility in testing smart contracts. If you use eth –test -d /tmp/test and connect to the ipc port in /tmp/test/geth.ipc (recommended) Ethereum Console We’ve already added these features, so you can:

  • Changing blockchain parameters (e.g. removing proof-of-work verification and pre-funding specific accounts)
  • It mines a certain amount of blocks (about 30 blocks per second).
  • Modifies the timestamp of the current block (e.g. to test a contract for timeouts).
  • Returns the blockchain to the given block number.

This allows current 305 Solidity end-to-end tests to run on a typical computer in approximately 46 seconds. Each of these tests involves at least two (often more) transactions and the same amount of mined blocks.

More information about these features can be found here: https://github.com/ethereum/ethereum-console.

This is currently only available for binaries available through: Ubuntu Developer PPA.

Speed ​​up virtual machines

Greg Colvin has spent the last few months speeding up the C++ implementation of the EVM interpreter. He harvested what he called low-hanging fruit (he previously worked as a Java interpreter at Oracle…). The most significant improvement so far is replacing the 256-bit calculation for gas metering with a 64-bit calculation and ensuring that no more metering calculations are performed than necessary for each VM operation. These and other changes resulted in the early stages of Paweł Bylica. Benchmark Suite. The following chart shows the speedup compared to the previous cpp Ethereum interpreter (cpp int (old)).

Increased relative speed

To be fair, we should say what these benchmarks measure. The first benchmark (where evmjit is off-scale with a 472x speedup) does a million empty loops and shows how slow the EVM’s computed goto is compared to the JIT’s direct jump that modifies the next item in the stack. The second benchmark is a bad random number generator that performs one million loops with 4 multiplications and 4 additions per loop. Since 256-bit computation dominates, JIT makes little difference. (Go JIT does not compile to native code, but to an interpreted representation, which is faster.)

actuallyThis speed improvement is Only This is relevant to the “number crunching” contract because computation time is heavily dependent on storage access. On the other hand, the “rng” benchmark is very similar to cryptographic work, which brings these things into the realm of real-world on-chain implementations.

Paweł Bylica is working on: C language interface It provides a bridge between virtual machine implementations and the clients that host them, with the goal of being able to connect different VMs to Ethereum clients. In this way, geth can also potentially benefit from changes to the C++ virtual machine, especially changes to the LLVM just-in-time (JIT) compiler.

These changes haven’t been released yet, but Ubuntu Developer PPA.

remix

Yann Levreau and Liana Husikyan are working on a new EVM debugger remix. We released the alpha version a few days ago.

application – guideline

For now, you can use it to inspect every single step of the execution of a transaction on a blockchain, check the current stack, memory and storage contents, and check the order of instructions. The next step is to also allow source-level debugging, where you can see where you are in the source code, see what steps you took at the line or instruction level, and see the decoded values ​​of variables (instead of just seeing the raw hexadecimal values).

The debugger is for the community. I was happy to hear that Etherscan has already integrated Remix into their community. Blockchain Explorer.

Repository reconfiguration

Bob Summerwill is committed to returning C++-Ethereum to its previous home at https://github.com/ethereum/cpp-ethereum, eliminating unnecessary and confusing splitting into multiple subrepositories. We’re making great progress there. One of the first steps that really stood out was decoupling Solidity’s testing infrastructure from the virtual machine implementation. Solidity tests can now be compiled without a virtual machine and run by communicating with a specially configured eth process (the one mentioned above) via a generic IPC interface.

The next step is to unpack the remaining code, modify the test automation and continuous integration accordingly, and make the actual move.

With this step we unfortunately Say goodbye to Mix and AlethZero (The spirit of the mix will continue in the new remix project). The burden they are pulling will be too great, as it involves tight coupling with Qt and Solidity. As I’ve already explained in previous posts, loosely coupling these tools to small client implementations allows us much more flexibility, and the community support that comes with changes to JavaScript and web-based tools like remix and browser robustness is simply overwhelming in comparison.

formal verification

We are extending our existing formal verification tools integrated with Solidity to include cross-contract calls. This allows automatic proof that a recursive call attack is impossible for a specific contract. Also, since Why3 (the tool we use to do the heavy lifting) was recently ported to browserWe can probably expect it to be available right away within browser robustness and other tools like blockchain explorers!

There is a first proof of concept Includes an explanation showing how automatic verification can be used to show that it is impossible to steal money from a robustness contract even if recursive calls are allowed.

This proof of concept will evolve into a usable tool in the coming weeks.

Several people within the community and foundation are currently developing tools for Solidity or EVM in general. These include:

  1. Solidity AST analysis of warnings by Dave Hoover (@redsquirrel)
  2. Raineorshine’s Solidity Read-Evaluate-Print version: Solidity-repl
  3. Control flow analysis graph This is also raineorshine’s work.
  4. EVM Disassembler Nick Johnson

Related Articles

Back to top button