CS505 : Distributed Systems

Programming Assignment 3: Debugging a Solution to the Byzantine Generals Problem

Note: Questions are fully expected on this programming assignment. Do not hesitate to post and ask both the professor and TA. Some instruction is below, but it will doubtlessly be insufficient as a comprehensive guide. (complete, but may be updated)

Background/Protocol

The purpose of PA3 is to gain a deeper understanding of the solution to the Byzantine Generals Problem, as described in the paper by Lamport which you read for March 8th. A secondary goal is to improve your skills in debugging someone else's code. In this assignment, you are being given a nearly-correct implementation of the protocol. It works when there are no malicious nodes. But it fails even when there is only a single malicious node. Your task is to understand the protocol and implementation, and to determine how to fix the implementation.

To gain a better understanding of the protocol and implementation, it would be VERY WISE to begin by reading the Blog Post by Mark Nelson, who took the time to write a more in-depth discussion of the Byzantine Generals solution than we covered in class. The implementation provided is based on this description.

For this project, you may use cloud11.cs.purdue.edu through cloud15.cs.purdue.edu. The necessary tools for building and running Mace and the model checker should all be available on those machines.

You should be able to build on your earlier Mace checkout. However, in general: you should use cmake to build Mace out-of-source, and within your scratch directory on these machines. (Mace, when compiled, is quite large, and so keeping the build on /scratch will keep your directory from causing you grief from the sysadmins)

You are welcome to do this project on any machine on which you can build Mace, which should be generally true of Linux and OSX systems. We will use a departmental gentoo build for testing them.

For this project, you only need to submit your final HW3ByzantineAgreement.mac. Any discussion questions should be answered in comments in the file. (Standard C++ commenting syntax applies)

To support this assignment, a new synchronized transport was developed, in which the newtork delivers messages in phases, separating each phase by a tick. Since this code is not fully vetted yet, it is not included in the Mace repository. You will be given a link to a gzipped-tarball of a modified model checker directory, you should replace your own model checker directory with the provided one. Also, simple interfaces for consensus are provided to keep the assignment simple. The simple interface worries only about a single proposal--a practical implementation would require supporting multiple instances of the consensus protocol (not to mention removing the need for a syncrhonized transport).

I have implemented the protocol to be generic to the number of errors a protocol is willing to tolerate. To enable this, a number of recursive routines are implemented which allow this protocol to work [once completely fixed] for any value of "M" (or "F" depending on what text you read). To enable you to work with a variety of parameters, each of the configuration parameters (number of failures, what value to propose, what nodes are malicious) has been defined as a command-line parameter which you can set in the parameter file. Some parameter files have been provided, but you should feel free to modify them at this point to test the configurations you feel are needed. NOTE: it is always assumed that node "0" is the leader.

The basic requirement of this assignment is to get the protocol working for M=1 and values of N greather than or equal to 4. I had to change only 2 lines of code in my implementation from this point to make that work. Additional credit will be awarded for making it support M=2 and M=3. Note that my present working implementation appears to work correctly for M=2, but not M=3.

The steps you should take should include:

Environment/Development

To get started on the homework, you should setup your environment as follows:

When editing Mace files (.mac), it is helpful in most editors to use the syntax highlighting for C++. If you are a Vim user, there is a vim syntax file you can use. If you wish to contribute syntax files for other editors, I am happy to share them with others.

Model checking / Debugging

To run and debug this project, we will be using the Mace modelchecker. To setup your environment for model checking:

Useful hints:

Submission and Grading:

Submit only the file HW3ByzantineAgreement.mac, using BlackBoard. You will find the submission section in the "Assignments" section of BlackBoard for the class. Submissions will be graded according to this grading rubric (TXT).