|
| 1 | +# SPDX-License-Identifier: MPL-2.0 |
| 2 | +# tla-consensus.yml — model-check the Byzantine consensus spec with TLC. |
| 3 | +# |
| 4 | +# Validates formal/PhronesisConsensus.tla (per-agent commit views, equivocating |
| 5 | +# proposer + Byzantine voters). Two gates: |
| 6 | +# * positive — at Threshold = 2F+1 all safety invariants hold (TypeOK, |
| 7 | +# Agreement, Validity, ByzantineSafety); |
| 8 | +# * negative — below the quorum bound (Threshold = 2) TLC MUST report an |
| 9 | +# Agreement violation, proving the quorum threshold is load-bearing. |
| 10 | +name: TLA+ Consensus |
| 11 | + |
| 12 | +on: |
| 13 | + push: |
| 14 | + branches: [main, master] |
| 15 | + pull_request: |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +# Estate guardrail: cancel superseded runs (read-only check, safe to cancel). |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read |
| 25 | + |
| 26 | +jobs: |
| 27 | + tlc: |
| 28 | + name: TLC model-check (BFT safety) |
| 29 | + runs-on: ubuntu-latest |
| 30 | + timeout-minutes: 15 |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 34 | + |
| 35 | + - name: Fetch tla2tools (pinned version + sha256-verified) |
| 36 | + run: | |
| 37 | + curl -fsSL -o tla2tools.jar \ |
| 38 | + https://github.com/tlaplus/tlaplus/releases/download/v1.8.0/tla2tools.jar |
| 39 | + echo "237332bdcc79a35c7d26efa7b82c77c85c2744591c5598673a8a45085ff2a4fb tla2tools.jar" \ |
| 40 | + | sha256sum -c - |
| 41 | +
|
| 42 | + - name: TLC positive — all safety invariants hold at Threshold = 2F+1 |
| 43 | + working-directory: formal |
| 44 | + run: | |
| 45 | + java -XX:+UseParallelGC -cp "${GITHUB_WORKSPACE}/tla2tools.jar" \ |
| 46 | + tlc2.TLC -config PhronesisConsensus.cfg PhronesisConsensus.tla |
| 47 | +
|
| 48 | + - name: TLC negative — Agreement must fail below the quorum bound |
| 49 | + working-directory: formal |
| 50 | + run: | |
| 51 | + if java -cp "${GITHUB_WORKSPACE}/tla2tools.jar" \ |
| 52 | + tlc2.TLC -config PhronesisConsensus_neg.cfg PhronesisConsensus.tla; then |
| 53 | + echo "::error::Agreement held at Threshold < 2F+1 — the quorum bound is not load-bearing (invariant vacuous)." |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | + echo "Negative test OK: Agreement correctly violated below the quorum bound." |
0 commit comments