The DAO soft-fork try used to be tricky. No longer most effective did it end up that we underestimated the negative effects at the consensus protocol (i.e. DoS vulnerability), however we additionally controlled to introduce a knowledge race into the rushed implementation that used to be a ticking time bomb. It used to be now not best, and even supposing avoided on the remaining example, the short coming near hard-fork closing date regarded eerily bleak to mention the least. We wanted a brand new technique…

The stepping stone against this used to be an concept borrowed from Google (courtesy of Nick Johnson): writing up an in depth postmortem of the development, aiming to evaluate the foundation reasons of the problem, focusing only at the technical sides and suitable measures to stop recurrence.

Technical answers scale and persist; blaming other people does now not. ~ Nick

From the postmortem, one attention-grabbing discovery from the viewpoint of this weblog submit used to be made. The soft-fork code within [go-ethereum]( appeared forged from all views: a) it used to be completely coated through unit checks with a three:1 test-to-code ratio; b) it used to be completely reviewed through six basis builders; and c) it used to be even manually are living examined on a non-public community… But nonetheless, a deadly records race remained, which will have probably brought about serious community disruption.

It transpired that the flaw may just most effective ever happen in a community consisting of a couple of nodes, a couple of miners and a couple of blocks being minted concurrently. Despite the fact that all of the ones situations held true, there used to be just a slight likelihood for the worm to floor. Unit checks can not catch it, code reviewers would possibly or won’t catch it, and guide checking out catching it will be not likely. Our conclusion used to be that the improvement groups wanted extra gear to accomplish reproducible checks that will duvet the intricate interaction of a couple of nodes in a concurrent networked situation. With out the sort of instrument, manually checking the quite a lot of edge instances is unwieldy; and with out doing those exams regularly as a part of the improvement workflow, uncommon mistakes would grow to be not possible to find in time.

And thus, hive used to be born…

What’s hive?

Ethereum grew huge to the purpose the place checking out implementations become an enormous burden. Unit checks are fantastic for checking quite a lot of implementation quirks, however validating {that a} Jstomer conforms to a couple baseline high quality, or validating that shoppers can play well in combination in a multi Jstomer atmosphere, is all however easy.

Hive is supposed to function an simply expandable examine harness the place any person can upload checks (be the ones easy validations or community simulations) in any programming language that they’re happy with, and hive will have to concurrently be capable to run the ones checks towards all doable shoppers. As such, the harness is supposed to do black field checking out the place no Jstomer explicit inside main points/state may also be examined and/or inspected, slightly emphasis could be placed on adherence to authentic specifications or behaviors underneath other cases.

Most significantly, hive used to be designed from the bottom as much as run as a part of any shoppers’ CI workflow!

How does hive paintings?

Hive’s frame and soul is [docker]( Each and every Jstomer implementation is a docker symbol; each and every validation suite is a docker symbol; and each and every community simulation is a docker symbol. Hive itself is an all encompassing docker symbol. This can be a very tough abstraction…

Since Ethereum shoppers are docker pictures in hive, builders of the shoppers can collect the most productive conceivable atmosphere for his or her shoppers to run in (dependency, tooling and configuration smart). Hive will spin up as many cases as wanted, they all operating in their very own Linux techniques.

In a similar way, as examine suites validating Ethereum shoppers are docker pictures, the creator of the checks can use any programing atmosphere he’s maximum conversant in. Hive will be certain that a consumer is operating when it begins the tester, which will then validate if the specific Jstomer conforms to a couple desired conduct.

Finally, community simulations are once more outlined through docker pictures, however in comparison to easy checks, simulators now not most effective execute code towards a operating Jstomer, however can in fact get started and terminate shoppers at will. Those shoppers run in the similar digital community and will freely (or as dictated through the simulator container) attach to one another, forming an on-demand personal Ethereum community.

How did hive support the fork?

Hive is neither a alternative for unit checking out nor for thorough reviewing. All present hired practices are very important to get a blank implementation of any function. Hive may give validation past what is possible from a median developer’s viewpoint: operating intensive checks that may require complicated execution environments; and checking networking nook instances that may take hours to arrange.

With regards to the DAO hard-fork, past all of the consensus and unit checks, we wanted to make sure most significantly that nodes partition cleanly into two subsets on the networking degree: one supporting and one opposing the fork. This used to be very important since it is not possible to are expecting what antagonistic results operating two competing chains in a single community may have, particularly from the minority’s viewpoint.

As such we’ve got applied 3 explicit community simulations in hive:

  • The primary to test that miners operating the whole Ethash DAGs generate proper block extra-data fields for each pro-forkers and no-forkers, even if looking to naively spoof.

  • The second one to make sure {that a} community consisting of combined pro-fork and no-fork nodes/miners accurately splits into two when the fork block arrives, additionally keeping up the break up afterwards.

  • The 3rd to test that given an already forked community, newly becoming a member of nodes can sync, speedy sync and lightweight sync to the chain in their selection.

The attention-grabbing query although is: did hive in fact catch any mistakes, or did is simply act as an additional affirmation that the entirety’s all proper? And the solution is, each. Hive stuck 3 fork-unrelated insects in Geth, however additionally closely aided Geth’s hard-fork construction through regularly offering comments on how adjustments affected community conduct.

There used to be some grievance of the go-ethereum crew for taking their time at the hard-fork implementation. Optimistically other people will now see what we have been as much as, whilst at the same time as imposing the fork itself. All in all, I imagine hive grew to become out to play slightly crucial function within the cleanness of this transition.

What’s hive’s long run?

The Ethereum GitHub group options [4 test tools already](, with a minimum of one EVM benchmark instrument cooking in some exterior repository. They don’t seem to be being utilised to their complete extent. They have got a ton of dependencies, generate a ton of junk and are very difficult to make use of.

With hive, we are aiming to mixture all of the quite a lot of scattered checks underneath one common Jstomer validator that has minimum dependencies, may also be prolonged through any person, and will run as a part of the day-to-day CI workflow of Jstomer builders.

We welcome any person to contribute to the undertaking, be that including new shoppers to validate, validators to check with, or simulators to seek out attention-grabbing networking problems. Within the intervening time, we will attempt to additional polish hive itself, including toughen for operating benchmarks in addition to mixed-client simulations.

With a little or paintings, possibly we will also have toughen for operating hive within the cloud, permitting it to run community simulations at a a lot more attention-grabbing scale.


Please enter your comment!
Please enter your name here