Skip to content

Commit e3e0b65

Browse files
committed
models: adjust MoreThanFNodesCommitted check
Based on the neo-project/neo-modules#792 (comment), the definition of MoreThanFNodesCommitted should be adjusted to match the core algorithm as it's the key factor of the four-good-nodes liveness lock scenario. There following change is made: * We consider the node to be "Committed" if it has the Commit message sent at _any_ view. If the good node has committed, then we know for sure that it won't go further to the next consensus round and can rely on this information. The thing that remains the same is that we do not conu "lost" nodes, because this information can't be reliably trusted. See the comment inside the commit. Based on this adjustment, the first liveness lock scenario mentioned in neo-project/neo-modules#792 (comment) ("Liveness lock with four non-faulty nodes") needs to include one more step to enter a deadlock: one of the replicas that in the "cv" state must die. Moreover, there's another liveness lock scenario when one of the nodes is in the RMDead list, i.e. can "die" at any moment. Consider running the base model specification with the following configuration: ``` RM RMFault RMDead MaxView {0, 1, 2, 3} {} {0} 2 ```
1 parent 39e3e95 commit e3e0b65

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

formal-models/dbft/dbft.tla

+12-4
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,19 @@ GetPrimary(view) == CHOOSE r \in RM : view % N = r
103103
GetNewView(oldView) == oldView + 1
104104

105105
\* CountCommitted returns the number of nodes that have sent the Commit message
106-
\* in the current round (as the node r sees it).
107-
CountCommitted(r) == Cardinality({rm \in RM : Cardinality({msg \in msgs : msg.rm = rm /\ msg.type = "Commit" /\ msg.view = rmState[r].view}) /= 0})
106+
\* in the current round or in some other round.
107+
CountCommitted(r) == Cardinality({rm \in RM : Cardinality({msg \in msgs : msg.rm = rm /\ msg.type = "Commit"}) /= 0})
108108

109109
\* MoreThanFNodesCommitted returns whether more than F nodes have been committed
110110
\* in the current round (as the node r sees it).
111+
\*
112+
\* IMPORTANT NOTE: we intentionally do not add the "lost" nodes calculation to the specification, and here's
113+
\* the reason: from the node's point of view we can't reliably check that some neighbour is completely
114+
\* out of the network. It is possible that the node doesn't receive consensus messages from some other member
115+
\* due to network delays. On the other hand, real nodes can go down at any time. The absence of the
116+
\* member's message doesn't mean that the member is out of the network, we never can be sure about
117+
\* that, thus, this information is unreliable and can't be trusted during the consensus process.
118+
\* What can be trusted is whether there's a Commit message from some member was received by the node.
111119
MoreThanFNodesCommitted(r) == CountCommitted(r) > F
112120

113121
\* PrepareRequestSentOrReceived denotes whether there's a PrepareRequest
@@ -147,7 +155,7 @@ RMSendPrepareResponse(r) ==
147155
\* condition specifies only the thing that may happen given some particular set of enabling conditions.
148156
\* Thus, we've extended the NotAcceptingPayloadsDueToViewChanging condition to consider only MoreThanFNodesCommitted.
149157
\* It should be noted that the logic of MoreThanFNodesCommittedOrLost can't be reliable in detecting lost nodes
150-
\* (even with neo-project/neo#2057), because real nodes can go down at any time.
158+
\* (even with neo-project/neo#2057), because real nodes can go down at any time. See the comment abothe the MoreThanFNodesCommitted.
151159
\/ /\ rmState[r].type = "cv"
152160
/\ MoreThanFNodesCommitted(r)
153161
/\ \neg IsPrimary(r)
@@ -374,7 +382,7 @@ THEOREM Spec => [](TypeOK /\ InvTwoBlocksAccepted /\ InvFaultNodesCount)
374382

375383
=============================================================================
376384
\* Modification History
377-
\* Last modified Mon Feb 27 16:46:19 MSK 2023 by root
385+
\* Last modified Mon Mar 06 15:28:34 MSK 2023 by root
378386
\* Last modified Fri Feb 17 15:47:41 MSK 2023 by anna
379387
\* Last modified Sat Jan 21 01:26:16 MSK 2023 by rik
380388
\* Created Thu Dec 15 16:06:17 MSK 2022 by anna

0 commit comments

Comments
 (0)