|
| 1 | +# ADR 013: Commonware Aggregation for Fast Consensus Sync |
| 2 | + |
| 3 | +## Changelog |
| 4 | + |
| 5 | +* 2026-02-01: Initial draft |
| 6 | + |
| 7 | +## Status |
| 8 | + |
| 9 | +PROPOSED Not Implemented |
| 10 | + |
| 11 | +## Abstract |
| 12 | + |
| 13 | +Adopt Commonware Aggregation to generate State Root Certificates for O(1) consensus sync. Reduces sync time from ~20 minutes to ~2.5 minutes for 2,300 blocks. |
| 14 | + |
| 15 | +## Context |
| 16 | + |
| 17 | +Current consensus sync validates blocks sequentially (~500ms × 2,300 blocks = ~20 min). The bottleneck is per-block cryptographic verification. Snap sync downloads state efficiently but lacks a trust anchor without full block validation. |
| 18 | + |
| 19 | +## Alternatives |
| 20 | + |
| 21 | +| Alternative | Pros | Cons | |
| 22 | +|-------------|------|------| |
| 23 | +| Parallel validation | No dependencies | O(n), limited by sequential state | |
| 24 | +| Hardcoded checkpoints | Simple | Centralized, stale between releases | |
| 25 | +| Light client proofs | Trustless | Complex, high bandwidth | |
| 26 | +| **Aggregation** | **O(1), consensus-agnostic** | **New dependency** | |
| 27 | + |
| 28 | +## Decision |
| 29 | + |
| 30 | +Adopt Commonware Aggregation to create quorum certificates over state roots. |
| 31 | + |
| 32 | +### Core Mechanism |
| 33 | + |
| 34 | +```rust |
| 35 | +// Validators sign state roots after each block |
| 36 | +struct Item { height: u64, payload: B256 } // state root |
| 37 | +struct Certificate { item: Item, signers: BitVec, signature: Signature } |
| 38 | +``` |
| 39 | + |
| 40 | +### Sync Flow |
| 41 | + |
| 42 | +| Current | With Aggregation | |
| 43 | +|---------|------------------| |
| 44 | +| Validate 2,300 blocks sequentially | Verify single certificate | |
| 45 | +| ~20 minutes | ~2.5 minutes | |
| 46 | + |
| 47 | +### Implementation |
| 48 | + |
| 49 | +1. **Broadcast**: After block finalization, broadcast state root |
| 50 | +2. **Acknowledge**: Validators sign and return acks |
| 51 | +3. **Aggregate**: Engine produces certificate at 2/3+ quorum |
| 52 | +4. **Sync**: New nodes verify certificate, then snap sync state |
| 53 | + |
| 54 | +### Consensus Agnosticism |
| 55 | + |
| 56 | +Aggregation only requires validator set + BLS keys. Works with Malachite now, Simplex later. |
| 57 | + |
| 58 | +## Consequences |
| 59 | + |
| 60 | +### Positive |
| 61 | + |
| 62 | +- 10x sync speedup |
| 63 | +- O(1) verification |
| 64 | +- Consensus-agnostic |
| 65 | +- Reuses existing snap sync and BLS |
| 66 | + |
| 67 | +### Negative |
| 68 | + |
| 69 | +- Protocol complexity (new message types) |
| 70 | +- Requires 2/3+ online validators |
| 71 | +- New Commonware dependency |
| 72 | + |
| 73 | +## References |
| 74 | + |
| 75 | +* [Commonware Aggregation](https://github.com/commonwarexyz/monorepo/tree/main/consensus/src/aggregation) |
0 commit comments