-
Notifications
You must be signed in to change notification settings - Fork 223
Add Vortex DSE specifications #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vasilisnasopoulos
wants to merge
5
commits into
tlaplus:master
Choose a base branch
from
vasilisnasopoulos:vortex-dse
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7da2f4d
Add Vortex DSE specifications
vasilisnasopoulos d8ba318
Move model-checking bounds out of the specifications
vasilisnasopoulos 9b3d8a9
Apply the TLA+ review guidelines
vasilisnasopoulos 98f7f5b
Act on the review
vasilisnasopoulos 1979e0a
Make the TTL module earn its place
vasilisnasopoulos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| \* Safety model. The horizon is imposed inside MCTick; see the module | ||
| \* header for why a state constraint does not work here. | ||
|
|
||
| SPECIFICATION MCSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1, m2} | ||
| MaxSlot = 2 | ||
|
|
||
| INVARIANT MCTypeInvariant | ||
| INVARIANT NoFutureAdmission | ||
| INVARIANT ExactlyOncePerNode | ||
| INVARIANT NoPhantomProcess | ||
| INVARIANT DecisionLocalityOnly | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| ---- MODULE MC_Vortex_DSE_CSlot ---- | ||
| (***************************************************************************) | ||
| (* TLC harness for Vortex_DSE_CSlot. *) | ||
| (* *) | ||
| (* The specification has no slot horizon: Tick is unbounded and the *) | ||
| (* adversary may forge any slot in Nat. The horizon is a model-checking *) | ||
| (* concern and lives here. *) | ||
| (* *) | ||
| (* It is imposed inside MCTick rather than as a state CONSTRAINT. A *) | ||
| (* constraint was tried first, as the review guidelines prefer, but TLC *) | ||
| (* evaluates invariants on the state that crosses the boundary before the *) | ||
| (* constraint discards it: with MaxSlot = 2 a Tick produces current_slot = *) | ||
| (* 3, and any invariant mentioning the horizon fails there. Bounding the *) | ||
| (* ticker instead keeps the reachable graph inside the horizon. *) | ||
| (* *) | ||
| (* It also avoids a second problem in the liveness model, where discarding *) | ||
| (* successor states can mask or invent violations of temporal properties. *) | ||
| (* *) | ||
| (* MCNext restricts the forged slot as well, because TLC cannot enumerate *) | ||
| (* Nat. *) | ||
| (***************************************************************************) | ||
| EXTENDS Vortex_DSE_CSlot | ||
|
|
||
| CONSTANT MaxSlot | ||
|
|
||
| ASSUME MaxSlotAssumption == MaxSlot \in Nat | ||
|
|
||
| Slots == 0..MaxSlot | ||
|
|
||
| MCMsgRecord == [id: MsgIDs, cslot: Slots] | ||
|
|
||
| \* The ticker stops at the horizon. | ||
| MCTick == | ||
| /\ current_slot < MaxSlot | ||
| /\ Tick | ||
|
|
||
| MCNext == | ||
| \/ \E id \in MsgIDs, k \in Slots : Send(id, k) | ||
| \/ \E n \in Nodes, m \in network : Process(n, m) | ||
| \/ \E n \in Nodes : Crash(n) | ||
| \/ \E n \in Nodes : Rejoin(n) | ||
| \/ MCTick | ||
|
|
||
| MCSpec == Init /\ [][MCNext]_vars | ||
|
|
||
| \* Type correctness within the horizon. TLC cannot evaluate the | ||
| \* specification's own TypeInvariant, whose MsgRecord ranges over Nat. | ||
| MCTypeInvariant == | ||
| /\ current_slot \in Slots | ||
| /\ network \subseteq MCMsgRecord | ||
| /\ processed \in [Nodes -> SUBSET MsgIDs] | ||
| /\ persisted \in [Nodes -> SUBSET MsgIDs] | ||
| /\ node_state \in [Nodes -> {Up, Down}] | ||
|
|
||
| ------------------------------------------------------------------------------- | ||
| (* LIVENESS HARNESS *) | ||
|
|
||
| \* Strong fairness on Process is necessary, not decorative: with weak | ||
| \* fairness the liveness model reports a temporal-property violation, | ||
| \* because a crash intermittently disables Process. | ||
| MCFairness == | ||
| /\ WF_vars(MCTick) | ||
| /\ \A n \in Nodes : WF_vars(Rejoin(n)) | ||
| /\ \A n \in Nodes : SF_vars(\E m \in network : Process(n, m)) | ||
|
|
||
| MCLiveSpec == Init /\ [][MCNext]_vars /\ MCFairness | ||
|
|
||
| \* Bounded counterpart of TickProgress, strengthened as suggested: once the | ||
| \* ticker reaches the horizon MCTick is permanently disabled, so the slot | ||
| \* counter stays there rather than merely visiting it. | ||
| MCTickProgress == <>[](current_slot = MaxSlot) | ||
|
|
||
| ==== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| ---------------- MODULE MC_Vortex_DSE_CSlot_AE ---------------- | ||
| (***************************************************************************) | ||
| (* Harness for Vortex_DSE_CSlot_AE, used by both TLC and Apalache. *) | ||
| (* *) | ||
| (* The specification has no slot horizon; NextCslot advances without bound *) | ||
| (* and DuplicateInject may forge any slot in Nat. The horizon is a *) | ||
| (* model-checking concern and is imposed here inside the actions, not as a *) | ||
| (* CONSTRAINT, so no successor state is discarded while temporal properties *) | ||
| (* are checked. *) | ||
| (* *) | ||
| (* Invariants are deliberately left separate rather than bundled into one *) | ||
| (* conjunction, so that a checker reports which one was violated. *) | ||
| (***************************************************************************) | ||
| EXTENDS Vortex_DSE_CSlot_AE | ||
|
|
||
| CONSTANT MaxSlot | ||
|
|
||
| Slots == 0..MaxSlot | ||
|
|
||
| MCNextCslot == | ||
| /\ current_slot < MaxSlot | ||
| /\ NextCslot | ||
|
|
||
| MCNext == | ||
| \/ \E id \in MsgIDs, k \in Slots : Send(id, k) | ||
| \/ \E n \in Nodes, m \in network : Process(n, m) | ||
| \/ \E n \in Nodes : Freeze(n) | ||
| \/ Reconcile | ||
| \/ MCNextCslot | ||
|
|
||
| MCSpec == Init /\ [][MCNext]_vars | ||
|
|
||
| MCFairness == | ||
| /\ WF_vars(Reconcile) | ||
| /\ WF_vars(MCNextCslot) | ||
| /\ \A n \in Nodes : WF_vars(Freeze(n)) | ||
|
|
||
| MCLiveSpec == Init /\ [][MCNext]_vars /\ MCFairness | ||
|
|
||
| MCTypeInvariant == | ||
| /\ TypeInvariant | ||
| /\ current_slot \in Slots | ||
| /\ \A m \in network : m.cslot \in Slots | ||
|
|
||
| \* Apalache entry point: constants fixed symbolically. | ||
| ConstInit == | ||
| /\ Nodes = {"n1", "n2"} | ||
| /\ MsgIDs = {"a", "b"} | ||
| /\ MaxSlot = 1 | ||
|
|
||
| =============================================================== |
12 changes: 12 additions & 0 deletions
12
specifications/VortexDSE/MC_Vortex_DSE_CSlot_AE_liveness.cfg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| \* Liveness model. Bounded through MCNext rather than a CONSTRAINT. | ||
|
|
||
| SPECIFICATION MCLiveSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1} | ||
| MaxSlot = 1 | ||
|
|
||
| PROPERTIES | ||
| EventualCommit | ||
| EventualAgreement | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| \* Safety model for the agreement layer, under adversarial replay. | ||
|
|
||
| SPECIFICATION MCSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1, m2} | ||
| MaxSlot = 2 | ||
|
|
||
| INVARIANTS | ||
| MCTypeInvariant | ||
| ProcessedAreCurrentSlot | ||
| CommittedIsUnion | ||
| MerkleAgreement | ||
| CommittedSupersetsProcessed | ||
| NoPhantomInCommitted | ||
| NoReorderAcrossCslot | ||
| PhaseProgressionValid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| \* Per-node clocks under bounded skew, with Byzantine slot/origin spoofing. | ||
|
|
||
| SPECIFICATION MCSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1} | ||
| MaxSkew = 1 | ||
| MaxSlot = 2 | ||
|
|
||
| INVARIANTS | ||
| MCTypeInvariant | ||
| BoundedSkew | ||
| ExactlyOncePerNode | ||
| CSlotLocalAdmission | ||
| PersistedReflectsReality | ||
| NoPhantomProcess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| ---- MODULE MC_Vortex_DSE_CSlot_Skew ---- | ||
| (***************************************************************************) | ||
| (* TLC harness for Vortex_DSE_CSlot_Skew. *) | ||
| (* *) | ||
| (* MaxSkew is a protocol parameter and stays in the specification: it is *) | ||
| (* the assumption the protocol relies on. MaxSlot is only a horizon for *) | ||
| (* model checking, so it lives here and bounds the actions directly. *) | ||
| (***************************************************************************) | ||
| EXTENDS Vortex_DSE_CSlot_Skew | ||
|
|
||
| CONSTANT MaxSlot | ||
|
|
||
| Slots == 0..MaxSlot | ||
|
|
||
| MCTick(n) == | ||
| /\ node_slot[n] < MaxSlot | ||
| /\ SkewedTick(n) | ||
|
|
||
| MCNext == | ||
| \/ \E id \in MsgIDs, n \in Nodes : Submit(id, n) | ||
| \/ \E n \in Nodes, m \in network : Process(n, m) | ||
| \/ \E n \in Nodes : Crash(n) | ||
| \/ \E n \in Nodes : Rejoin(n) | ||
| \/ \E id \in MsgIDs, k \in Slots : ByzantineInject(id, k) | ||
| \/ \E n \in Nodes : MCTick(n) | ||
|
|
||
| MCSpec == Init /\ [][MCNext]_vars | ||
|
|
||
| MCTypeInvariant == | ||
| /\ TypeInvariant | ||
| /\ node_slot \in [Nodes -> Slots] | ||
| /\ \A m \in network : m.cslot \in Slots | ||
|
|
||
| ==== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| \* Safety model for the strict (opt-in TTL) admission mode. | ||
|
|
||
| SPECIFICATION MCSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1, m2} | ||
| MaxSlot = 4 | ||
|
|
||
| INVARIANTS | ||
| MCTypeInvariant | ||
| ExactlyOncePerNode | ||
| CSlotStrictAdmission | ||
| PersistedReflectsReality | ||
| NoPhantomProcess | ||
| DecisionLocalityOnly | ||
| NoLateAdmission |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| ---- MODULE MC_Vortex_DSE_CSlot_TTL ---- | ||
| (***************************************************************************) | ||
| (* TLC harness for Vortex_DSE_CSlot_TTL. *) | ||
| (* *) | ||
| (* As in MC_Vortex_DSE_CSlot, the slot horizon is a model-checking concern *) | ||
| (* and is imposed inside the actions rather than as a CONSTRAINT, so that *) | ||
| (* no successor state is discarded while temporal properties are checked. *) | ||
| (***************************************************************************) | ||
| EXTENDS Vortex_DSE_CSlot_TTL | ||
|
|
||
| CONSTANT MaxSlot | ||
|
|
||
| Slots == 0..MaxSlot | ||
|
|
||
| MCTick == | ||
| /\ current_slot < MaxSlot | ||
| /\ Tick | ||
|
|
||
| MCNext == | ||
| \/ \E id \in MsgIDs, k \in Slots : Send(id, k) | ||
| \/ \E n \in Nodes, m \in network : Process(n, m) | ||
| \/ \E n \in Nodes : Crash(n) | ||
| \/ \E n \in Nodes : Rejoin(n) | ||
| \/ MCTick | ||
|
|
||
| MCSpec == Init /\ [][MCNext]_vars | ||
|
|
||
| MCFairness == | ||
| /\ WF_vars(MCTick) | ||
| /\ \A n \in Nodes : WF_vars(Rejoin(n)) | ||
|
|
||
| MCLiveSpec == Init /\ [][MCNext]_vars /\ MCFairness | ||
|
|
||
| MCTickProgress == <>[](current_slot = MaxSlot) | ||
|
|
||
| MCTypeInvariant == | ||
| /\ TypeInvariant | ||
| /\ current_slot \in Slots | ||
| /\ \A m \in network : m.cslot \in Slots | ||
|
|
||
| ==== |
13 changes: 13 additions & 0 deletions
13
specifications/VortexDSE/MC_Vortex_DSE_CSlot_TTL_admission.cfg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| \* A deliberate liveness failure. Under the strict gate a message whose slot | ||
| \* has passed is refused for good, so eventual admission does not hold. This | ||
| \* is what the bounded-memory mode costs, and it is the reason the strict | ||
| \* rule is a concession rather than a stronger protocol. | ||
|
|
||
| SPECIFICATION MCLiveSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1} | ||
| MaxSlot = 1 | ||
|
|
||
| PROPERTY EventualAdmission |
12 changes: 12 additions & 0 deletions
12
specifications/VortexDSE/MC_Vortex_DSE_CSlot_TTL_liveness.cfg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| \* Liveness model. Bounded through MCNext rather than a CONSTRAINT. | ||
|
|
||
| SPECIFICATION MCLiveSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1} | ||
| MaxSlot = 2 | ||
|
|
||
| PROPERTIES | ||
| MCTickProgress | ||
| EventualRejoin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| \* Liveness model. Bounded inside MCTick rather than by a state constraint, | ||
| \* so no successor state is discarded while temporal properties are checked. | ||
|
|
||
| SPECIFICATION MCLiveSpec | ||
|
|
||
| CONSTANTS | ||
| Nodes = {n1, n2} | ||
| MsgIDs = {m1} | ||
| MaxSlot = 1 | ||
|
|
||
| PROPERTIES | ||
| MCTickProgress | ||
| EventualRejoin | ||
| EventualAdmission |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful when checking liveness properties under state- and action-constraints.