CCF icon indicating copy to clipboard operation
CCF copied to clipboard

[Minor] Former candidate can vote twice in one term

Open heidihoward opened this issue 1 year ago • 0 comments

Former candidates can vote twice in one term in CCF Raft. This is not a safe violation as it cannot lead to two leaders in a term but it is something we might want to address at some point (or we will need to update the spec accordingly)

Steps:

  1. Node A becomes a candidate in some term, say 3
  2. However, another node (node B) is elected leader of term 3
  3. Node B sends an AE message to node A in term 3. Node A will step down to a follower in term 3

In the process of stepping down, raft.h calls become_aware_of_new_term and the voted_for field is reset, allowing the node to vote again. https://github.com/microsoft/CCF/blob/61d6c1824f80d4714d9006b5292f2cff57473d5a/src/consensus/aft/raft.h#L1017-L1012

This report is just based of code inspection, it would be useful to generate a trace of this in practice

heidihoward avatar Jan 05 '24 16:01 heidihoward