TheStellar Consensus Protocol 23 Variable Meaning ' Currentphase:oneof PREPARE, CONFIRM,or EXTERNALIZE b Current ballot that node v is attempting to prepare and commit (b ≠ 0) ¨ ¨ p ,p Thetwohighestballots accepted as prepared such that p ⋦ p, where ¨ ¨ p =0orp=p =0iftherearenosuchballots c,ℎ In PREPARE: ℎ is the highest ballot confirmed as prepared, or 0 if none; if c ≠ 0, then c is lowest and ℎ the highest ballot for which v has voted commit and not accepted abort. In CONFIRM: lowest, highest ballot for which v accepted commit In EXTERNALIZE: lowest, highest ballot for which v confirmed commit Invariant: if c ≠ 0, then c ≲ ℎ ≲ b. z Value to use in next ballot. If ℎ = 0, then z is the composite value (see Section 6.1); otherwise, z = ℎ.x. M Setofthelatestballotmessageseenfromeachnode Fig. 16. Ballot state maintained by each node v for each slot ¨ PREPARE vibpp c.nℎ.nD This is a message from node v about slot i. D specifies Q(v). The other fields reflect v’s state. Values c.x and ℎ.x are elided as c.x = ℎ.x = b.x when c.n ≠ 0. This concrete message encodes a host of conceptual statements, as follows: ¨ ¨ ¨ — {abortb ∨ accept(abort b ) ∣ b ⋦ b} (a vote to prepare b) — {accept(abort b¨) ∣ b¨ ⋦ p} (a vote to confirm p is prepared) ¨ ¨ ¨ ¨ — {accept(abort b ) ∣ b ⋦ p } (a vote to confirm p is prepared) ¨ ¨ — {commitb ∣c.n≠0 ∧ c ≲b ≲ℎ} (a vote to commit c,…,ℎ if c ≠ 0) CONFIRMvibp.nc.nℎ.nD Sent by v to try to externalize b.x for slot i after accepting a commit. Implies ¨ ¨ p.x = c.x = ℎ.x = b.x in v’s state. For convenience, we also say p = 0 (p is irrelevant after accepting commit). D specifies Q(v) as above. Encodes: — Everythingimplied by PREPARE v i ⟨∞,b.x⟩ p 0 c.n ∞ D ¨ ¨ — {accept(commitb ) ∣ c ≲ b ≲ ℎ} (a vote to confirm commit c,…,ℎ) EXTERNALIZE vixc.nℎ.nD After v confirms commit ⟨c.n,x⟩ for slot i and externalizes value x, this mes- sage helps other nodes externalize x. Implies c = ⟨c.n,x⟩ and ℎ = ⟨ℎ.n,x⟩. For ¨ convenience, we also say b = p = ℎ = ⟨∞,x⟩, and p = 0. Encodes: — Everythingimplied by CONFIRM v i ⟨∞,x⟩ ∞ c.n ∞ D — Everythingimplied by CONFIRM v i ⟨∞,x⟩ ∞ c.n ℎ.n {{v}} Fig. 17. Messages in SCP’s ballot protocol have participated in ratifying commit c—code must ensure c ≲ ℎ ≲ b. This invariant guarantees a node can always legally vote to prepare its current ballot b. Figure 17 shows the three ballot protocol messages, with ' determining which one of the three a node can send. Ballot messages may overlap with nomination messages, so that, when ℎ = 0, a node may update z in response to a NOMINATE message. Note
The Stellar Consensus Protocol Page 23 Page 25