96
LOGIC AND FORMAL METHODS Byzantine Agreement Protocols Formal Model in Event-B Rodin User and Developer Workshop 2010 Roman Krenick´ y and Mattias Ulbrich | September 21, 2010 KIT – University of the State of Baden-Wuerttemberg and National Laboratory of the Helmholtz Association www.kit.edu

Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

LOGIC AND FORMAL METHODS

Byzantine Agreement ProtocolsFormal Model in Event-BRodin User and Developer Workshop 2010Roman Krenicky and Mattias Ulbrich | September 21, 2010

KIT – University of the State of Baden-Wuerttemberg andNational Laboratory of the Helmholtz Association

www.kit.edu

Page 2: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Outline

1 Byzantine Agreement Protocols

2 Modelling Byz. Agreement in Event-B

3 Experiences

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 2/21

Page 3: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Generals

“When shall we attack?”

agree on atime even in thepresence of traitors

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 3/21

Page 4: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Generals

“When shall we attack?”

agree on atime even in thepresence of traitors

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 3/21

Page 5: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Generals

“When shall we attack?”

agree on atime even in thepresence of traitors

messages

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 3/21

Page 6: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Generals

“When shall we attack?”

agree on atime even in thepresence of traitors

messages

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 3/21

Page 7: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Application in Avionics

“Which componentsare operative?”

C2

C1

C2

C3

C4

agree on the setof operative componentseven in the presence offaulty components

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 4/21

Page 8: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Application in Avionics

“Which componentsare operative?”

C2

C1

C2

C3

C4

agree on the setof operative componentseven in the presence offaulty components

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 4/21

Page 9: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Application in Avionics

“Which componentsare operative?”

C2

C1

C2

C3

C4

agree on the setof operative componentseven in the presence offaulty components

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 4/21

Page 10: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

11

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 11: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

11

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 12: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

11

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 13: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

11

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 14: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

1

1

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 15: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

11

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 16: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

1

1

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 17: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

11

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 18: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Explanation by Example

C1

C2

C3

C4

1

2

3

1

2

3

1

11

2,1

3,1

22

3

3

1,3,2

2,1,3

3,1,2

CONSENSUS!

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 5/21

Page 19: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Example Run 2

C1

C2

C3

C4

1

X

X

Round 0

1

1

X1

Round 11

1

Round 2

1

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 6/21

Page 20: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Example Run 2

C1

C2

C3

C4

1

X

X

Round 0

1

1

X1

Round 11

1

Round 2

1

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 6/21

Page 21: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Example Run 2

C1

C2

C3

C4

1

X

X

Round 0

1

1

X1

Round 11

1

Round 2

1

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 6/21

Page 22: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Example Run 2

C1

C2

C3

C4

1

X

X

Round 0

1

1

X1

Round 1

1

1

Round 2

1

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 6/21

Page 23: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Agreement Algorithm

Verification Goals:

Validity If the transmitter tt is non-faulty, then all non-faultyreceivers agree on the value sent by tt .

Agreement Any two non-faulty receivers agree on the valueassigned to tt .

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 7/21

Page 24: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Agreement AlgorithmRound 0: Transmitter sends signed message to all receivers.

Round n: If a component receives a message, it proceeds asfollows:

1 Verify the signature(s) of the message (discard on error)2 Discard the message if the value has been observed

earlier.3 Add signature to the message and pass it on to all nodes

that have not yet seen the message.

GOAL: Prove that this algorithm has the “validity” and “agreement”properties.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 8/21

Page 25: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Agreement AlgorithmRound 0: Transmitter sends signed message to all receivers.

Round n: If a component receives a message, it proceeds asfollows:

1 Verify the signature(s) of the message (discard on error)

2 Discard the message if the value has been observedearlier.

3 Add signature to the message and pass it on to all nodesthat have not yet seen the message.

GOAL: Prove that this algorithm has the “validity” and “agreement”properties.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 8/21

Page 26: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Agreement AlgorithmRound 0: Transmitter sends signed message to all receivers.

Round n: If a component receives a message, it proceeds asfollows:

1 Verify the signature(s) of the message (discard on error)2 Discard the message if the value has been observed

earlier.

3 Add signature to the message and pass it on to all nodesthat have not yet seen the message.

GOAL: Prove that this algorithm has the “validity” and “agreement”properties.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 8/21

Page 27: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Agreement AlgorithmRound 0: Transmitter sends signed message to all receivers.

Round n: If a component receives a message, it proceeds asfollows:

1 Verify the signature(s) of the message (discard on error)2 Discard the message if the value has been observed

earlier.3 Add signature to the message and pass it on to all nodes

that have not yet seen the message.

GOAL: Prove that this algorithm has the “validity” and “agreement”properties.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 8/21

Page 28: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Byzantine Agreement AlgorithmRound 0: Transmitter sends signed message to all receivers.

Round n: If a component receives a message, it proceeds asfollows:

1 Verify the signature(s) of the message (discard on error)2 Discard the message if the value has been observed

earlier.3 Add signature to the message and pass it on to all nodes

that have not yet seen the message.

GOAL: Prove that this algorithm has the “validity” and “agreement”properties.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 8/21

Page 29: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Verification

QuoteWe know of no area in computer scienceor mathematics in which informalreasoning is more likely to lead to errorsthan in the study of this type of algorithm.

Taken from: The Byzantine Generals ProblemLeslie Lamport, Robert Shostak, and Marshall PeaseACM Transactions on Programming Languages and SystemsVolume 4, pp. 383–401,1982.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 9/21

Page 30: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Formal Verification

So far ...(Explicit) Model Checking for |nodes| ≤ 4PVS (i.e., HOL) formalisation and proofs of Oral Messages(recursive) [Lincoln and Rushby, ’93]

Now and here: Event-B and RODIN

Rigorous Open Development Environment for Complex Systems

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 10/21

Page 31: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Formal Verification

So far ...(Explicit) Model Checking for |nodes| ≤ 4PVS (i.e., HOL) formalisation and proofs of Oral Messages(recursive) [Lincoln and Rushby, ’93]

Now and here: Event-B and RODIN

Rigorous Open Development Environment for Complex Systems

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 10/21

Page 32: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 33: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 34: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 35: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 36: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 37: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 38: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 39: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 40: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Model

system := a set of Modules, either faulty or non-faulty.modules send and receive messages containing Valuesone dedicated module transmitterround based (transmitter acts in round 0)there is a “good” value V0 intended, observed, ... value

non-faulty transmitter =⇒ send V0 to everyone elseround > 0 =⇒ transmitter silent, other modules relaynon-faulty =⇒ relays every message to modules thathave not seen this message yet.faulty =⇒ may drop messages, but NOT forge.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 11/21

Page 41: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Context for Byzantine Agreement

CONTEXT CONTEXT

SETS

Module

Value

CONSTANTS

faulty , transmitter , V0

AXIOMS

axm1 : faulty ⊆ Module

axm2 : transmitter ∈ Module

axm3 : V0 ∈ Value

axm4 : finite(faulty)

END

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 12/21

Page 42: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Context for Byzantine Agreement

CONTEXT CONTEXT

SETSModule

Value

CONSTANTS

faulty , transmitter , V0

AXIOMS

axm1 : faulty ⊆ Module

axm2 : transmitter ∈ Module

axm3 : V0 ∈ Value

axm4 : finite(faulty)

END

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 12/21

Page 43: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Context for Byzantine Agreement

CONTEXT CONTEXT

SETSModule

Value

CONSTANTSfaulty , transmitter , V0

AXIOMS

axm1 : faulty ⊆ Module

axm2 : transmitter ∈ Module

axm3 : V0 ∈ Value

axm4 : finite(faulty)

END

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 12/21

Page 44: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Context for Byzantine Agreement

CONTEXT CONTEXT

SETSModule

Value

CONSTANTSfaulty , transmitter , V0

AXIOMSaxm1 : faulty ⊆ Module

axm2 : transmitter ∈ Module

axm3 : V0 ∈ Value

axm4 : finite(faulty)END

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 12/21

Page 45: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine

MACHINE MESSAGES

SEES CONTEXT

VARIABLES

INVARIANTS

ty mess : messages ⊆ Module× Module× Value

ty round : round ∈ Nty collected : collected ∈ Module→ P(Value)

. . .

messages messages being sent in the current roundround the number of the current round

collected values observed in previous rounds

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 13/21

Page 46: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine

MACHINE MESSAGES

SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS

ty mess : messages ⊆ Module× Module× Value

ty round : round ∈ Nty collected : collected ∈ Module→ P(Value)

. . .

messages messages being sent in the current roundround the number of the current round

collected values observed in previous rounds

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 13/21

Page 47: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine

MACHINE MESSAGES

SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTSty mess : messages ⊆ Module× Module× Value

ty round : round ∈ Nty collected : collected ∈ Module→ P(Value)

. . .

messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 13/21

Page 48: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine

MACHINE MESSAGES

SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTSty mess : messages ⊆ Module× Module× Value

ty round : round ∈ N

ty collected : collected ∈ Module→ P(Value)

. . .

messages messages being sent in the current roundround the number of the current round

collected values observed in previous rounds

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 13/21

Page 49: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine

MACHINE MESSAGES

SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTSty mess : messages ⊆ Module× Module× Value

ty round : round ∈ Nty collected : collected ∈ Module→ P(Value)

. . .

messages messages being sent in the current roundround the number of the current round

collected values observed in previous rounds

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 13/21

Page 50: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine (2)messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

MACHINE MESSAGES SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS ...

EVENTS

Initialisation ...

EVENT ROUND =begin

act1: round := round + 1act2: messages :∈ P(Module

\ {transmitter}

× Module× Value)act3: collected := λm · collected(m)∪

{v | (s,m, v) ∈ messages}

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 14/21

Page 51: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine (2)messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

MACHINE MESSAGES SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS ...

EVENTS

Initialisation ...

EVENT ROUND =begin

act1: round := round + 1act2: messages :∈ P(Module

\ {transmitter}

× Module× Value)act3: collected := λm · collected(m)∪

{v | (s,m, v) ∈ messages}

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 14/21

Page 52: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine (2)messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

MACHINE MESSAGES SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS ...

EVENTS

Initialisation ...

EVENT ROUND =begin

act1: round := round + 1

act2: messages :∈ P(Module

\ {transmitter}

× Module× Value)act3: collected := λm · collected(m)∪

{v | (s,m, v) ∈ messages}

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 14/21

Page 53: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine (2)messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

MACHINE MESSAGES SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS ...

EVENTS

Initialisation ...

EVENT ROUND =begin

act1: round := round + 1act2: messages :∈ P(Module

\ {transmitter}

× Module× Value)

act3: collected := λm · collected(m)∪

{v | (s,m, v) ∈ messages}

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 14/21

Page 54: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine (2)messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

MACHINE MESSAGES SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS ...

EVENTS

Initialisation ...

EVENT ROUND =begin

act1: round := round + 1act2: messages :∈ P(Module \ {transmitter} × Module× Value)

act3: collected := λm · collected(m)∪

{v | (s,m, v) ∈ messages}

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 14/21

Page 55: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine (2)messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

MACHINE MESSAGES SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS ...

EVENTS

Initialisation ...

EVENT ROUND =begin

act1: round := round + 1act2: messages :∈ P(Module \ {transmitter} × Module× Value)act3: collected := λm · collected(m)∪

{v | (s,m, v) ∈ messages}

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 14/21

Page 56: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First machine (2)messages messages being sent in the current round

round the number of the current roundcollected values observed in previous rounds

MACHINE MESSAGES SEES CONTEXT

VARIABLES messages, round , collected

INVARIANTS ...

EVENTS

Initialisation ...

EVENT ROUND =begin

act1: round := round + 1act2: messages :∈ P(Module \ {transmitter} × Module× Value)act3: collected := λm · collected(m)∪{v | (s,m, v) ∈ messages}

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 14/21

Page 57: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First refinement: signed messages

All messages are signed in a trustworthy manner:No forgery possible =⇒ Consider only relayed messages.

round k : s rv

round k + 1: r nv

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 15/21

Page 58: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First refinement: signed messages

All messages are signed in a trustworthy manner:No forgery possible =⇒ Consider only relayed messages.

round k : s rv

round k + 1: r nv

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 15/21

Page 59: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

First refinement: signed messages

All messages are signed in a trustworthy manner:No forgery possible =⇒ Consider only relayed messages.

round k : s rv

round k + 1: r nv

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 15/21

Page 60: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Signed messages (2)round k : s r

v

round k + 1: r nv

MACHINE SIGNEDMESSAGES REFINES MESSAGES

VARIABLES messages, round , collected

INVARIANTS

val1: ∀s, r , v · (s, r , v) ∈ messages ⇒ v ∈ collected(transmitter)val2: ∀n · collected(n) ⊆ collected(transmitter)

EVENTS

EVENT ROUND refines ROUND =begin

act1, act3 as above

act2: messages :∈ P({

(r ,n, v) | (s, r , v) ∈ messages})

was: messages :∈ P(Module \ {transmitter} × Module× Value)

end

END

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 16/21

Page 61: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Signed messages (2)round k : s r

v

round k + 1: r nv

MACHINE SIGNEDMESSAGES REFINES MESSAGES

VARIABLES messages, round , collected

INVARIANTS

val1: ∀s, r , v · (s, r , v) ∈ messages ⇒ v ∈ collected(transmitter)val2: ∀n · collected(n) ⊆ collected(transmitter)

EVENTS

EVENT ROUND refines ROUND =begin

act1, act3 as above

act2: messages :∈ P({

(r ,n, v) | (s, r , v) ∈ messages})

was: messages :∈ P(Module \ {transmitter} × Module× Value)

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 16/21

Page 62: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Signed messages (2)round k : s r

v

round k + 1: r nv

MACHINE SIGNEDMESSAGES REFINES MESSAGES

VARIABLES messages, round , collected

INVARIANTS

val1: ∀s, r , v · (s, r , v) ∈ messages ⇒ v ∈ collected(transmitter)val2: ∀n · collected(n) ⊆ collected(transmitter)

EVENTS

EVENT ROUND refines ROUND =begin

act1, act3 as above

act2: messages :∈ P({

(r ,n, v) | (s, r , v) ∈ messages})

was: messages :∈ P(Module \ {transmitter} × Module× Value)end

END

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 16/21

Page 63: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Signed messages (2)round k : s r

v

round k + 1: r nv

MACHINE SIGNEDMESSAGES REFINES MESSAGES

VARIABLES messages, round , collected

INVARIANTS

val1: ∀s, r , v · (s, r , v) ∈ messages ⇒ v ∈ collected(transmitter)val2: ∀n · collected(n) ⊆ collected(transmitter)

EVENTS

EVENT ROUND refines ROUND =begin

act1, act3 as aboveact2: messages :∈ P

({(r ,n, v) | (s, r , v) ∈ messages

})was: messages :∈ P(Module \ {transmitter} × Module× Value)

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 16/21

Page 64: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Signed messages (2)round k : s r

v

round k + 1: r nv

MACHINE SIGNEDMESSAGES REFINES MESSAGES

VARIABLES messages, round , collected

INVARIANTSval1: ∀s, r , v · (s, r , v) ∈ messages ⇒ v ∈ collected(transmitter)

val2: ∀n · collected(n) ⊆ collected(transmitter)

EVENTS

EVENT ROUND refines ROUND =begin

act1, act3 as aboveact2: messages :∈ P

({(r ,n, v) | (s, r , v) ∈ messages

})was: messages :∈ P(Module \ {transmitter} × Module× Value)

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 16/21

Page 65: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Signed messages (2)round k : s r

v

round k + 1: r nv

MACHINE SIGNEDMESSAGES REFINES MESSAGES

VARIABLES messages, round , collected

INVARIANTSval1: ∀s, r , v · (s, r , v) ∈ messages ⇒ v ∈ collected(transmitter)val2: ∀n · collected(n) ⊆ collected(transmitter)

EVENTS

EVENT ROUND refines ROUND =begin

act1, act3 as aboveact2: messages :∈ P

({(r ,n, v) | (s, r , v) ∈ messages

})was: messages :∈ P(Module \ {transmitter} × Module× Value)

endEND

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 16/21

Page 66: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Refinement Tower

covered so far

sees

sees

sees

sees

def. ext.

def. ext.

def. ext.

MessagesContext

MessagesSigned

History

Guarantees

GuaranteesTechHybridGuaranteesHybridContext

HybridGuaranteesTechRoundless

SM

VotingContext ValueTables

ValueTablesTechZAModuleList

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 17/21

Page 67: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Refinement Tower

covered so far

sees

sees

sees

sees

def. ext.

def. ext.

def. ext.

MessagesContext

MessagesSigned

History

Guarantees

GuaranteesTechHybridGuaranteesHybridContext

HybridGuaranteesTechRoundless

SM

VotingContext ValueTables

ValueTablesTechZAModuleList

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 17/21

Page 68: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Refinement Tower

covered so far

sees

sees

sees

sees

def. ext.

def. ext.

def. ext.

MessagesContext

MessagesSigned

History

Guarantees

GuaranteesTechHybridGuaranteesHybridContext

HybridGuaranteesTechRoundless

SM

VotingContext ValueTables

ValueTablesTechZAModuleList

Changes message representation:msgs ⊆ Module× Module× P(Module)× Value

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 17/21

Page 69: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Refinement Tower

covered so far

sees

sees

sees

sees

def. ext.

def. ext.

def. ext.

MessagesContext

MessagesSigned

History

Guarantees

GuaranteesTechHybridGuaranteesHybridContext

HybridGuaranteesTechRoundless

SM

VotingContext ValueTables

ValueTablesTechZAModuleList

non-faulty modules behave well:

r 6∈ faulty ∧ (s, r , h, v) ∈ msgs =⇒∀n ·

(n 6∈ h =⇒ (r , n, h ∪ {r}, v) ∈ msgs′)

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 17/21

Page 70: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Refinement Tower

covered so far

sees

sees

sees

sees

def. ext.

def. ext.

def. ext.

MessagesContext

MessagesSigned

History

Guarantees

GuaranteesTechHybridGuaranteesHybridContext

HybridGuaranteesTechRoundless

SM

VotingContext ValueTables

ValueTablesTechZAModuleList

hybrid fault model:

faulty = arbFault ∪ symFaulty

arbFaulty ∩ symFaulty = ∅

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 17/21

Page 71: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Refinement Tower

covered so far

sees

sees

sees

sees

def. ext.

def. ext.

def. ext.

MessagesContext

MessagesSigned

History

Guarantees

GuaranteesTechHybridGuaranteesHybridContext

HybridGuaranteesTechRoundless

SM

VotingContext ValueTables

ValueTablesTechZAModuleList

new event structure:

PROCESS EVENT refines SKIP

modifies internal data structures (invisible to abstractmachine) and

ROUND SWITCH refines ROUND

reproduces the effect of a round change from the in-ternal data.

An implementation would refine PROCESS EVENT.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 17/21

Page 72: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Refinement Tower

covered so far

sees

sees

sees

sees

def. ext.

def. ext.

def. ext.

MessagesContext

MessagesSigned

History

Guarantees

GuaranteesTechHybridGuaranteesHybridContext

HybridGuaranteesTechRoundless

SM

VotingContext ValueTables

ValueTablesTechZAModuleList

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 17/21

Page 73: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Agreement!

In GUARANTEES:

round ≥ card(faulty) + 1 =⇒(∀n,m·n /∈ faulty ∧m /∈ faulty ⇒

collected(n) = collected(m))

In HYBRIDGUARANTEES:

round ≥ card(arbFaulty) + 1 =⇒(∀n,m·n /∈ faulty ∧m /∈ faulty ⇒

collected(n) = collected(m))

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 18/21

Page 74: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Agreement!

In GUARANTEES:

round ≥ card(faulty) + 1 =⇒(∀n,m·n /∈ faulty ∧m /∈ faulty ⇒

collected(n) = collected(m))

In HYBRIDGUARANTEES:

round ≥ card(arbFaulty) + 1 =⇒(∀n,m·n /∈ faulty ∧m /∈ faulty ⇒

collected(n) = collected(m))

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 18/21

Page 75: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Procedure

Rather complex proof obligations

⇒ little automation

Perform manual steps to identify lemmata⇒ introduce as theorem invariants

needed two-state invariants(e.g., messages of last round have been relayed)

⇒ concept of definitorial extensions:technical refinements with extra variables,conduct proofs there.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 19/21

Page 76: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Procedure

Rather complex proof obligations⇒ little automation

Perform manual steps to identify lemmata⇒ introduce as theorem invariants

needed two-state invariants(e.g., messages of last round have been relayed)

⇒ concept of definitorial extensions:technical refinements with extra variables,conduct proofs there.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 19/21

Page 77: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Procedure

Rather complex proof obligations⇒ little automation

Perform manual steps to identify lemmata

⇒ introduce as theorem invariants

needed two-state invariants(e.g., messages of last round have been relayed)

⇒ concept of definitorial extensions:technical refinements with extra variables,conduct proofs there.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 19/21

Page 78: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Procedure

Rather complex proof obligations⇒ little automation

Perform manual steps to identify lemmata⇒ introduce as theorem invariants

needed two-state invariants(e.g., messages of last round have been relayed)

⇒ concept of definitorial extensions:technical refinements with extra variables,conduct proofs there.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 19/21

Page 79: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Procedure

Rather complex proof obligations⇒ little automation

Perform manual steps to identify lemmata⇒ introduce as theorem invariants

needed two-state invariants(e.g., messages of last round have been relayed)

⇒ concept of definitorial extensions:technical refinements with extra variables,conduct proofs there.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 19/21

Page 80: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Procedure

Rather complex proof obligations⇒ little automation

Perform manual steps to identify lemmata⇒ introduce as theorem invariants

needed two-state invariants(e.g., messages of last round have been relayed)

⇒ concept of definitorial extensions:technical refinements with extra variables,conduct proofs there.

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 19/21

Page 81: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 82: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 83: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 84: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitable

no ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 85: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitable

no ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 86: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 87: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 88: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinement

good tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 89: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinement

good tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 90: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 91: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 92: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 93: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

Experiences

NumbersSize: 4 contexts, 12 machines, 106 invariantsLabour: approx. 4 pmProofs: 322 proof obligationsAutomation: 74/322, 23%

first order set theory with relations suitableno ADT support (extension mechanism on its way)

refinementgood tool support (only minor bugs,→next slide)

no sequential decomposition (unlike classical B)

Further reading: [Krenicky, Ulbrich: Technical Report 2010-07]

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 20/21

Page 94: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

RODIN issues

MISSING INTERACTIVE RULES

POs seem suited for modern SMT solvers with quantifiers(such Z3)(from experiences in source code verification)

RODIN 1.1 seemed more stable than 1.2 (e.g., “swallowingof formulae”)

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 21/21

Page 95: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

RODIN issues

MISSING INTERACTIVE RULES

POs seem suited for modern SMT solvers with quantifiers(such Z3)(from experiences in source code verification)

RODIN 1.1 seemed more stable than 1.2 (e.g., “swallowingof formulae”)

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 21/21

Page 96: Byzantine Agreement Protocols · Rodin User and Developer Workshop 2010 Roman Krenicky and Mattias Ulbrich´ j September 21, 2010 KIT – University of the State of Baden-Wuerttemberg

RODIN issues

MISSING INTERACTIVE RULES

POs seem suited for modern SMT solvers with quantifiers(such Z3)(from experiences in source code verification)

RODIN 1.1 seemed more stable than 1.2 (e.g., “swallowingof formulae”)

Byzantine Agreement Protocols Modelling Byz. Agreement in Event-B Experiences

R. Krenicky and M. Ulbrich – Byzantine Agreement Protocols September 21, 2010 21/21