Breaking Down the Cosmos Game of Stakes

Decentralized proof-of-stake-based BFT network with adversarial conditions

Staked
Staked
Feb 5, 2019 · 5 min read

Key Takeaways

  • Game of Stakes is running a fully distributed testnet to subject Tendermint software to possible mainnet issues.
  • The chain halted four times and a variety of issues were addressed and fixed, including critical Tendermint Core and Cosmos SDK bugs.
  • A cartel formed (cynically, was planted) and was forked out, as Certus One coordinated an off-chain community fork to remove the validator cartel from version 5 of the GoS network.
  • Cosmos mainnet is expected to launch in late February / early March.
  • Staked will support Cosmos at mainnet launch and is available for delegation.

Overview

Cosmos is planning to launch the first public proof-of-stake (PoS) blockchain based on a byzantine fault tolerant (BFT) consensus mechanism (Tendermint). The Cosmos Game of Stakes (GoS) is the first implementation of a decentralized BFT-network with ~ 195 globally distributed validators, incentivized adversarial conditions and slashing penalties.

State of Play

Rewards (block rewards and transactions fees) in Cosmos are distributed automatically at the protocol level. However, validators are unable to auto-bond these rewards, requiring separate transactions to both withdraw and then re-delegate them. Due to the manual re-bonding requirements and incentive dynamics of GoS, the validators who were first to develop a withdrawal and re-delegation process were able to establish an early lead in accumulating stake and voting power. And while scripts can be used to automate the re-bonding process in GoS, they introduce potential security risks for mainnet operation. According to the Cosmos team, the new F1 fee distribution proposal addresses a variety of fee distribution improvements for mainnet operation.

Consensus Failures / Chain Halts

  • Pre-GoS Launch Liveness Failure: Github. On 12/11/18, the Genki 3000 testnet experienced a liveness failure after a validator proposed an invalid block because they were running an incorrect version of the Cosmos SDK. The invalid block caused all the validators to freeze and prevented the next round from starting.
  • Fee Distribution Logic + Block Size Limit: Github. On 12/19/18, at block height 11443, the GoS chain was halted due to a consensus failure by a bug in the un-bonding and fee distribution logic of the Cosmos SDK. Additionally, the chain was experiencing performance issues because of the block size limit. The initial block size of 50kb was being consumed by the signatures of 199 validators, making it difficult for validators to claim and delegate rewards. As a result, the network was upgraded with an increase in the block size and relaunched.
  • Double Sign / Export Logic: Github. On 12/21/18, the GoS chain v2.0 experienced a chain halt due to a state inconsistency after a validator double signed a block and the slashing periods had been deleted in the export logic. At genesis, the chain is expected to create a slashing period for each validator. This failed to happen, causing the chain to halt when the double sign was committed and the slashing periods were missing. As a result, GoS was suspended for the holidays until restarting on 01/03/19.
  • Pre-Vote Failure: On 01/04/19, the GoS chain v3.0 halted just prior to reaching 10k blocks after a subset of validators failed to pre-vote and a large percentage of the validators were knocked offline.

Critical Bugs

  • Token Printing Bug: Github.
  • Gas Bug. A bug in the Cosmos SDK resulted in transactions consuming excessive amounts of gas and failing. The bug was limiting the network to ~ 7 withdrawal + delegation transactions per block and required a software upgrade to fix.
  • Simulation Code: On 01/22/19, the Cosmos team discovered a bug in the simulation code that uncovered a variety of previously undetected errors in the software. It was determined that the simulation had not been functioning correctly for the past 18 days. As a result, new testnet releases were suspended until the bugs were resolved.
  • Vesting Errors: A bug in the reward vesting logic caused transactions with fees to fail and required a consensus breaking update to fix.

About Staked

Staked operates highly available and highly secure, institutional grade staking infrastructure for leading proof-of-stake (PoS) protocols. The Staked infrastructure is deployed in a multi-tier signing and listening cloud configuration that combines geographic diversity and redundancy across on-premise data centers and cloud providers. We use Google’s Kubernetes container orchestration to achieve near-infinite scale, self-healing and hardware decentralization.

Coinmonks

Coinmonks is a non-profit Crypto educational publication.