Lessons Learned From Recent Outage of Polygon PoS

Earlier this month, Polygon PoS chain experienced an outage that resulted in a number of valuable lessons. After a thorough examination, the core team is ready to share its findings and explain what is being done to prevent it from happening in the future.

But first, the team would like to acknowledge the disruption this outage has caused to all the users and developers who rely on Polygon. At the same time, it was the support and cooperation from the broader community including ecosystem contributors, validators and infrastructure providers that allowed the team to fix the issue in the shortest time possible. We are building this together, making both the network and the ecosystem supporting it more resilient with each iteration.

What Happened

Polygon PoS chain comprises two main components. Heimdall chain is the tendermint based proof-of-stake verifier layer. And Bor chain is the geth-based block producer layer. 

The Heimdall chain had an issue with the state-sync mechanism. In an attempt to fix it, the sequence of software releases and a second bug resulted in both services going offline. Over the course of several days, the team released multiple updates and worked closely with all the stakeholders in a coordinated rollout of the changes. There was no loss of user funds or data.

For a more technical review of the events, see this forum post. Here is a simplified timeline of the events:

March 10, 4:49 (UTC)  An alert arrives indicating there is an issue with the state-sync mechanism on the Polygon PoS Mainnet.
The team discovers that the Heimdall layer, which handles state-sync communications between bridge contracts on the Ethereum mainnet and Polygon PoS, has a data size check error which allows a large transaction to clog the state-sync mechanism.
March 10, 10:10 (UTC) Heimdall v0.2.6 is pushed out, fixing the size check by reducing the limit from 100kb to 50kb. 
The incremental release caused a state-mismatch between different Heimdall versions which caused the chain to halt, something that could have been avoided with a hard fork.
March 10, 16:20 (UTC) As soon as the team discovered there was an issue that would result in upcoming downtime, the team shared a forum post advising of an impending downtime, alerting users and giving them an hour and a half heads-up.
Bor, the block-producing layer of Polygon PoS, depends on Heimdall to select a committee of producers out of all validators and a set of blocks for which they will do the work, collectively known as spans. Bor also halts as a result.
March 10, 17:50 (UTC) Polygon PoS goes offline.
The team decides to work on a new Heimdall release while also pushing a hotfix for Bor that includes hardcoded spans.
March 10, 22:53 (UTC) Bor v.0.2.14 hotfix is released. 
Block production resumes, but bridges and PolygonScan remain offline.
March 11, 1:30 (UTC) A forum update about the Bor hotfix taking effect.
March 11, 09:20 (UTC) PolygonScan functionality restored.
March 12, 08:07 (UTC) Validators are instructed to upgrade to Heimdall v0.2.7, which includes an overwrite of the 50 hard coded spans and introduces a rollback of Heimdall to a previously working block.
Internal and external RPC nodes come back online.
March 13, 6:58 (UTC) Polygon PoS is stable. Binance is upgrading its nodes to resume deposits and withdrawals.
March 13, 18:15 (UTC) Forum post on bridge operations returning to normal.
March 17, 4:22 (UTC) Validators are instructed to update to Heimdall v0.2.8, a hard fork which will allow the chain to create new spans normally.
Heimdall is updated at block number 8664000.

Future Improvements

This incident provided an opportunity for the team to reflect and find new approaches to challenges, paving the way for Polygon to become a truly battle-tested network. Both the network and the community come out stronger from the experience. Here are the lessons learned and what we are working on to improve: 

  • The team is working on Heimdall to make it more robust by adding dynamic transaction gas limit, increasing the block gas limit and adding bulk state-sync transactions to make the mechanism more robust.
  • In the long term, a redesign of the Heimdall/Bor architecture is in the works that will loosen the tight coupling between the bridge mechanism and the consensus and core system of the chain. This will be implemented in the next version of the chain, tentatively codenamed v3, which will merge the Heimdall and Bor nodes and chain and remove the span mechanism.
  • The team plans to perform more rigorous testing of all code changes going forward, institute internal audits for all releases, and introduce more peer reviews for complex changes and upgrades. There will also be changes to Mumbai testnet to make it a more suitable testing ground.
  • On the communications side, a special team has been assembled to focus on streamlining communication and building a framework to respond to unforeseen incidents more effectively. 
  • The same team is also exploring a status page and social presence that allows people to quickly get a sense of the status of the network. A number of seasoned new hires are also bringing with them expertise in technical contingency management. This will allow us to continuously improve our release and communication processes to help mitigate similar issues in the future.

Last but not least, the team also appreciates our community who always do their part to get the word out and share our updates. Special thanks goes out to Pete Kim at Coinbase and the teams at VitWit and Informal Systems.

Let’s bring the world to Ethereum!

Website | Twitter | Ecosystem Twitter| Developer Twitter | Enterprise Twitter | Studios Twitter | Telegram | Reddit | Discord| Instagram | Facebook | LinkedIn

More from the Polygon Blog
Polygon Reaches First Sustainability Milestone by Achieving Network Carbon Neutrality

Polygon has made a major first step toward becoming carbon negative with the retirement of $400,000 in carbon credits representing 104,794 tonnes of greenhouse gasses, or the entirety of the network’s CO2 debt since inception.  The milestone comes after Polygon in mid-April released its Green Manifesto, part of its broader vision for sustainable development. The […]

Read More
State of Governance #2: Identity & Reputation

Clink Clank For a period of time, democracy in ancient Athens was exercised in a peculiar way.* Every eligible voter, when entering the hall, would receive a single pebble to be cast in one of two urns during assembly, signifying approval or disapproval on an issue. Athenians, understanding the significance of votes being cast anonymously, […]

Read More
Accelerating the Energy Transition With Reneum on Polygon

Given the urgency of the climate crisis, it may come as a surprise that the fossil fuel industry receives about half a trillion dollars a year in government subsidies. The truly shocking part is that renewable energy alternatives get less than a third of that. Reneum is trying to right the imbalance by using blockchain […]

Read More
Polygon Funds Web3 Development With $100,000 Pledge to Gitcoin Grants Round 14 

Polygon is donating $100,000 to Gitcoin Grants Round 14 to ramp up the on-going support for new projects building on the Polygon ecosystem. The core team has already pledged $1 million to Gitcoin over five quarterly grants until December 2022 in order to help and encourage the growth of Web3. Who is eligible Applications for […]

Read More
Why Neobanks Will Lead TradFi’s Shift to Web3

Conventional wisdom has it that traditional finance (TradFi) and decentralized finance (DeFi) go together like vampires and garlic. But there is one area of TradFi where that black-and-white picture shades into gray. This is the case for why neobanks will be key to bridging these two worlds. Neobanks, or digital banks, are basically banks without […]

Read More
crossmenuchevron-down-circle