Skip to content

Commit 37f7c35

Browse files
nfrisbyyveshauser
andauthored
Add EB links to EBGenerated event (#416)
Add EB links to `EBGenerated` event in the Haskell, the Agda, and the event schema files (since the Rust already had them). --------- Co-authored-by: Yves Hauser <[email protected]>
1 parent 1b034f0 commit 37f7c35

File tree

7 files changed

+16
-5
lines changed

7 files changed

+16
-5
lines changed

data/simulation/trace.shared.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ interface GeneratedEndorserBlock extends GeneratedBlockEvent {
7171
id: string;
7272
pipeline: number;
7373
input_blocks: BlockRef[];
74+
endorser_blocks: BlockRef[];
7475
}
7576

7677
interface GeneratedVote extends GeneratedBlockEvent {

data/simulation/trace.shared.schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@
108108
},
109109
"type": "array"
110110
},
111+
"endorser_blocks": {
112+
"items": {
113+
"$ref": "#/definitions/BlockRef"
114+
},
115+
"type": "array"
116+
},
111117
"pipeline": {
112118
"type": "number"
113119
},
@@ -127,6 +133,7 @@
127133
"required": [
128134
"id",
129135
"input_blocks",
136+
"endorser_blocks",
130137
"pipeline",
131138
"producer",
132139
"size_bytes",

leios-trace-hs/src/LeiosEvents.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ data Event where
119119
, pipeline :: !PipelineNo
120120
, bytes :: !Word64
121121
, input_blocks :: ![BlockRef]
122+
, endorser_blocks :: ![BlockRef]
122123
} ->
123124
Event
124125
RBGenerated ::

leios-trace-verifier/Parser.agda

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ data Event : Type where
8686
RBReceived : Maybe Node Node Maybe Bytes Maybe Time String Maybe (List String) Event
8787
IBEnteredState EBEnteredState VTBundleEnteredState RBEnteredState : String String Word64 Event
8888
IBGenerated : String String SlotNo PipelineNo Bytes Bytes Maybe String Event
89-
EBGenerated : String String Word64 PipelineNo Word64 List BlockRef Event
89+
EBGenerated : String String Word64 PipelineNo Word64 List BlockRef List BlockRef Event
9090
RBGenerated : String String Word64 Word64 Nullable Endorsement Maybe (List Endorsement) Word64 Nullable BlockRef Event
9191
VTBundleGenerated : String String Word64 PipelineNo Word64 Map String Word64 Event
9292

@@ -160,7 +160,7 @@ module _ (numberOfParties : ℕ) (sutId : ℕ) (stakeDistr : List (Pair String
160160
with p ≟ SUT
161161
... | yes _ = just (IB , primWord64ToNat s)
162162
... | no _ = nothing
163-
winningSlot record { message = EBGenerated p _ s _ _ _ }
163+
winningSlot record { message = EBGenerated p _ s _ _ _ _ }
164164
with p ≟ SUT
165165
... | yes _ = just (EB , primWord64ToNat s)
166166
... | no _ = nothing
@@ -279,13 +279,13 @@ module _ (numberOfParties : ℕ) (sutId : ℕ) (stakeDistr : List (Pair String
279279
actions with p ≟ SUT
280280
... | yes _ = (inj₁ (IB-Role-Action (primWord64ToNat s) , SLOT)) ∷ []
281281
... | no _ = []
282-
traceEvent→action l record { message = EBGenerated p i s _ _ ibs } =
282+
traceEvent→action l record { message = EBGenerated p i s _ _ ibs ebs } =
283283
let eb = record
284284
{ slotNumber = primWord64ToNat s
285285
; producerID = nodeId p
286286
; lotteryPf = tt
287287
; ibRefs = map (blockRefToNat (refs l) ∘ BlockRef.id) ibs
288-
; ebRefs = []
288+
; ebRefs = map (blockRefToNat (refs l) ∘ BlockRef.id) ebs
289289
; signature = tt
290290
}
291291
in record l { refs = (i , EB-Blk eb) ∷ refs l } , actions

leios-trace-verifier/examples/valid/agda-2.jsonl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
{"message":{"slot":8,"type":"IBGenerated","producer":"node-0","id":"0-8","rb_ref":"-7674734470404649268","pipeline":0,"size_bytes":98608,"tx_payload_bytes":98304},"time_s":8.01}
132132
#
133133
# ∷ inj₁ (EB-Role-Action 8 ((3 ∷ 4 ∷ 5 ∷ []) ∷ []) , SLOT)
134-
{"message":{"slot":8,"type":"EBGenerated","producer":"node-0","id":"0-8","input_blocks":[],"pipeline":0,"size_bytes":1616},"time_s":8.02}
134+
{"message":{"slot":8,"type":"EBGenerated","producer":"node-0","id":"0-8","input_blocks":[],"endorser_blocks":[],"pipeline":0,"size_bytes":1616},"time_s":8.02}
135135
#
136136
# ∷ inj₁ (VT-Role-Action 8 , SLOT)
137137
{"message":{"slot":8,"type":"VTBundleGenerated","producer":"node-0","id":"0-8","votes":{},"pipeline":0,"size_bytes":105},"time_s":8.03}

leios-trace-verifier/hs-src/test/Spec/Transition.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ transition GenerateEB =
214214
pipeline <- uses stageLength $ (slot `div`) . fromIntegral
215215
bytes <- lift arbitrary
216216
input_blocks <- lift . sublistOf =<< uses ibs (fmap BlockRef . S.toList)
217+
endorser_blocks <- lift . sublistOf =<< uses ebs (fmap BlockRef . S.toList)
217218
pure [EBGenerated{..}]
218219
transition ReceiveEB =
219220
do

simulation/src/LeiosProtocol/Short/Sim.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ sharedEvent leios nodeNames e = case e of
355355
Shared.EBGenerated
356356
{ bytes = fromIntegral (messageSizeBytes eb)
357357
, input_blocks = map (Shared.BlockRef . T.pack . mkStringId) eb.inputBlocks
358+
, endorser_blocks = map (Shared.BlockRef . T.pack . mkStringId) eb.endorseBlocksEarlierPipeline
358359
, pipeline = coerce $ endorseBlockPipeline leios eb
359360
, ..
360361
}

0 commit comments

Comments
 (0)