Description
🚀 Feature Request
(We write this request in the form of a DIP).
Summary
This DIP describes a forensic protocol and implementation that can irrefutably detect Byzantine validators in the rare case that there is a safety violation in Diem.
LibraBFT allows the Diem Blockchain to tolerate up to one-third Byzantine validators within the validator network under the partially synchronous network setting [1]. Let
Motivation
An important property satisfied by any Byzantine fault tolerant consensus protocol is agreement, which requires honest parties to not decide on conflicting values. Depending on the network model, typical consensus protocols tolerate only a fraction of Byzantine parties. In particular, DiemBFT can tolerate
Motivated by situations where
Safety Violation on Diem
BFT assumption
The safety of Diem is based on a key assumption: if there are
- There can only be one certified block per round.
- Two blocks committed in different rounds must belong to the same chain.
Informally, the first lemma holds because Diem ensures that an honest validator only votes once in a round. Therefore, when the adversary does not corrupt more than
For the second argument, when the adversary does not corrupt more than
Safety violation
When the assumption does not hold, there are exactly two possible types of safety violations (Figure 1).
- Safety violation within a round: two different blocks are committed in a round
- Safety violation across rounds: two blocks that belong to two conflicting chains are committed in different rounds.
For the first case, when the adversary corrupts
For the second case, when the adversary corrupts
Forensic Support for Diem
In the analysis of safety violation above, we observe that the corrupted validators must send certain messages in order to break safety: 1) to break safety within a round, corrupted validators vote for two conflicting blocks in the round, 2) to break safety across rounds, they vote for a conflicting block despite having a lock on a conflicting block (thus violating the voting rule). Those messages are signed by their secret keys and hence can serve as irrefutable evidence of their misbehavior. In addition, no honest validator will vote twice within a round or violate the voting rule, therefore we will only hold corrupted validators culpable.
Armed with this intuition, the forensic protocol for DiemBFT is the following:
- To identify disagreement and trigger the forensic protocol, two conflicting commitQCs need to be provided to the forensic protocol as input.
- If two commitQCs are within a round, the validators who vote for both commitQCs are corrupted validators.
- If two commitQCs are across rounds, we denote by commitQC1 the lower one and commitQC2 the higher one. We query all validators for a prepareQC (denoted by prepareQC#) such that it is later than commit1, the block
$B'$ it votes for conflicts with the block$B$ of commitQC1, and the parent of$B'$ is before$B$ . The validators who vote for commitQC1 and prepareQC# are corrupted validators.
There are
An example attack is depicted in Figure 2, where conflicting commits across rounds occur; here
Specification
The forensic module can be added on top of Diem without touching the existing codebase. It consists of two components, a database (FORENSIC_STORE
) used to store quorum certificates received by validators, which can be accessed by clients through JSON-RPC requests, and an independent DETECTOR
run by clients to analyze the forensic information.
A demo dashboard below shows the information collected by the forensic protocol and the analysis results.
Figure 4. Dashboard to display forensic information.Implementation
A reference implementation is available at the following URL: https://github.com/wgr523/libra
Compatibility
The forensic module does not conflict with existing versions of Diem. A Diem validator that supports forensics appears no different within the Diem payment network (DPN) to Diem validators running older software versions. Diem validators that support forensics can receive RPC requests from clients and reply with messages. Obviously, older validators are not capable of replying to forensic requests. If a client who wants to use forensic features has no peers that support forensics, then it cannot gather enough information to have forensic support thus naturally decays to older clients.
References
- State Machine Replication in the Diem Blockchain. https://developers.diem.com/docs/technical-papers/state-machine-validatortion-paper/
- BFT Protocol Forensics. https://arxiv.org/abs/2010.06785