Documentation

CslibFrontier.Computability.Distributed.Byzantine.Basic

Synchronous Byzantine agreement #

Deterministic synchronous message passing on the complete graph of processes P, in the presence of Byzantine faults, following the model of Fischer, Lynch and Merritt (§2) for the problem of Pease, Shostak and Lamport.

A Protocol P State Msg gives every process an initial state from its input bit, and in every round a message to every process, a new state computed from the messages received, and a Boolean decision. Every process may run different code, since all fields take the process as an argument. The processes in a set F are faulty: in round r + 1 a faulty process j sends adv r j i to i, arbitrarily and possibly differently to different recipients. Protocol.state and Protocol.decision give the resulting run. Since runs are deterministic, quantifying over a fixed table adv loses nothing against adaptive (even rushing) adversaries: the messages an adaptive adversary sends in the run on a given input form such a table. Protocol.adaptiveState_eq_state checks this for a rushing adversary that sees the global state before choosing its messages.

Protocol.SolvesByzantineAgreement t R asks that, whenever at most t processes are faulty, the correct processes' decisions after R rounds satisfy

Termination is built in: decisions are read off after round R. A protocol that decides earlier can keep its state unchanged in later rounds. Protocols whose decision round depends on the run are not covered. For finite P and Msg this loses nothing, since by König's lemma such a protocol decides within a bound uniform over all runs, but for infinite Msg a fixed R is strictly narrower than eventual decision.

Protocol.coverState runs the protocol on a covering network, in which every node runs the code of some process and receives the message of process j from a designated neighbour. The covering lemma Protocol.state_eq_coverState says that a Byzantine run coincides on the correct processes with a covering network whenever the faulty processes replay what the network shows them. It packages the Locality and Fault axioms of Fischer, Lynch and Merritt, proved here for this model, and is the engine of the impossibility proofs in CslibFrontier.Computability.Distributed.Byzantine.NodeBound.

Main definitions #

Main results #

References #

structure Cslib.Distributed.Byzantine.Protocol (P : Type u_1) (State : Type u_2) (Msg : Type u_3) :
Type (max (max u_1 u_2) u_3)

A deterministic synchronous message-passing protocol on the complete graph of processes P.

Process i with input bit b starts in state init i b. In round r + 1 it sends send r i s j to every process j (itself included) and then moves to update r i s m, where s is its state and m j the message it received from j. Its decision in state s is output i s.

  • init : P → Bool → State

    The initial state of a process with a given input bit.

  • send : ℕ → P → State → P → Msg

    send r i s j: the message process i in state s sends to j in round r + 1.

  • update : ℕ → P → State → (P → Msg) → State

    update r i s m: the state of i after round r + 1, where m j came from j.

  • output : P → State → Bool

    The decision of a process in a given state.

def Cslib.Distributed.Byzantine.Protocol.state {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (π : Protocol P S M) (F : Finset P) (adv : ℕ → P → P → M) (x : P → Bool) :
ℕ → P → S

The state of process i after r rounds on inputs x when the processes in F are faulty and a faulty j sends adv r j i to i in round r + 1. A faulty process's own state evolves by the protocol, but nobody sees it: only its messages matter.

def Cslib.Distributed.Byzantine.Protocol.decision {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (π : Protocol P S M) (F : Finset P) (adv : ℕ → P → P → M) (x : P → Bool) (R : ℕ) (i : P) :

The decision of process i after R rounds.

structure Cslib.Distributed.Byzantine.Protocol.SolvesByzantineAgreement {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (π : Protocol P S M) (t R : ℕ) :

π solves Byzantine agreement against at most t faults in R rounds: whenever at most t processes are faulty, whatever they send, the correct processes agree after R rounds, and they decide v when all of them have input v Fischer, Lynch and Merritt, §3.

  • agreement (F : Finset P) : F.card ≤ t → ∀ (adv : ℕ → P → P → M) (x : P → Bool), ∀ i ∉ F, ∀ j ∉ F, π.decision F adv x R i = π.decision F adv x R j

    Agreement: all correct processes decide the same value.

  • validity (F : Finset P) : F.card ≤ t → ∀ (adv : ℕ → P → P → M) (x : P → Bool) (v : Bool), (∀ i ∉ F, x i = v) → ∀ i ∉ F, π.decision F adv x R i = v

    Validity: if all correct processes have input v, they decide v.

theorem Cslib.Distributed.Byzantine.Protocol.SolvesByzantineAgreement.mono {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {π : Protocol P S M} {t t' R : ℕ} (h : π.SolvesByzantineAgreement t R) (ht : t' ≤ t) :

Tolerating t faults implies tolerating at most t' ≤ t faults.

def Cslib.Distributed.Byzantine.Protocol.adaptiveState {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (π : Protocol P S M) (F : Finset P) (strat : ℕ → (P → S) → P → P → M) (x : P → Bool) :
ℕ → P → S

The state of process i after r rounds against a rushing adversary: in round r + 1 a faulty j sends strat r σ j i to i, where σ is the global state after r rounds, which determines the messages of the correct processes in round r + 1.

theorem Cslib.Distributed.Byzantine.Protocol.adaptiveState_eq_state {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (π : Protocol P S M) (F : Finset P) (strat : ℕ → (P → S) → P → P → M) (x : P → Bool) (r : ℕ) :
π.adaptiveState F strat x r = π.state F (fun (r : ℕ) (j i : P) => strat r (π.adaptiveState F strat x r) j i) x r

A rushing adversary is no stronger than a fixed table: the run against strat is the run against the table of the messages that strat sends in it.

theorem Cslib.Distributed.Byzantine.Protocol.SolvesByzantineAgreement.adaptive {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {π : Protocol P S M} {t R : ℕ} (h : π.SolvesByzantineAgreement t R) {F : Finset P} (hF : F.card ≤ t) (strat : ℕ → (P → S) → P → P → M) (x : P → Bool) :
(∀ i ∉ F, ∀ j ∉ F, π.output i (π.adaptiveState F strat x R i) = π.output j (π.adaptiveState F strat x R j)) ∧ ∀ (v : Bool), (∀ i ∉ F, x i = v) → ∀ i ∉ F, π.output i (π.adaptiveState F strat x R i) = v

Agreement and validity hold against rushing adversaries as well.

The protocol in which every process decides its own input without communicating.

On at most one process, deciding the own input solves Byzantine agreement against any number of faults, with any decision round R.

def Cslib.Distributed.Byzantine.Protocol.coverState {P : Type u_1} {S : Type u_2} {M : Type u_3} (π : Protocol P S M) {N : Type u_4} (label : N → P) (input : N → Bool) (nbr : N → P → N) :
ℕ → N → S

The state of node a of a covering network after r rounds. Node a runs the code of process label a on input input a, and receives the message of process j from node nbr a j, which sends it as j would. In the covering networks of interest label (nbr a j) = j, but the definition does not need this.

theorem Cslib.Distributed.Byzantine.Protocol.state_eq_coverState {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (π : Protocol P S M) {N : Type u_4} (label : N → P) (input : N → Bool) (nbr : N → P → N) (F : Finset P) (adv : ℕ → P → P → M) (x : P → Bool) (e : P → N) (hlabel : ∀ i ∉ F, label (e i) = i) (hinput : ∀ i ∉ F, input (e i) = x i) (hnbr : ∀ i ∉ F, ∀ j ∉ F, nbr (e i) j = e j) (hadv : ∀ (r : ℕ), ∀ i ∉ F, ∀ j ∈ F, adv r j i = π.send r j (π.coverState label input nbr r (nbr (e i) j)) i) (r : ℕ) (i : P) :
i ∉ F → π.state F adv x r i = π.coverState label input nbr r (e i)

The covering lemma. Suppose that the correct processes embed into a covering network by e, preserving their code, their inputs and their mutual wiring, and that every faulty process j sends to a correct i what the neighbour of e i standing for j sends. Then every correct process i is in the same state as node e i after every round. This is the content of the Locality and Fault axioms of Fischer, Lynch and Merritt, §2 in this model.