|
@ -166,33 +166,25 @@ VARIABLES |
|
|
evidence, \* the messages that were used by the correct processes to make transitions |
|
|
evidence, \* the messages that were used by the correct processes to make transitions |
|
|
\* @type: ACTION; |
|
|
\* @type: ACTION; |
|
|
action, \* we use this variable to see which action was taken |
|
|
action, \* we use this variable to see which action was taken |
|
|
\* @type: PROCESS -> Set(PROPMESSAGE); |
|
|
|
|
|
receivedTimelyProposal, \* used to keep track when a process receives a timely PROPOSAL message |
|
|
|
|
|
\* @type: <<ROUND,PROCESS>> -> TIME; |
|
|
\* @type: <<ROUND,PROCESS>> -> TIME; |
|
|
inspectedProposal \* used to keep track when a process tries to receive a message |
|
|
|
|
|
|
|
|
proposalReceptionTime \* used to keep track when a process receives a message |
|
|
|
|
|
|
|
|
\* Action is excluded from the tuple, because it always changes |
|
|
\* Action is excluded from the tuple, because it always changes |
|
|
bookkeepingVars == |
|
|
bookkeepingVars == |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
evidence, (*action,*) receivedTimelyProposal, |
|
|
|
|
|
inspectedProposal>> |
|
|
|
|
|
|
|
|
evidence, (*action,*) proposalReceptionTime>> |
|
|
|
|
|
|
|
|
\* Invariant support |
|
|
\* Invariant support |
|
|
VARIABLES |
|
|
VARIABLES |
|
|
\* @type: ROUND -> TIME; |
|
|
|
|
|
|
|
|
\* @type: <<ROUND, PROCESS>> -> TIME; |
|
|
beginRound, \* the minimum of the local clocks at the time any process entered a new round |
|
|
beginRound, \* the minimum of the local clocks at the time any process entered a new round |
|
|
\* @type: PROCESS -> TIME; |
|
|
\* @type: PROCESS -> TIME; |
|
|
endConsensus, \* the local time when a decision is made |
|
|
endConsensus, \* the local time when a decision is made |
|
|
\* @type: ROUND -> TIME; |
|
|
\* @type: ROUND -> TIME; |
|
|
lastBeginRound, \* the maximum of the local clocks in each round |
|
|
|
|
|
\* @type: ROUND -> TIME; |
|
|
|
|
|
proposalTime, \* the real time when a proposer proposes in a round |
|
|
|
|
|
\* @type: ROUND -> TIME; |
|
|
|
|
|
proposalReceivedTime \* the real time when a correct process first receives a proposal message in a round |
|
|
|
|
|
|
|
|
lastBeginRound \* the maximum of the local clocks in each round |
|
|
|
|
|
|
|
|
invariantVars == |
|
|
invariantVars == |
|
|
<<beginRound, endConsensus, lastBeginRound, |
|
|
|
|
|
proposalTime, proposalReceivedTime>> |
|
|
|
|
|
|
|
|
<<beginRound, endConsensus, lastBeginRound>> |
|
|
|
|
|
|
|
|
(* to see a type invariant, check TendermintAccInv3 *) |
|
|
(* to see a type invariant, check TendermintAccInv3 *) |
|
|
|
|
|
|
|
@ -294,15 +286,14 @@ Init == |
|
|
/\ msgsPropose \in [Rounds -> SUBSET AllFaultyProposals] |
|
|
/\ msgsPropose \in [Rounds -> SUBSET AllFaultyProposals] |
|
|
/\ msgsPrevote \in [Rounds -> SUBSET AllFaultyPrevotes] |
|
|
/\ msgsPrevote \in [Rounds -> SUBSET AllFaultyPrevotes] |
|
|
/\ msgsPrecommit \in [Rounds -> SUBSET AllFaultyPrecommits] |
|
|
/\ msgsPrecommit \in [Rounds -> SUBSET AllFaultyPrecommits] |
|
|
/\ receivedTimelyProposal = [p \in Corr |-> {}] |
|
|
|
|
|
/\ inspectedProposal = [r \in Rounds, p \in Corr |-> NilTimestamp] |
|
|
|
|
|
|
|
|
/\ proposalReceptionTime = [r \in Rounds, p \in Corr |-> NilTimestamp] |
|
|
/\ BenignRoundsInMessages(msgsPropose) |
|
|
/\ BenignRoundsInMessages(msgsPropose) |
|
|
/\ BenignRoundsInMessages(msgsPrevote) |
|
|
/\ BenignRoundsInMessages(msgsPrevote) |
|
|
/\ BenignRoundsInMessages(msgsPrecommit) |
|
|
/\ BenignRoundsInMessages(msgsPrecommit) |
|
|
/\ evidence = {} |
|
|
/\ evidence = {} |
|
|
/\ action' = "Init" |
|
|
|
|
|
|
|
|
/\ action = "Init" |
|
|
/\ beginRound = |
|
|
/\ beginRound = |
|
|
[r \in Rounds |-> |
|
|
|
|
|
|
|
|
[r \in Rounds, c \in Corr |-> |
|
|
IF r = 0 |
|
|
IF r = 0 |
|
|
THEN Min({localClock[p] : p \in Corr}) |
|
|
THEN Min({localClock[p] : p \in Corr}) |
|
|
ELSE MaxTimestamp |
|
|
ELSE MaxTimestamp |
|
@ -314,8 +305,6 @@ Init == |
|
|
THEN Max({localClock[p] : p \in Corr}) |
|
|
THEN Max({localClock[p] : p \in Corr}) |
|
|
ELSE NilTimestamp |
|
|
ELSE NilTimestamp |
|
|
] |
|
|
] |
|
|
/\ proposalTime = [r \in Rounds |-> NilTimestamp] |
|
|
|
|
|
/\ proposalReceivedTime = [r \in Rounds |-> NilTimestamp] |
|
|
|
|
|
|
|
|
|
|
|
(************************ MESSAGE PASSING ********************************) |
|
|
(************************ MESSAGE PASSING ********************************) |
|
|
\* @type: (PROCESS, ROUND, PROPOSAL, ROUND) => Bool; |
|
|
\* @type: (PROCESS, ROUND, PROPOSAL, ROUND) => Bool; |
|
@ -391,7 +380,7 @@ StartRound(p, r) == |
|
|
/\ round' = [round EXCEPT ![p] = r] |
|
|
/\ round' = [round EXCEPT ![p] = r] |
|
|
/\ step' = [step EXCEPT ![p] = "PROPOSE"] |
|
|
/\ step' = [step EXCEPT ![p] = "PROPOSE"] |
|
|
\* We only need to update (last)beginRound[r] once a process enters round `r` |
|
|
\* We only need to update (last)beginRound[r] once a process enters round `r` |
|
|
/\ beginRound' = [beginRound EXCEPT ![r] = Min2(@, localClock[p])] |
|
|
|
|
|
|
|
|
/\ beginRound' = [beginRound EXCEPT ![r,p] = Min2(@, localClock[p])] |
|
|
/\ lastBeginRound' = [lastBeginRound EXCEPT ![r] = Max2(@, localClock[p])] |
|
|
/\ lastBeginRound' = [lastBeginRound EXCEPT ![r] = Max2(@, localClock[p])] |
|
|
|
|
|
|
|
|
\* lines 14-19, a proposal may be sent later |
|
|
\* lines 14-19, a proposal may be sent later |
|
@ -403,7 +392,6 @@ InsertProposal(p) == |
|
|
\* if the proposer is sending a proposal, then there are no other proposals |
|
|
\* if the proposer is sending a proposal, then there are no other proposals |
|
|
\* by the correct processes for the same round |
|
|
\* by the correct processes for the same round |
|
|
/\ \A m \in msgsPropose[r]: m.src /= p |
|
|
/\ \A m \in msgsPropose[r]: m.src /= p |
|
|
\* /\ localClock[p] > |
|
|
|
|
|
/\ \E v \in ValidValues: |
|
|
/\ \E v \in ValidValues: |
|
|
LET proposal == |
|
|
LET proposal == |
|
|
IF validValue[p] /= NilProposal |
|
|
IF validValue[p] /= NilProposal |
|
@ -411,17 +399,14 @@ InsertProposal(p) == |
|
|
ELSE Proposal(v, localClock[p], r) |
|
|
ELSE Proposal(v, localClock[p], r) |
|
|
IN |
|
|
IN |
|
|
/\ BroadcastProposal(p, r, proposal, validRound[p]) |
|
|
/\ BroadcastProposal(p, r, proposal, validRound[p]) |
|
|
/\ proposalTime' = [proposalTime EXCEPT ![r] = realTime] |
|
|
|
|
|
/\ UNCHANGED <<temporalVars, coreVars>> |
|
|
/\ UNCHANGED <<temporalVars, coreVars>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<(*msgsPropose,*) msgsPrevote, msgsPrecommit, |
|
|
<<(*msgsPropose,*) msgsPrevote, msgsPrecommit, |
|
|
evidence, receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
/\ UNCHANGED |
|
|
|
|
|
<<beginRound, endConsensus, lastBeginRound, |
|
|
|
|
|
(*proposalTime,*) proposalReceivedTime>> |
|
|
|
|
|
|
|
|
evidence, proposalReceptionTime>> |
|
|
|
|
|
/\ UNCHANGED invariantVars |
|
|
/\ action' = "InsertProposal" |
|
|
/\ action' = "InsertProposal" |
|
|
|
|
|
|
|
|
\* a new action used to filter messages that are not on time |
|
|
|
|
|
|
|
|
\* a new action used to register the proposal and note the reception time. |
|
|
\* [PBTS-RECEPTION-STEP.0] |
|
|
\* [PBTS-RECEPTION-STEP.0] |
|
|
\* @type: (PROCESS) => Bool; |
|
|
\* @type: (PROCESS) => Bool; |
|
|
ReceiveProposal(p) == |
|
|
ReceiveProposal(p) == |
|
@ -439,30 +424,13 @@ ReceiveProposal(p) == |
|
|
] |
|
|
] |
|
|
IN |
|
|
IN |
|
|
/\ msg \in msgsPropose[round[p]] |
|
|
/\ msg \in msgsPropose[round[p]] |
|
|
/\ inspectedProposal[r,p] = NilTimestamp |
|
|
|
|
|
/\ msg \notin receivedTimelyProposal[p] |
|
|
|
|
|
/\ inspectedProposal' = [inspectedProposal EXCEPT ![r,p] = localClock[p]] |
|
|
|
|
|
/\ LET |
|
|
|
|
|
isTimely == IsTimely(localClock[p], t) |
|
|
|
|
|
IN |
|
|
|
|
|
\/ /\ isTimely |
|
|
|
|
|
/\ receivedTimelyProposal' = [receivedTimelyProposal EXCEPT ![p] = @ \union {msg}] |
|
|
|
|
|
/\ LET |
|
|
|
|
|
isNilTimestamp == proposalReceivedTime[r] = NilTimestamp |
|
|
|
|
|
IN |
|
|
|
|
|
\/ /\ isNilTimestamp |
|
|
|
|
|
/\ proposalReceivedTime' = [proposalReceivedTime EXCEPT ![r] = realTime] |
|
|
|
|
|
\/ /\ ~isNilTimestamp |
|
|
|
|
|
/\ UNCHANGED proposalReceivedTime |
|
|
|
|
|
\/ /\ ~isTimely |
|
|
|
|
|
/\ UNCHANGED <<receivedTimelyProposal, proposalReceivedTime>> |
|
|
|
|
|
|
|
|
/\ proposalReceptionTime[r,p] = NilTimestamp |
|
|
|
|
|
/\ proposalReceptionTime' = [proposalReceptionTime EXCEPT ![r,p] = localClock[p]] |
|
|
/\ UNCHANGED <<temporalVars, coreVars>> |
|
|
/\ UNCHANGED <<temporalVars, coreVars>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
evidence(*, receivedTimelyProposal, inspectedProposal*)>> |
|
|
|
|
|
/\ UNCHANGED |
|
|
|
|
|
<<beginRound, endConsensus, lastBeginRound, |
|
|
|
|
|
proposalTime(*, proposalReceivedTime*)>> |
|
|
|
|
|
|
|
|
evidence(*, proposalReceptionTime*)>> |
|
|
|
|
|
/\ UNCHANGED invariantVars |
|
|
/\ action' = "ReceiveProposal" |
|
|
/\ action' = "ReceiveProposal" |
|
|
|
|
|
|
|
|
\* lines 22-27 |
|
|
\* lines 22-27 |
|
@ -487,10 +455,17 @@ UponProposalInPropose(p) == |
|
|
validRound |-> NilRound |
|
|
validRound |-> NilRound |
|
|
] |
|
|
] |
|
|
IN |
|
|
IN |
|
|
/\ msg \in receivedTimelyProposal[p] \* updated line 22 |
|
|
|
|
|
/\ evidence' = {msg} \union evidence |
|
|
/\ evidence' = {msg} \union evidence |
|
|
/\ LET mid == (* line 23 *) |
|
|
/\ LET mid == (* line 23 *) |
|
|
IF IsValid(prop) /\ (lockedRound[p] = NilRound \/ lockedValue[p] = v) |
|
|
|
|
|
|
|
|
IF |
|
|
|
|
|
\* Timeliness is checked against the process time, as was |
|
|
|
|
|
\* recorded in proposalReceptionTime, not as it is now. |
|
|
|
|
|
\* In the implementation, if the proposal is not timely, then we prevote |
|
|
|
|
|
\* nil. In the natural-language specification, nothing happens. |
|
|
|
|
|
\* This specification maintains consistency with the implementation. |
|
|
|
|
|
/\ IsTimely( proposalReceptionTime[r, p], t) \* updated line 22 |
|
|
|
|
|
/\ IsValid(prop) |
|
|
|
|
|
/\ (lockedRound[p] = NilRound \/ lockedValue[p] = v) |
|
|
THEN Id(prop) |
|
|
THEN Id(prop) |
|
|
ELSE NilProposal |
|
|
ELSE NilProposal |
|
|
IN |
|
|
IN |
|
@ -502,7 +477,7 @@ UponProposalInPropose(p) == |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, (*msgsPrevote,*) msgsPrecommit, |
|
|
<<msgsPropose, (*msgsPrevote,*) msgsPrecommit, |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ action' = "UponProposalInPropose" |
|
|
/\ action' = "UponProposalInPropose" |
|
|
|
|
|
|
|
|
\* lines 28-33 |
|
|
\* lines 28-33 |
|
@ -547,7 +522,7 @@ UponProposalInProposeAndPrevote(p) == |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, (*msgsPrevote,*) msgsPrecommit, |
|
|
<<msgsPropose, (*msgsPrevote,*) msgsPrecommit, |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ action' = "UponProposalInProposeAndPrevote" |
|
|
/\ action' = "UponProposalInProposeAndPrevote" |
|
|
|
|
|
|
|
|
\* lines 34-35 + lines 61-64 (onTimeoutPrevote) |
|
|
\* lines 34-35 + lines 61-64 (onTimeoutPrevote) |
|
@ -568,7 +543,7 @@ UponQuorumOfPrevotesAny(p) == |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, msgsPrevote, (*msgsPrecommit, *) |
|
|
<<msgsPropose, msgsPrevote, (*msgsPrecommit, *) |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ action' = "UponQuorumOfPrevotesAny" |
|
|
/\ action' = "UponQuorumOfPrevotesAny" |
|
|
|
|
|
|
|
|
\* lines 36-46 |
|
|
\* lines 36-46 |
|
@ -616,7 +591,7 @@ UponProposalInPrevoteOrCommitAndPrevote(p) == |
|
|
lockedRound, validValue, validRound*)>> |
|
|
lockedRound, validValue, validRound*)>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, msgsPrevote, (*msgsPrecommit, *) |
|
|
<<msgsPropose, msgsPrevote, (*msgsPrecommit, *) |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ action' = "UponProposalInPrevoteOrCommitAndPrevote" |
|
|
/\ action' = "UponProposalInPrevoteOrCommitAndPrevote" |
|
|
|
|
|
|
|
|
\* lines 47-48 + 65-67 (onTimeoutPrecommit) |
|
|
\* lines 47-48 + 65-67 (onTimeoutPrecommit) |
|
@ -632,14 +607,13 @@ UponQuorumOfPrecommitsAny(p) == |
|
|
/\ StartRound(p, round[p] + 1) |
|
|
/\ StartRound(p, round[p] + 1) |
|
|
/\ UNCHANGED temporalVars |
|
|
/\ UNCHANGED temporalVars |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<(*beginRound,*) endConsensus, (*lastBeginRound,*) |
|
|
|
|
|
proposalTime, proposalReceivedTime>> |
|
|
|
|
|
|
|
|
<<(*beginRound,*) endConsensus(*, lastBeginRound*)>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<(*round, step,*) decision, lockedValue, |
|
|
<<(*round, step,*) decision, lockedValue, |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ action' = "UponQuorumOfPrecommitsAny" |
|
|
/\ action' = "UponQuorumOfPrecommitsAny" |
|
|
|
|
|
|
|
|
\* lines 49-54 |
|
|
\* lines 49-54 |
|
@ -664,7 +638,7 @@ UponProposalInPrecommitNoDecision(p) == |
|
|
] |
|
|
] |
|
|
IN |
|
|
IN |
|
|
/\ msg \in msgsPropose[r] \* line 49 |
|
|
/\ msg \in msgsPropose[r] \* line 49 |
|
|
/\ inspectedProposal[r,p] /= NilTimestamp \* Keep? |
|
|
|
|
|
|
|
|
/\ proposalReceptionTime[r,p] /= NilTimestamp \* Keep? |
|
|
/\ LET PV == { m \in msgsPrecommit[r]: m.id = Id(prop) } IN |
|
|
/\ LET PV == { m \in msgsPrecommit[r]: m.id = Id(prop) } IN |
|
|
/\ Cardinality(PV) >= THRESHOLD2 \* line 49 |
|
|
/\ Cardinality(PV) >= THRESHOLD2 \* line 49 |
|
|
/\ evidence' = PV \union {msg} \union evidence |
|
|
/\ evidence' = PV \union {msg} \union evidence |
|
@ -679,10 +653,9 @@ UponProposalInPrecommitNoDecision(p) == |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<beginRound, (*endConsensus,*) lastBeginRound, |
|
|
|
|
|
proposalTime, proposalReceivedTime>> |
|
|
|
|
|
|
|
|
<<beginRound, (*endConsensus,*) lastBeginRound>> |
|
|
/\ action' = "UponProposalInPrecommitNoDecision" |
|
|
/\ action' = "UponProposalInPrecommitNoDecision" |
|
|
|
|
|
|
|
|
\* the actions below are not essential for safety, but added for completeness |
|
|
\* the actions below are not essential for safety, but added for completeness |
|
@ -700,7 +673,7 @@ OnTimeoutPropose(p) == |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, (*msgsPrevote,*) msgsPrecommit, |
|
|
<<msgsPropose, (*msgsPrevote,*) msgsPrecommit, |
|
|
evidence, receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
evidence, proposalReceptionTime>> |
|
|
/\ action' = "OnTimeoutPropose" |
|
|
/\ action' = "OnTimeoutPropose" |
|
|
|
|
|
|
|
|
\* lines 44-46 |
|
|
\* lines 44-46 |
|
@ -718,7 +691,7 @@ OnQuorumOfNilPrevotes(p) == |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, msgsPrevote, (*msgsPrecommit,*) |
|
|
<<msgsPropose, msgsPrevote, (*msgsPrecommit,*) |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ action' = "OnQuorumOfNilPrevotes" |
|
|
/\ action' = "OnQuorumOfNilPrevotes" |
|
|
|
|
|
|
|
|
\* lines 55-56 |
|
|
\* lines 55-56 |
|
@ -733,14 +706,13 @@ OnRoundCatchup(p) == |
|
|
/\ StartRound(p, r) |
|
|
/\ StartRound(p, r) |
|
|
/\ UNCHANGED temporalVars |
|
|
/\ UNCHANGED temporalVars |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<(*beginRound,*) endConsensus, (*lastBeginRound,*) |
|
|
|
|
|
proposalTime, proposalReceivedTime>> |
|
|
|
|
|
|
|
|
<<(*beginRound,*) endConsensus(*, lastBeginRound*)>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<(*round, step,*) decision, lockedValue, |
|
|
<<(*round, step,*) decision, lockedValue, |
|
|
lockedRound, validValue, validRound>> |
|
|
lockedRound, validValue, validRound>> |
|
|
/\ UNCHANGED |
|
|
/\ UNCHANGED |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
<<msgsPropose, msgsPrevote, msgsPrecommit, |
|
|
(*evidence,*) receivedTimelyProposal, inspectedProposal>> |
|
|
|
|
|
|
|
|
(*evidence,*) proposalReceptionTime>> |
|
|
/\ action' = "OnRoundCatchup" |
|
|
/\ action' = "OnRoundCatchup" |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -810,6 +782,13 @@ AgreementOnValue == |
|
|
/\ decision[p] = Decision(prop, r1) |
|
|
/\ decision[p] = Decision(prop, r1) |
|
|
/\ decision[q] = Decision(prop, r2) |
|
|
/\ decision[q] = Decision(prop, r2) |
|
|
|
|
|
|
|
|
|
|
|
DisagreementOnValue == |
|
|
|
|
|
\E p, q \in Corr: |
|
|
|
|
|
\E p1 \in ValidProposals, p2 \in ValidProposals, r1 \in Rounds, r2 \in Rounds: |
|
|
|
|
|
/\ p1 /= p2 |
|
|
|
|
|
/\ decision[p] = Decision(p1, r1) |
|
|
|
|
|
/\ decision[q] = Decision(p2, r2) |
|
|
|
|
|
|
|
|
\* [PBTS-CONSENSUS-TIME-VALID.0] |
|
|
\* [PBTS-CONSENSUS-TIME-VALID.0] |
|
|
ConsensusTimeValid == |
|
|
ConsensusTimeValid == |
|
|
\A p \in Corr: |
|
|
\A p \in Corr: |
|
@ -819,7 +798,7 @@ ConsensusTimeValid == |
|
|
\* then |
|
|
\* then |
|
|
\* TODO: consider tighter bound where beginRound[pr] is replaced |
|
|
\* TODO: consider tighter bound where beginRound[pr] is replaced |
|
|
\* w/ MedianOfRound[pr] |
|
|
\* w/ MedianOfRound[pr] |
|
|
=> (/\ beginRound[pr] - Precision - Delay <= t |
|
|
|
|
|
|
|
|
=> (/\ beginRound[pr,p] - Precision - Delay <= t |
|
|
/\ t <= endConsensus[p] + Precision) |
|
|
/\ t <= endConsensus[p] + Precision) |
|
|
|
|
|
|
|
|
\* [PBTS-CONSENSUS-SAFE-VALID-CORR-PROP.0] |
|
|
\* [PBTS-CONSENSUS-SAFE-VALID-CORR-PROP.0] |
|
@ -831,53 +810,58 @@ ConsensusSafeValidCorrProp == |
|
|
(/\ Proposer[pr] \in Corr |
|
|
(/\ Proposer[pr] \in Corr |
|
|
/\ decision[p] = Decision(Proposal(v,t,pr), dr)) |
|
|
/\ decision[p] = Decision(Proposal(v,t,pr), dr)) |
|
|
\* then t is between the minimal and maximal initial local time |
|
|
\* then t is between the minimal and maximal initial local time |
|
|
=> /\ beginRound[pr] <= t |
|
|
|
|
|
|
|
|
=> /\ beginRound[pr, p] <= t |
|
|
/\ t <= lastBeginRound[pr] |
|
|
/\ t <= lastBeginRound[pr] |
|
|
|
|
|
|
|
|
\* [PBTS-CONSENSUS-REALTIME-VALID-CORR.0] |
|
|
|
|
|
ConsensusRealTimeValidCorr == |
|
|
|
|
|
\A r \in Rounds : |
|
|
|
|
|
\E p \in Corr, v \in ValidValues, t \in Timestamps, pr \in Rounds: |
|
|
|
|
|
(/\ decision[p] = Decision(Proposal(v,t,pr), r) |
|
|
|
|
|
/\ proposalTime[r] /= NilTimestamp) |
|
|
|
|
|
=> (/\ proposalTime[r] - Precision <= t |
|
|
|
|
|
/\ t <= proposalTime[r] + Precision) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\* @type: (PROPOSAL, ROUND) => Set(PREMESSAGE); |
|
|
|
|
|
POLSet(prop, rnd) == |
|
|
|
|
|
{ msg \in msgsPrevote[rnd]: msg.id = prop} |
|
|
|
|
|
\* @type: (Set(PREMESSAGE)) => Bool; |
|
|
|
|
|
IsValidPOL(s) == Cardinality(s) >= THRESHOLD2 |
|
|
|
|
|
|
|
|
|
|
|
\* @type: (Set(PREMESSAGE)) => Bool; |
|
|
|
|
|
ContainsPrevoteFromCorrect(set) == |
|
|
|
|
|
\E p \in Corr, msg \in set: msg.src = p |
|
|
|
|
|
|
|
|
|
|
|
\* [PBS-DERIVED-POL.1] |
|
|
|
|
|
DerivedProofOfLocks == |
|
|
|
|
|
\A r \in Rounds, prop \in ValidProposals: |
|
|
|
|
|
LET t == prop[2] IN |
|
|
|
|
|
LET PS == POLSet(prop, r) IN |
|
|
|
|
|
( |
|
|
|
|
|
/\ IsValidPOL(PS) |
|
|
|
|
|
/\ ContainsPrevoteFromCorrect(PS) |
|
|
|
|
|
) => |
|
|
|
|
|
\E rStar \in Rounds: |
|
|
|
|
|
LET PSStar == POLSet(prop, rStar) IN |
|
|
|
|
|
/\ rStar <= r |
|
|
|
|
|
/\ ContainsPrevoteFromCorrect(PSStar) |
|
|
|
|
|
/\ \E p \in Corr: IsTimely( proposalReceptionTime[rStar, p], t) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\* [PBTS-CONSENSUS-REALTIME-VALID-CORR.0] |
|
|
|
|
|
\* ConsensusRealTimeValidCorr == TODO? |
|
|
\* [PBTS-CONSENSUS-REALTIME-VALID.0] |
|
|
\* [PBTS-CONSENSUS-REALTIME-VALID.0] |
|
|
ConsensusRealTimeValid == |
|
|
|
|
|
\A t \in Timestamps, r \in Rounds : |
|
|
|
|
|
(\E p \in Corr, v \in ValidValues, pr \in Rounds : |
|
|
|
|
|
decision[p] = Decision(Proposal(v,t,pr), r)) |
|
|
|
|
|
=> /\ proposalReceivedTime[r] - Precision < t |
|
|
|
|
|
/\ t < proposalReceivedTime[r] + Precision + Delay |
|
|
|
|
|
|
|
|
\* ConsensusRealTimeValid == TODO? |
|
|
|
|
|
|
|
|
DecideAfterMin == TRUE |
|
|
DecideAfterMin == TRUE |
|
|
\* if decide => time > min |
|
|
\* if decide => time > min |
|
|
|
|
|
|
|
|
\* [PBTS-MSG-FAIR.0] |
|
|
\* [PBTS-MSG-FAIR.0] |
|
|
BoundedDelay == |
|
|
|
|
|
\A r \in Rounds : |
|
|
|
|
|
(/\ proposalTime[r] /= NilTimestamp |
|
|
|
|
|
/\ proposalTime[r] + Delay < realTime) |
|
|
|
|
|
=> \A p \in Corr: inspectedProposal[r,p] /= NilTimestamp |
|
|
|
|
|
|
|
|
\* BoundedDelay == TODO? |
|
|
|
|
|
|
|
|
\* [PBTS-CONSENSUS-TIME-LIVE.0] |
|
|
\* [PBTS-CONSENSUS-TIME-LIVE.0] |
|
|
ConsensusTimeLive == |
|
|
|
|
|
\A r \in Rounds, p \in Corr : |
|
|
|
|
|
(/\ proposalTime[r] /= NilTimestamp |
|
|
|
|
|
/\ proposalTime[r] + Delay < realTime |
|
|
|
|
|
/\ Proposer[r] \in Corr |
|
|
|
|
|
/\ round[p] <= r) |
|
|
|
|
|
=> \E msg \in RoundProposals(r) : msg \in receivedTimelyProposal[p] |
|
|
|
|
|
|
|
|
\* ConsensusTimeLive == TODO? |
|
|
|
|
|
|
|
|
\* a conjunction of all invariants |
|
|
\* a conjunction of all invariants |
|
|
Inv == |
|
|
Inv == |
|
|
/\ AgreementOnValue |
|
|
/\ AgreementOnValue |
|
|
/\ ConsensusTimeValid |
|
|
/\ ConsensusTimeValid |
|
|
/\ ConsensusSafeValidCorrProp |
|
|
/\ ConsensusSafeValidCorrProp |
|
|
\* /\ ConsensusRealTimeValid |
|
|
|
|
|
\* /\ ConsensusRealTimeValidCorr |
|
|
|
|
|
\* /\ BoundedDelay |
|
|
|
|
|
|
|
|
/\ DerivedProofOfLocks |
|
|
|
|
|
|
|
|
\* Liveness == |
|
|
\* Liveness == |
|
|
\* ConsensusTimeLive |
|
|
\* ConsensusTimeLive |
|
|