Consensus by majority over cluster


In go-libp2p-raft, when consensus happens over a state change, the leader needs confirmation from a majority of nodes. However, I want to add a condition (check against a condition) in other nodes before applying the change and provide confirmation. If majority of nodes think that the condition is not met, the state needs to be reverted. I believe libp2p-raft has that feature somewhere, but I could not find where I need to put that check. Can someone guide me, please?

In Raft the leader is god and the leader is the only peer to decide what goes and what doesn’t go into the Log.

It is not that the leader needs confirmation or agreement, but rather just acknowledgment that what was committed by the leader was received, whatever it is (the protocol is about electing a leader that takes decisions, not about taking every decision by majority).

If one of the Raft nodes did not agree with it, it can’t do anything. Only the leader could potentially rollback or undo the operation.

You may think that you can put some logic and at least block progress if nodes do not agree with something (or trigger a re-election), but you would have to work that out directly in the hashicorp.Raft library. As it is, the leader election/commit logic is agnostic of whatever is being put in the log.

In any case, Raft is not byzantine fault tolerant. It is not a protocol that can tolerate misbehaving nodes. It is just designed to tolerate failures that are benevolent, not malicious.

1 Like