Skip to content

Commit

Permalink
a workaround for #148 in apalache
Browse files Browse the repository at this point in the history
  • Loading branch information
konnov committed Jun 4, 2020
1 parent 862d2f4 commit 84d2f99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions docs/spec/lightclient/Blockchain_A_1.tla
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ IsCorrectPower(pFaultyNodes, pVS) ==

(* This is what we believe is the assumption about failures in Tendermint *)
FaultAssumption(pFaultyNodes, pMinTrustedHeight, pBlockchain) ==
\A h \in pMinTrustedHeight..Len(pBlockchain):
\A h \in Heights:
(pMinTrustedHeight <= h /\ h <= Len(pBlockchain)) =>
IsCorrectPower(pFaultyNodes, pBlockchain[h].NextVS)

(* Can a block be produced by a correct peer, or an authenticated Byzantine peer *)
Expand Down Expand Up @@ -180,15 +181,22 @@ AdvanceChain ==
*)
AdvanceTime ==
/\ minTrustedHeight' \in (minTrustedHeight + 1) .. Min(height + 1, ULTIMATE_HEIGHT)
/\ tooManyFaults' = ~FaultAssumption(Faulty, minTrustedHeight', blockchain)
\* we are using IF-THEN-ELSE, otherwise Apalache may produce a spurious counterexample
\* https://github.com/konnov/apalache/issues/148
/\ IF FaultAssumption(Faulty, minTrustedHeight', blockchain)
THEN tooManyFaults' = FALSE
ELSE tooManyFaults' = TRUE
/\ UNCHANGED <<height, blockchain, Faulty>>

(* One more process fails. As a result, the blockchain may move into the faulty zone. *)
OneMoreFault ==
/\ \E n \in AllNodes \ Faulty:
/\ Faulty' = Faulty \cup {n}
/\ Faulty' /= AllNodes \* at least process remains non-faulty
/\ tooManyFaults' = ~FaultAssumption(Faulty', minTrustedHeight, blockchain)
\* we are using IF-THEN-ELSE, otherwise Apalache may produce a spurious counterexample
/\ IF FaultAssumption(Faulty', minTrustedHeight, blockchain)
THEN tooManyFaults' = FALSE
ELSE tooManyFaults' = TRUE
/\ UNCHANGED <<height, minTrustedHeight, blockchain>>

(* stuttering at the end of the blockchain *)
Expand Down Expand Up @@ -244,5 +252,5 @@ NeverStuckFalse2 ==

=============================================================================
\* Modification History
\* Last modified Wed Jun 03 11:10:46 CEST 2020 by igor
\* Last modified Thu Jun 04 15:52:46 CEST 2020 by igor
\* Created Fri Oct 11 15:45:11 CEST 2019 by igor
2 changes: 1 addition & 1 deletion docs/spec/lightclient/Lightclient_A_1.tla
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,5 @@ Completeness ==
*)
=============================================================================
\* Modification History
\* Last modified Wed Jun 03 17:21:30 CEST 2020 by igor
\* Last modified Thu Jun 04 10:36:44 CEST 2020 by igor
\* Created Wed Oct 02 16:39:42 CEST 2019 by igor

0 comments on commit 84d2f99

Please sign in to comment.