Skip to content

Commit

Permalink
WIP: Fast path
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Alexander Kuppe <[email protected]>
  • Loading branch information
lemmy committed Dec 7, 2024
1 parent b9ec351 commit ac5c6c1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pirateship.tla
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ CheckViewStability(p) ==
\A q \in Q:
prepareQC'[p][q] >= SelectInSeq(log[p], inView)

HighestUnanimity(l, v) ==
LET idx == SelectLastInSeq(l, LAMBDA e: e.byzQCVotes = R /\ e.view = v)
IN IF idx = 0 THEN {0} ELSE l[idx].byzQC

\* Primary p receiving votes from replica r
\* Compare: src/consensus/steady_state.rs#do_process_vote
ReceiveVote(p, r) ==
Expand All @@ -323,9 +327,11 @@ ReceiveVote(p, r) ==
/\ IF viewStable'[p] THEN
/\ crashCommitIndex' = [crashCommitIndex EXCEPT ![p] =
MaxQuorum(CQ, log[p], prepareQC'[p], @)]
\* Compare: ssrc/consensus/commit.rs#maybe_byzantine_commit
/\ byzCommitIndex' = [byzCommitIndex EXCEPT ![p] =
HighestByzQC(SubSeq(log[p],1,MaxQuorum(BQ, log[p], prepareQC'[p], 0)))]
\* Compare: src/consensus/commit.rs#maybe_byzantine_commit
/\ LET bci == HighestByzQC(SubSeq(log[p], 1, MaxQuorum(BQ, log[p], prepareQC'[p], 0)))
\* Compare: src/consensus/commit.rs#maybe_byzantine_commit_by_fast_path
bciFastPath == HighestUnanimity(log[p], view[p])
IN byzCommitIndex' = [byzCommitIndex EXCEPT ![p] = Max(bciFastPath \cup {bci}) ]
ELSE UNCHANGED <<crashCommitIndex, byzCommitIndex>>
/\ UNCHANGED <<view, log, primary, byzActions>>

Expand Down

0 comments on commit ac5c6c1

Please sign in to comment.