Document Status: Production Implementation (February 2026)
Purpose: Document the consensus mechanism from submission to on-chain finalization.
Related: aggregator-workflow.md, protocol-state-transitions.md, ../architecture/data-flow.md
DSV consensus is achieved through two-level aggregation:
- Level 1 (Local): Each validator aggregates collected submissions into a local finalized batch. Consensus CID per project = majority vote among submissions.
- Level 2 (Network): All validators' batches are aggregated. Consensus CID per project = majority vote among validator batches.
- On-Chain: VPA assigns which validator submits the Level 2 consensus batch. That validator submits via relayer-py.
- Input: Multiple CIDs for the same (epoch, project) from different submitters (L1) or validators (L2).
- Algorithm: Count votes per CID. Select CID with majority. Tie-breaking: deterministic (e.g., lexicographic first).
- Output: Single consensus CID per project for the epoch.
- L1: Same submissions → same local batch. Submissions collected deterministically (ZSET order, no SCAN).
- L2: Same validator batches → same consensus. Aggregation window ensures all batches collected before computation.
1. EpochReleased
2. Submission window opens (45s BDS mainnet)
3. Snapshotters submit CIDs via gossipsub
4. P2P Gateway → Dequeuer → Redis (epoch-keyed)
5. Window closes
6. Finalizer workers: vote count per project → consensus CID
7. Aggregator L1: combine parts → local batch → IPFS → stream
8. P2P Gateway: broadcast local batch to finalized-batches topic
9. Aggregator L2: collect batches (local + remote) for 30s window
10. Level 2 consensus → aggregated batch → IPFS
11. VPA: getPriorities → wait for window → submit via relayer-py
12. On-chain: epoch finalized
- L1: Malicious snapshotter submissions can be outvoted by honest majority. Deduplication prevents self-voting amplification.
- L2: Malicious validator batch can be outvoted by honest validators. Requires >1/2 honest validators.
- VPA: On-chain priority prevents submission conflicts. Only one validator submits per epoch.
- Aggregator:
decentralized-sequencer/cmd/aggregator/main.go - Consensus logic:
decentralized-sequencer/pkgs/consensus/ - VPA:
decentralized-sequencer/pkgs/vpa/client.go