{"id":22197,"date":"2026-08-01T02:05:11","date_gmt":"2026-08-01T02:05:11","guid":{"rendered":"https:\/\/cryptoted.net\/index.php\/2026\/08\/01\/hive-how-we-strived-for-a-clean-fork\/"},"modified":"2026-08-01T02:05:11","modified_gmt":"2026-08-01T02:05:11","slug":"hive-how-we-strived-for-a-clean-fork","status":"publish","type":"post","link":"https:\/\/cryptoted.net\/index.php\/2026\/08\/01\/hive-how-we-strived-for-a-clean-fork\/","title":{"rendered":"Hive: How we strived for a clean fork"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"\">\n<p class=\"chakra-text css-gi02ar\">The DAO soft-fork attempt was difficult. Not only did it turn out that we underestimated the side effects on the consensus protocol (i.e. DoS vulnerability), but we also managed to introduce a data race into the rushed implementation that was a ticking time bomb. It was not ideal, and even though averted at the last instance, the fast approaching hard-fork deadline looked eerily bleak to say the least.\u00a0We\u00a0needed\u00a0a new strategy&#8230;<\/p>\n<p class=\"chakra-text css-gi02ar\">The stepping stone towards this was\u00a0an idea borrowed from Google (courtesy of Nick Johnson):\u00a0writing up a detailed <em class=\"chakra-text css-0\">postmortem<\/em>\u00a0of the event,\u00a0aiming to assess the root causes of the issue,\u00a0focusing solely on the technical aspects and appropriate measures to prevent recurrence.<\/p>\n<blockquote class=\"chakra-code css-gk0tva\"><p><i><span style=\"font-weight:400\">Technical solutions scale and persist; blaming people does not. ~ Nick<\/span><\/i><\/p><\/blockquote>\n<p>From the postmortem,\u00a0one interesting discovery from the perspective of this blog post was made. The soft-fork code inside [go-ethereum](https:\/\/github.com\/ethereum\/go-ethereum)\u00a0seemed solid from all perspectives: a) it was thoroughly covered by unit tests with a 3:1 test-to-code ratio; b) it was thoroughly reviewed by six\u00a0foundation developers; and c) it was even manually live tested on a private network&#8230; Yet still, a fatal data race remained, which could have potentially caused severe network disruption.<\/p>\n<p class=\"chakra-text css-gi02ar\">It transpired that the flaw could\u00a0only ever occur in a network consisting of multiple nodes, multiple miners and multiple blocks being minted simultaneously. Even if all of those scenarios held true, there was only a slight chance for the bug to surface. Unit tests cannot catch it, code reviewers\u00a0may or may not catch it, and manual testing catching it would be\u00a0unlikely. Our conclusion was\u00a0that the development teams\u00a0needed more\u00a0tools to perform reproducible tests that would cover the intricate interplay of multiple nodes in a concurrent networked scenario. Without such a tool, manually checking the various edge cases is unwieldy; and without doing these checks continuously as part of the development workflow, rare errors would become impossible to discover in\u00a0time.<\/p>\n<p class=\"chakra-text css-gi02ar\">And thus, <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive\">hive<\/a> was born&#8230;<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"what-is-hive\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"what is hive permalink\" href=\"#what-is-hive\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>What is hive?<\/h2>\n<p>Ethereum grew large to the point where\u00a0testing implementations became\u00a0a huge burden. Unit tests are fine for checking various implementation quirks, but validating that a client conforms to some baseline quality, or validating that clients can play nicely together in a multi client environment, is all but simple.<\/p>\n<p class=\"chakra-text css-gi02ar\"><a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive\">Hive<\/a> is meant to serve as an easily expandable test harness where <strong>anyone<\/strong> can add tests (be those simple validations or network simulations) in <strong>any<\/strong> programming language that they are comfortable with, and hive\u00a0should simultaneously be able to run those tests against <strong>all<\/strong> potential clients. As such, the harness is meant to do black box testing where no client specific internal details\/state can be tested and\/or inspected, rather emphasis would be\u00a0put on adherence to official specs or behaviors under different circumstances.<\/p>\n<p class=\"chakra-text css-gi02ar\"><em class=\"chakra-text css-0\">Most importantly, hive was designed from the ground up to run\u00a0as part of any clients&#8217; CI workflow!<\/em><\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"how-does-hive-work\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"how does hive work permalink\" href=\"#how-does-hive-work\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>How does hive work?<\/h2>\n<p>Hive&#8217;s body and soul\u00a0is [docker](https:\/\/www.docker.com\/). Every client implementation is a docker image;\u00a0every validation\u00a0suite\u00a0is a docker image; and\u00a0every network\u00a0simulation\u00a0is a docker image. Hive itself is an all encompassing docker image. This is a very powerful abstraction&#8230;<\/p>\n<p class=\"chakra-text css-gi02ar\">Since <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive#adding-new-clients\">Ethereum clients<\/a> are\u00a0docker images in hive, developers of the clients can assemble the best possible environment for their clients to run in (dependency, tooling and configuration wise). Hive will\u00a0spin up as\u00a0many instances as needed, all of them running in their own Linux systems.<\/p>\n<p class=\"chakra-text css-gi02ar\">Similarly, as <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive#adding-new-validators\">test suites<\/a> validating Ethereum\u00a0clients are\u00a0docker images, the writer of the tests can\u00a0use any\u00a0programing environment he is most familiar with. Hive will ensure a client is running when it starts the tester, which can then validate if\u00a0the particular client conforms to some\u00a0desired behavior.<\/p>\n<p class=\"chakra-text css-gi02ar\">Lastly, <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive#adding-new-simulators\">network simulations<\/a> are\u00a0yet again defined by docker images, but compared to simple tests, simulators not only execute\u00a0code against a running client, but can actually start and terminate clients at will. These clients run in the same virtual network and can freely (or as dictated by the simulator container) connect to each other, forming an on-demand private Ethereum network.<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"how-did-hive-aidthe-fork\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"how did hive aidthe fork permalink\" href=\"#how-did-hive-aidthe-fork\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>How did hive aid\u00a0the fork?<\/h2>\n<p>Hive is neither a\u00a0replacement for unit testing nor for thorough reviewing. All current employed practices are essential to get a clean\u00a0implementation of any feature. Hive can provide validation beyond what&#8217;s feasible from an average developer&#8217;s perspective:\u00a0running\u00a0extensive tests that can require complex execution\u00a0environments; and checking networking corner cases that can take hours to set up.<\/p>\n<p class=\"chakra-text css-gi02ar\">In the case of the DAO hard-fork,\u00a0beyond all the consensus and unit tests, we needed to ensure most importantly that nodes\u00a0partition cleanly into two subsets at the networking level: one supporting and one opposing the fork. This was essential since it&#8217;s impossible to predict what\u00a0adverse effects running two competing chains in one network might have, especially from the minority&#8217;s perspective.<\/p>\n<p class=\"chakra-text css-gi02ar\">As such we&#8217;ve implemented three specific network simulations in hive:<\/p>\n<ul role=\"list\" class=\"css-1ars4k6\">\n<li class=\"css-0\">\n<p class=\"chakra-text css-gi02ar\"><a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive\/tree\/master\/simulators\/dao-hard-fork\/extradata\">The first<\/a> to check that miners running the full Ethash DAGs generate correct block extra-data fields for both pro-forkers and no-forkers, even when trying to naively spoof.<\/p>\n<\/li>\n<li class=\"css-0\">\n<p class=\"chakra-text css-gi02ar\"><a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive\/tree\/master\/simulators\/dao-hard-fork\/network-split\">The second<\/a> to verify that a network consisting of mixed pro-fork and no-fork nodes\/miners correctly splits into two when the fork block arrives, also maintaining the split afterwards.<\/p>\n<\/li>\n<li class=\"css-0\">\n<p class=\"chakra-text css-gi02ar\"><a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive\/tree\/master\/simulators\/dao-hard-fork\/synchronisation\">The third<\/a> to check that given an already forked network, newly joining nodes can sync, fast sync and light sync to the\u00a0chain of their choice.<\/p>\n<\/li>\n<\/ul>\n<p class=\"chakra-text css-gi02ar\">The interesting question though is: did hive actually catch any errors, or did is just act as an extra confirmation that everything&#8217;s all right? And the\u00a0answer is, <em class=\"chakra-text css-0\">both<\/em>. Hive caught <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive#trophies\">three fork-unrelated bugs<\/a> in Geth, but\u00a0also heavily aided Geth&#8217;s hard-fork development\u00a0by continuously providing feedback on how changes affected network behavior.<\/p>\n<p class=\"chakra-text css-gi02ar\">There was some criticism of\u00a0the\u00a0go-ethereum team for taking their time\u00a0on the hard-fork implementation. Hopefully people will\u00a0now see what we were up to, while concurrently\u00a0implementing the fork itself. All in all, I believe <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/karalabe\/hive\">hive<\/a> turned out to play quite an important role in the cleanness of this\u00a0transition.<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"what-is-hives-future\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"what is hives future permalink\" href=\"#what-is-hives-future\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>What is hive&#8217;s future?<\/h2>\n<p>The Ethereum GitHub organization features [4 test tools already](https:\/\/github.com\/ethereum?utf8=%E2%9C%93&amp;query=test), with at least one EVM benchmark tool cooking in some external\u00a0repository. They are not being utilised to their full extent. They have a ton of dependencies, generate a ton of junk and are very complicated to use.<\/p>\n<p class=\"chakra-text css-gi02ar\">With hive, we&#8217;re aiming to aggregate all the various scattered tests under one <em class=\"chakra-text css-0\">universal client validator<\/em> that has minimal dependencies, can be extended by anyone, and can run as part of the daily\u00a0CI workflow of client developers.<\/p>\n<p class=\"chakra-text css-gi02ar\">We welcome anyone to make contributions to the project, be that adding new clients to validate, validators to test with, or simulators to find interesting networking issues. In the meantime, we&#8217;ll try to further polish hive itself, adding support for running benchmarks as well as mixed-client simulations.<\/p>\n<p class=\"chakra-text css-gi02ar\">With a bit or work, maybe we&#8217;ll even have support for running hive in the cloud, allowing it to run network simulations at a much more interesting scale.<\/p>\n<\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/blog.ethereum.org\/en\/2016\/07\/22\/hive-strived-clean-fork\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The DAO soft-fork attempt was difficult. Not only did it turn out that we underestimated the side effects on the consensus protocol (i.e. DoS vulnerability), but we also managed to introduce a data race into the rushed implementation that was a ticking time bomb. It was not ideal, and even though averted at the last [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":21285,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"tdm_status":"","tdm_grid_status":"","footnotes":""},"categories":[24],"tags":[],"kronos_expire_date":[],"class_list":["post-22197","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ethereum"],"_links":{"self":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts\/22197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/comments?post=22197"}],"version-history":[{"count":0,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts\/22197\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/media\/21285"}],"wp:attachment":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/media?parent=22197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/categories?post=22197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/tags?post=22197"},{"taxonomy":"kronos_expire_date","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/kronos_expire_date?post=22197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}