Skip to content

Commit a16ed8d

Browse files
committed
Post-rebase fixing
1 parent 3513775 commit a16ed8d

File tree

4 files changed

+171
-165
lines changed

4 files changed

+171
-165
lines changed

formal-spec/Leios/Protocol.agda

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ record LeiosState : Type where
6969

7070
addUpkeep : LeiosState SlotUpkeep LeiosState
7171
addUpkeep s u = let open LeiosState s in record s { Upkeep = Upkeep ∪ ❴ u ❵ }
72+
{-# INJECTIVE_FOR_INFERENCE addUpkeep #-}
7273

7374
initLeiosState : VTy StakeDistr B.State LeiosState
7475
initLeiosState V SD bs = record

formal-spec/Leios/Simple/Deterministic.agda

+22-22
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ open import Data.List.Relation.Unary.Any using (here)
1313

1414
open import Leios.SpecStructure
1515

16-
module Leios.Simple.Deterministic (⋯ : SpecStructure) (let open SpecStructure ⋯) where
16+
module Leios.Simple.Deterministic (⋯ : SpecStructure 2) (let open SpecStructure) (Λ μ :) where
1717

18-
import Leios.Simple
19-
open import Leios.Simple hiding (_-⟦_/_⟧⇀_)
20-
module ND = Leios.Simple ⋯
18+
import Leios.Simplified
19+
open import Leios.Simplified ⋯ Λ μ hiding (_-⟦_/_⟧⇀_)
20+
module ND = Leios.Simplified ⋯ Λ μ
2121

2222
open import Class.Computational
2323
open import Class.Computational22
@@ -37,7 +37,7 @@ private variable s s' s0 s1 s2 s3 s4 s5 : LeiosState
3737
ks ks' : K.State
3838
msgs : List (FFDAbstract.Header ffdAbstract ⊎ FFDAbstract.Body ffdAbstract)
3939
eb : EndorserBlock
40-
ebs : List EndorserBlock
40+
rbs : List RankingBlock
4141
txs : List Tx
4242
V : VTy
4343
SD : StakeDistr
@@ -61,15 +61,15 @@ data _-⟦Base⟧⇀_ : LeiosState → LeiosState → Type where
6161

6262
Base₂a : {ebs} let open LeiosState s renaming (BaseState to bs) in
6363
∙ needsUpkeep Base
64-
∙ eb ∷ ebs ≡ filter (λ eb isVote2Certified votingState eb × eb ∈ᴮ slice L slot 2) EBs
65-
∙ bs B.-⟦ B.SUBMIT (inj₁ eb) / B.EMPTY ⟧⇀ bs'
64+
∙ eb ∷ ebs ≡ filter (λ eb isVote2Certified s eb × eb ∈ᴮ slice L slot 2) EBs
65+
∙ bs B.-⟦ B.SUBMIT (this eb) / B.EMPTY ⟧⇀ bs'
6666
───────────────────────────────────────────────────────────────────────
6767
s -⟦Base⟧⇀ addUpkeep record s { BaseState = bs' } Base
6868

6969
Base₂b : let open LeiosState s renaming (BaseState to bs) in
7070
∙ needsUpkeep Base
71-
∙ [] ≡ filter (λ eb isVote2Certified votingState eb × eb ∈ᴮ slice L slot 2) EBs
72-
∙ bs B.-⟦ B.SUBMIT (inj₂ ToPropose) / B.EMPTY ⟧⇀ bs'
71+
∙ [] ≡ filter (λ eb isVote2Certified s eb × eb ∈ᴮ slice L slot 2) EBs
72+
∙ bs B.-⟦ B.SUBMIT (that ToPropose) / B.EMPTY ⟧⇀ bs'
7373
───────────────────────────────────────────────────────────────────────
7474
s -⟦Base⟧⇀ addUpkeep record s { BaseState = bs' } Base
7575

@@ -80,7 +80,7 @@ Base⇒ND (Base₂b x x₁ x₂) = Base₂b x x₁ x₂
8080
opaque
8181
Base-total : LeiosState.needsUpkeep s Base ∃[ s' ] s -⟦Base⟧⇀ s'
8282
Base-total {s = s} needsUpkeep with
83-
(let open LeiosState s in filter (λ eb isVote2Certified votingState eb × eb ∈ᴮ slice L slot 2) EBs)
83+
(let open LeiosState s in filter (λ eb isVote2Certified s eb × eb ∈ᴮ slice L slot 2) EBs)
8484
in eq
8585
... | [] = -, Base₂b needsUpkeep (sym eq) (proj₂ B.SUBMIT-total)
8686
... | x ∷ l = -, Base₂a needsUpkeep (sym eq) (proj₂ B.SUBMIT-total)
@@ -108,8 +108,8 @@ data _-⟦IB-Role⟧⇀_ : LeiosState → LeiosState → Type where
108108
s -⟦IB-Role⟧⇀ addUpkeep s IB-Role
109109

110110
IB-Role⇒ND : s -⟦IB-Role⟧⇀ s' just s ND.-⟦ SLOT / EMPTY ⟧⇀ s'
111-
IB-Role⇒ND (IB-Role x x₁ x₂) = IB-Role x x₁ x₂
112-
IB-Role⇒ND (No-IB-Role x x₁) = No-IB-Role x x₁
111+
IB-Role⇒ND (IB-Role x x₁ x₂) = Roles (IB-Role x x₁ x₂)
112+
IB-Role⇒ND (No-IB-Role x x₁) = Roles (No-IB-Role x x₁)
113113

114114
opaque
115115
IB-Role-total : LeiosState.needsUpkeep s IB-Role ∃[ s' ] s -⟦IB-Role⟧⇀ s'
@@ -125,7 +125,7 @@ data _-⟦EB-Role⟧⇀_ : LeiosState → LeiosState → Type where
125125

126126
EB-Role : let open LeiosState s renaming (FFDState to ffds)
127127
LI = map getIBRef $ filter (_∈ᴮ slice L slot (Λ + 1)) IBs
128-
LE = map getEBRef $ filter (isVote1Certified votingState) $
128+
LE = map getEBRef $ filter (isVote1Certified s) $
129129
filter (_∈ᴮ slice L slot (μ + 2)) EBs
130130
h = mkEB slot id π sk-EB LI LE
131131
in
@@ -142,8 +142,8 @@ data _-⟦EB-Role⟧⇀_ : LeiosState → LeiosState → Type where
142142
s -⟦EB-Role⟧⇀ addUpkeep s EB-Role
143143

144144
EB-Role⇒ND : s -⟦EB-Role⟧⇀ s' just s ND.-⟦ SLOT / EMPTY ⟧⇀ s'
145-
EB-Role⇒ND (EB-Role x x₁ x₂) = EB-Role x x₁ x₂
146-
EB-Role⇒ND (No-EB-Role x x₁) = No-EB-Role x x₁
145+
EB-Role⇒ND (EB-Role x x₁ x₂) = Roles (EB-Role x x₁ x₂)
146+
EB-Role⇒ND (No-EB-Role x x₁) = Roles (No-EB-Role x x₁)
147147

148148
opaque
149149
EB-Role-total : LeiosState.needsUpkeep s EB-Role ∃[ s' ] s -⟦EB-Role⟧⇀ s'
@@ -172,8 +172,8 @@ data _-⟦V1-Role⟧⇀_ : LeiosState → LeiosState → Type where
172172
s -⟦V1-Role⟧⇀ addUpkeep s V1-Role
173173

174174
V1-Role⇒ND : s -⟦V1-Role⟧⇀ s' just s ND.-⟦ SLOT / EMPTY ⟧⇀ s'
175-
V1-Role⇒ND (V1-Role x x₁ x₂) = V1-Role x x₁ x₂
176-
V1-Role⇒ND (No-V1-Role x x₁) = No-V1-Role x x₁
175+
V1-Role⇒ND (V1-Role x x₁ x₂) = Roles (V1-Role x x₁ x₂)
176+
V1-Role⇒ND (No-V1-Role x x₁) = Roles (No-V1-Role x x₁)
177177

178178
V1-Role-Upkeep : s -⟦V1-Role⟧⇀ s' LeiosState.needsUpkeep s V1-Role × ¬ LeiosState.needsUpkeep s' V1-Role
179179
V1-Role-Upkeep (V1-Role x x₁ x₂) = x , addUpkeep⇒¬needsUpkeep
@@ -198,8 +198,8 @@ data _-⟦V2-Role⟧⇀_ : LeiosState → LeiosState → Type where
198198
s -⟦V2-Role⟧⇀ addUpkeep s V2-Role
199199

200200
V2-Role⇒ND : s -⟦V2-Role⟧⇀ s' just s ND.-⟦ SLOT / EMPTY ⟧⇀ s'
201-
V2-Role⇒ND (V2-Role x x₁ x₂) = V2-Role x x₁ x₂
202-
V2-Role⇒ND (No-V2-Role x x₁) = No-V2-Role x x₁
201+
V2-Role⇒ND (V2-Role x x₁ x₂) = Roles (V2-Role x x₁ x₂)
202+
V2-Role⇒ND (No-V2-Role x x₁) = Roles (No-V2-Role x x₁)
203203

204204
V2-Role-Upkeep : s -⟦V2-Role⟧⇀ s' LeiosState.needsUpkeep s V2-Role × ¬ LeiosState.needsUpkeep s' V2-Role
205205
V2-Role-Upkeep (V2-Role x x₁ x₂) = x , addUpkeep⇒¬needsUpkeep
@@ -215,14 +215,14 @@ data _-⟦_/_⟧⇀_ : LeiosState → LeiosInput → LeiosOutput → LeiosState
215215
Slot : let open LeiosState s renaming (FFDState to ffds; BaseState to bs)
216216
s0 = record s
217217
{ FFDState = ffds'
218-
; Ledger = constructLedger ebs
218+
; Ledger = constructLedger rbs
219219
; slot = suc slot
220220
; Upkeep =
221221
; BaseState = bs'
222222
} ↑ L.filter isValid? msgs
223223
in
224224
∙ Upkeep ≡ᵉ allUpkeep
225-
∙ bs B.-⟦ B.FTCH-LDG / B.BASE-LDG ebs ⟧⇀ bs'
225+
∙ bs B.-⟦ B.FTCH-LDG / B.BASE-LDG rbs ⟧⇀ bs'
226226
∙ ffds FFD.-⟦ Fetch / FetchRes msgs ⟧⇀ ffds'
227227
∙ s0 -⟦Base⟧⇀ s1
228228
∙ s1 -⟦IB-Role⟧⇀ s2
@@ -244,7 +244,7 @@ data _-⟦_/_⟧⇀_ : LeiosState → LeiosInput → LeiosOutput → LeiosState
244244

245245
Base₁ :
246246
──────────────────────────────────────────────────────────────
247-
s -⟦ SUBMIT txs / EMPTY ⟧⇀ record s { ToPropose = txs }
247+
s -⟦ SUBMIT (inj₂ txs) / EMPTY ⟧⇀ record s { ToPropose = txs }
248248

249249
-- Protocol rules
250250

0 commit comments

Comments
 (0)