Date
Author
Yaz Khoury
Infrastructure
Dissecting the Donut Hardfork
What the Donut Hardfork is, what a hardfork means in general, and how network upgrades play out on a Proof-of-Stake network like Celo.

Reading time
7 minutes
Share
Now that the Celo community is a few weeks away from the activation of the Donut Hardfork, it felt like the right time to start a post on what the Donut Hardfork is, what a hardfork is in general, and how hardforks play out on a Proof-of-Stake network like Celo.
If you are a node operator on Celo, please follow the instructions to upgrade to Donut Hardfork in the forum post to v1.3.2 prior to the activation date of May 19th, 2021. Release notes for v1.3.2 are found on GitHub.
“But sir, what is a hardfork and what does Donut do for the Celo network?”
Read on, dear readers! We will go over what a hardfork is, why coordination is important in decentralized ecosystems, and what bag of goodies will be included in Donut Hardfork for Celo.
What is a Hardfork?
Hardforks in the past have led to lots of confusion by network stakeholders given the large coordination efforts needed to make them successful.
Hardforks fall into two camps: contentious and non-contentious.
Contentious hardforks are common in Proof-of-Work networks, with the DAO fork resulting in Ethereum and Ethereum Classic, and the Bitcoin Block Size Wars resulting in the birth of Bitcoin Cash as a fork of Bitcoin.
Hardforks, more importantly, can also be non-contentious, and really just a way of saying “Network Upgrades.” In these hardforks, it’s how networks like Ethereum and Celo can activate new features on the blockchain. EIP-1559 will activate in Ethereum’s London Hardfork. Celo’s Donut Hardfork will activate a lot of features that are covered in the next section.

Before we go into what a hardfork is in blockchain networks, let’s take a look at how changes like feature additions, bug fixes, and upgrades happen in regular software. In regular software, upgrades happen asynchronously by the user and don’t require a lot of coordination from the developers. Think of that time you upgraded your Spotify app on the App Store. It didn’t require you to coordinate with the Spotify developers in order to do it.
For distributed systems like blockchain networks that require node operators (those who run the blockchain client to sync up with the blockchain’s ledger history), coordination is vital — because you and the other nodes in the network need to agree on the state of the network.
Using the Spotify example: imagine when you download the Spotify app, you are downloading the entire history of the Spotify music database. Everyone who is running a node would have an entire copy of the Spotify music database (in the case of this example), so every node must agree on the database state. Now, let’s say one of the nodes decides to add a new music track to the database. This must be replicated to all the other nodes in order to agree on it and add it to their copy of the database. This is generally how blockchains work with ledgers and transactions sending money between users Alice and Bob.
How Are Blockchain Software Features Added?
Now, what if we want to modify the software of a blockchain network? What if we want to add new features to it? Unfortunately, we can’t just have nodes upgrading their clients right away to activate those features, given the large coordination problem in blockchains. The reason is because if some users upgrade their node before others do, they might have a different state of changes that other nodes (who haven’t upgraded) don’t necessarily agree on.
Returning to the Spotify example again, imagine Spotify released some video features to its application. You download the new version of the app with that feature, and your friend hasn’t. Now imagine you wanted to send your friend a video link from Spotify. Because they haven’t upgraded yet, they will get an error if they open that link (their older software is inconsistent with the newer Spotify version).

This disagreement on state when caused by premature activation will cause network splits in Proof-of-Work networks, where you end up with two different chains, each agreeing on a different state of the network. This is essentially what makes a “fork.” The network-split feature luckily doesn’t exist in Proof-of-Stake networks like Celo, but it’s important to minimize any disruption as a result of clients adding features ahead of others. Furthermore, while Celo is EVM-based like Ethereum, hardforks aren’t the only way features get activated on Celo. Celo also includes on-chain governance which allows network participants to vote on proposals on-chain every 6–8 weeks. We will cover on-chain governance in a future post.
How Do We Avoid The Impact of Consensus Failure?
So how do we avoid the impact of some clients having a different state than others when they upgrade? We schedule the upgrade to occur at a specific block number in the future, say 30–60 days after the release of the new client software upgrade. In this approach, the core developers release the blockchain client software and ask every node operator to upgrade to that new version. But because the activation of those features happen far in the future (30–60 days), the clients upgrading right away won’t cause an inconsistent state change among the nodes in the network and break consensus.
This way, we can coordinate with all nodes in the network to upgrade to the hardfork-enabled software version, and give them a bit of time to plan their upgrade process prior to the hardfork. As long as a majority of the nodes in the network upgrade ahead of the hardfork, the network can safely upgrade and activate the hardfork when the block number approaches later. For the Celo network, as long as a quorum of the validators upgrade ahead (67 validators is the quorum out of 100), the Donut Hardfork will activate smoothly. This is different from Proof-of-Work hardforks that don’t have a definition of quorum, but define things via majority and minority chains. For the purpose of this post, we won’t go too deeply into PoW hardforks but will instead just focus on Celo and Proof-of-Stake.

With coordination for a hardfork like Celo’s Donut done prior to the activation date, this will allow us to anticipate when the network upgrade will happen since it is scoped out by the block number. In Donut, we know that the hardfork will activate on May 19th around 2 PM EDT because we assigned a block number of 6774000. This is because Celo blocks are a constant of 5 seconds per block, which would allow us to predict at what time in the day the hardfork will happen. This is different from PoW chains where block time can vary with difficulty changes in mining.
So in this example for Celo’s Donut Hardfork, a hardfork is just another way of saying “Network Upgrade.” It’s just that this network upgrade requires heavy coordination from the network participants, like any other hardfork would.
What is happening in Donut?
So now that we went over what a hardfork is, let’s explore what’s in store for us with Celo’s Donut Hardfork. The Donut Hardfork specification is in CIP-27 but we will go over some of the proposals added in this post.
The first really awesome CIP is CIP-20, written by James Prestwich, which adds an extensible precompile that will provide access to many hash functions on the EVM, including SHA3, SHA2–512, Keccak-512, and Blake2s. In simpler terms, this means adding a precompile that allows hashing functions like SHA3 and others to be available in a much cheaper way that was previously unavailable for Solidity developers. It also allows for inclusion of new hash functions in the precompile and will help with the Plumo project, by providing the ability to slash validators according to the SNARK-friendly Plumo messages encoded in epoch blocks.
CIP-25 is a cool proposal by the Chorus One team and is a rework of EIP-665, adding a precompile for cheaply verifying Ed25519 signatures in smart contracts. This will make interoperability much easier with other layer-1 projects like Cosmos, NEAR, and Solana.
CIP-30 and CIP-31 are based on EIP-2547 and EIP-2539, adding 16 precompiles for BLS 12–381 and 12–377 signatures. These CIPs would allow verifying high-security and broadly accepted BLS signatures and pairing-based Zero-knowledge proofs (Groth16, PLONK, Marlin, etc.), such as signatures and proofs used on Celo, the Plumo project and ETH2, among other things.
CIP-35, which is highly anticipated by the Celo community, will allow full compatibility with Ethereum tooling and wallets. This means that MetaMask will be able to work seamlessly with Celo applications because Celo will allow for both Celo transaction formats and Ethereum ones. In the past, Celo transaction formats added 3 new fields which made them incompatible with other Ethereum and EVM-based ones. CIP-35 will enable Ethereum-based transaction formats.

We also have other exciting changes added to Celo in Donut, like CIP-21 for Governable Lookback Window and CIP-28 to split the etherbase, helpful changes for Validators running on the network, CIP-22 for Epoch Snark Data for the Plumo ultra-light client protocol, and CIP-26, which adds a precompile for getting the BLS public key. Read an overview of the entire Donut specification in CIP-27.
Donut is the first of many hardforks that will be planned for Celo, and the first hardfork of the new generation layer-1 Proof-of-Stake networks such as NEAR, Solana, and Polkadot. We are very excited for this new milestone.
If you are a node operator on Celo, please follow instructions to upgrade to Donut Hardfork in this forum post to v1.3.2.
#DonutIsComing
Infrastructure
Interoperability
Milestones and Recaps
Latest


