Assignment 2
Assignment 2
//
//
//
//
//
Each node should succeed in achieving consensus with a network in which its peers are other nodes
running the same code. Your algorithm should be designed such that a network of nodes receiving
different sets of transactions can agree on a set to be accepted. We will be providing a Simulation
class that generates a random trust graph. There will be a set number of rounds where during each
round, your nodes will broadcast their proposal to their followers and at the end of the round, should
have reached a consensus on what transactions should be agreed upon.
Each node will be given its list of followees via a boolean array whose indices correspond to nodes in
the graph. A true at index i indicates that node i is a followee, false otherwise. That node will also
be given a list of transactions (its proposal list) that it can broadcast to its followers. Generating the
initial transactions/proposal list will not be your responsibility. Assume that all transactions are valid
and that invalid transactions cannot be created.
In testing, the nodes running your code may encounter a number (up to 45%) of malicious nodes that
do not cooperate with your consensus algorithm. Nodes of your design should be able to withstand as
many malicious nodes as possible and still achieve consensus. Malicious nodes may have arbitrary
behavior. For instance, among other things, a malicious node might:
be functionally dead and never actually broadcast any transactions.
constantly broadcasts its own set of transactions and never accept transactions given to it.
change behavior between rounds to avoid detection.
You will be provided the following files:
Node.java
CompliantNode.java
Candidate.java
MaliciousNode.java
Simulation.java
a basic graph generator that you may use to run your own simulations
with varying graph parameters (described below) and test your
CompliantNode class
Transaction.java
Your focus will be on developing a robust CompliantNode class that will work in all combinations of
the graph parameters. At the end of each round, your node will see the list of transactions that were
broadcast to it.
Each test is measured based on
- How large a set of nodes have reached consensus. A set of nodes only counts as having
reached consensus if they all output the same list of transactions.
- The size of the set that consensus is reached on. You should strive to make the consensus set
of transactions as large as possible.
- Execution time, which should be within reason (if your code takes too long, the grading script
will time out and you will be able to resubmit your code).
Some Hints:
Your node will not know the network topology and should do its best to work in the general
case. That said, be aware of how different topology might impact how you want to include
transactions in your picture of consensus.
Your CompliantNode code can assume that all Transactions it sees are valid -- the simulation
code will only send you valid transactions (both initially and between rounds) and only the
simulation code has the ability to create valid transactions.
Ignore pathological cases that occur with extremely low probability, for example where a
compliant node happens to pair with only malicious nodes. We will make sure that the actual
tests cases do not have such scenarios.