Lecture 18: Distributed Agreement: CSC 469H1F / CSC 2208H1F Fall 2007 Angela Demke Brown
Lecture 18: Distributed Agreement: CSC 469H1F / CSC 2208H1F Fall 2007 Angela Demke Brown
04/27/16
Reliable multicast
Byzantine Generals Problem
Interactive agreement
Atomic broadcast
04/27/16
Outline
Distributed Algorithms
Distributed Agreement
Castros BFT Library
CSC469
04/27/16
Distributed Algorithms
System model from last lecture.
Distributed system is composed of n
processes
A process executes a sequence of events
Local computation
Sending a message m
Receiving a message m
04/27/16
Liveness
Indicates that some particular good thing will
(eventually) happen.
04/27/16
Timing Model
Specifies assumptions regarding delays between
execution steps of a correct process
send and receipt of a message sent between correct
processes
Asynchronous
No assumptions about
message
and execution delays
(except that they are finite).
04/27/16
CSC469
04/27/16
CSC469
04/27/16
CSC469
04/27/16
Failure Model
A process that behaves according to its I/O
specification throughout its execution is called
correct
A process that deviates from its specification
is faulty
Many gradations of faulty. Two of interest are:
Fail-Stop failures
A faulty process halts
execution prematurely.
CSC469
Byzantine failures
No assumption about
behavior of a faulty process.
04/27/16
CSC469
04/27/16
Fail-Stop failure
A failure results in the process, p, stopping
Also referred to as crash failure
p works correctly until the point of failure
CSC469
04/27/16
Fault/failure detectors
A perfect failure detector
No false positives (only reports actual failures).
Eventually reports failures to all processes.
Heartbeat protocols
Assumes partially synchronous environment
Processes send Im Alive messages to all other
processes regularly
If process i does not hear from process j in some time
T = Tdelivery + Theartbeat then it determines that j has failed
Depends on Tdelivery being known and accurate
CSC469
04/27/16
04/27/16
Byzantine failure
Process p fails in an arbitrary manner.
p is modeled as a malevolent entity
Can send the messages and perform the actions that will
have the worst impact on other processes
Can collaborate with other failed processes
04/27/16
CSC469
04/27/16
Validity
Termination
04/27/16
S is a set of values
Si {initial value}
Decide(x) can be
for k = 1 to f+1
various functions
send Si to all
E.g. min(x), max(x),
processes
majority(x), or some
receive Sj from all j !=
default
i
Si Si Sj (for all Assumes nodes are
connected and links do
j)
not fail
end for
Decide(Si)
CSC469
04/27/16
Analysis of FloodSet
Requires f+1 rounds because process can fail
at any time, in particular, during send
Agreement: Since at most f failures, then
after f+1 rounds all correct processes will
evaluate Decide(Si) the same.
Validity: Decide results in a proposed value
(or default value)
Termination: After f+1 rounds the algorithm
completes
CSC469
04/27/16
End of
round 1
End of
round 2
S1 = {0}
2
S2 = {1}
{1}
{0,1}
decide 0
{0,1}
{0,1}
decide 0
3
S3 = {1}
CSC469
04/27/16
Synchronous/Byzantine Consensus
Faulty processes can behave arbitrarily
May actively try to trick other processes
CSC469
04/27/16
Byzantine Generals
Use v(i) to denote value sent by ith general
traitor could send different values to different
generals, so cant use v(i) obtained from i directly.
New conditions:
Any two loyal generals use the same value v(i), regardless
of whether i is loyal or not
If the ith general is loyal, then the value that she sends
must be used by every loyal general as the value of v(i).
CSC469
04/27/16
CSC469
04/27/16
Case 1
Traitor lieutenant tries to foil consensus by refusing
to participate
Round 1: Commanding
General sends Retreat
Commanding General 1
Lieutenant 2
CSC469
Lieutenant 3
R
decides to retreat
04/27/16
Case 2a
Traitor lieutenant tries to foil consensus by lying
about order sent by general
Round 1: Commanding
General sends Retreat
Commanding General 1
Lieutenant 3
Lieutenant 2
decides to retreat
A
CSC469
04/27/16
Case 2b
Traitor lieutenant tries to foil consensus by lying
about order sent by general
Round 1: Commanding
General sends Attack
Commanding General 1
Lieutenant 3
Lieutenant 2
decides to retreat
R
CSC469
04/27/16
Case 3
Traitor General tries to foil consensus by sending
different orders to loyal lieutenants
Round 1: General sends
Attack to L2 and
Retreat to L3
Commanding General 1
Lieutenant 3
Lieutenant 2
decides to attack
decides to retreat
A
CSC469
04/27/16
CSC469
04/27/16
04/27/16
Example: f = 1, n = 4
Loyal General, 1 traitor lieutenant
Step 1: Commander sends same
value, v, to all
Step 2: Each of L2, L3, L4
executes OM(0) as commander,
but L2 sends arbitrary values
Step 3: Decide
L3 has {v,v,x},
L4 has {v,v,y},
Both choose v.
Commander 1
v
v
v
v
x
L2
v
L3
L4
y
CSC469
04/27/16
Example: f = 1, n = 4
Traitor General, all lieutenants loyal
Step 1: Commander sends
different value, x,y,z, to each
Step 2: Each of L2, L3, L4
executes OM(0) as commander,
sending value they received
Step 3: Decide
L2 has {x,y,z}
L3 has {x,y,z},
L4 has {x,y,x},
Commander 1
z
x
y
y
x
L2
All loyal
lieutenants get
same result.
y
L3
L4
x
CSC469
04/27/16
Problem
Lots of messages required to handle even 1 faulty
process
Need minimum 4 processes to handle 1 fault, 7 to
handle 2 faults, etc.
But as system gets larger, probability of a fault also
increases
CSC469
04/27/16
CSC469
04/27/16
04/27/16
CSC469
04/27/16