canopy

evidence.go - Byzantine Fault Detection and Evidence Handling

This file implements mechanisms for detecting and handling Byzantine behavior in the Canopy blockchain’s consensus protocol. It focuses on identifying validators who violate protocol rules, particularly those who “double sign” by voting for conflicting proposals in the same consensus round.

Overview

The Byzantine evidence system is designed to:

Byzantine behavior detection is critical for blockchain security as it allows the network to identify and penalize validators who attempt to compromise consensus safety.

Core Components

ByzantineEvidence

The central structure that collects evidence of Byzantine behavior during consensus. It primarily contains:

Double signing is a serious violation where a validator signs two different messages for the same consensus view, potentially allowing conflicting blocks to be finalized and breaking blockchain safety.

DoubleSignEvidence

This component represents proof that validators have signed contradictory messages. It contains:

The system can detect double signing when a leader sends a PartialQC (insufficient signatures) that conflicts with a valid QC

Evidence Collection and Processing

The system includes mechanisms for:

Evidence collection happens continuously as nodes observe the network, with special attention to partial quorum certificates and election votes where double signing is most likely to be detected.

Component Interactions

The Byzantine evidence system interacts with several other components:

graph TD
    A[BFT Consensus] --> B[Byzantine Evidence System]
    B --> C[Validator Set]
    B --> D[Block Proposal]
    E[Message Handler] --> B
    B --> F[Slashing Mechanism]
    G[Certificate Store] --> B

Security Mechanisms

The evidence system implements several security features:

  1. Evidence expiration: Old evidence is rejected to prevent replaying ancient violations
  2. Deduplication: Prevents the same evidence from being processed multiple times
  3. Comprehensive validation: Multiple checks ensure evidence is legitimate before penalties are applied
  4. Partial QC tracking: Identifies potential Byzantine behavior even when it doesn’t result in immediate consensus failures
  5. Cross-validation: Ensures that proposed slashing actions match the actual evidence

These mechanisms ensure that only legitimate evidence leads to penalties, protecting honest validators from false accusations while allowing the network to identify and respond to actual Byzantine behavior.