diff --git a/data/simulation/trace.shared.d.ts b/data/simulation/trace.shared.d.ts index eb50e0adc..581942831 100644 --- a/data/simulation/trace.shared.d.ts +++ b/data/simulation/trace.shared.d.ts @@ -71,6 +71,7 @@ interface GeneratedEndorserBlock extends GeneratedBlockEvent { id: string; pipeline: number; input_blocks: BlockRef[]; + endorser_blocks: BlockRef[]; } interface GeneratedVote extends GeneratedBlockEvent { diff --git a/data/simulation/trace.shared.schema.json b/data/simulation/trace.shared.schema.json index 2dd8a0e97..18a626005 100644 --- a/data/simulation/trace.shared.schema.json +++ b/data/simulation/trace.shared.schema.json @@ -108,6 +108,12 @@ }, "type": "array" }, + "endorser_blocks": { + "items": { + "$ref": "#/definitions/BlockRef" + }, + "type": "array" + }, "pipeline": { "type": "number" }, @@ -127,6 +133,7 @@ "required": [ "id", "input_blocks", + "endorser_blocks", "pipeline", "producer", "size_bytes", diff --git a/leios-trace-hs/src/LeiosEvents.hs b/leios-trace-hs/src/LeiosEvents.hs index 7f1a5a338..77788fa5a 100644 --- a/leios-trace-hs/src/LeiosEvents.hs +++ b/leios-trace-hs/src/LeiosEvents.hs @@ -119,6 +119,7 @@ data Event where , pipeline :: !PipelineNo , bytes :: !Word64 , input_blocks :: ![BlockRef] + , endorser_blocks :: ![BlockRef] } -> Event RBGenerated :: diff --git a/leios-trace-verifier/Parser.agda b/leios-trace-verifier/Parser.agda index 38ca0a16f..5401c2972 100644 --- a/leios-trace-verifier/Parser.agda +++ b/leios-trace-verifier/Parser.agda @@ -86,7 +86,7 @@ data Event : Type where RBReceived : Maybe Node → Node → Maybe Bytes → Maybe Time → String → Maybe (List String) → Event IBEnteredState EBEnteredState VTBundleEnteredState RBEnteredState : String → String → Word64 → Event IBGenerated : String → String → SlotNo → PipelineNo → Bytes → Bytes → Maybe String → Event - EBGenerated : String → String → Word64 → PipelineNo → Word64 → List BlockRef → Event + EBGenerated : String → String → Word64 → PipelineNo → Word64 → List BlockRef → List BlockRef → Event RBGenerated : String → String → Word64 → Word64 → Nullable Endorsement → Maybe (List Endorsement) → Word64 → Nullable BlockRef → Event VTBundleGenerated : String → String → Word64 → PipelineNo → Word64 → Map String Word64 → Event @@ -160,7 +160,7 @@ module _ (numberOfParties : ℕ) (sutId : ℕ) (stakeDistr : List (Pair String with p ≟ SUT ... | yes _ = just (IB , primWord64ToNat s) ... | no _ = nothing - winningSlot record { message = EBGenerated p _ s _ _ _ } + winningSlot record { message = EBGenerated p _ s _ _ _ _ } with p ≟ SUT ... | yes _ = just (EB , primWord64ToNat s) ... | no _ = nothing @@ -279,13 +279,13 @@ module _ (numberOfParties : ℕ) (sutId : ℕ) (stakeDistr : List (Pair String actions with p ≟ SUT ... | yes _ = (inj₁ (IB-Role-Action (primWord64ToNat s) , SLOT)) ∷ [] ... | no _ = [] - traceEvent→action l record { message = EBGenerated p i s _ _ ibs } = + traceEvent→action l record { message = EBGenerated p i s _ _ ibs ebs } = let eb = record { slotNumber = primWord64ToNat s ; producerID = nodeId p ; lotteryPf = tt ; ibRefs = map (blockRefToNat (refs l) ∘ BlockRef.id) ibs - ; ebRefs = [] + ; ebRefs = map (blockRefToNat (refs l) ∘ BlockRef.id) ebs ; signature = tt } in record l { refs = (i , EB-Blk eb) ∷ refs l } , actions diff --git a/leios-trace-verifier/examples/valid/agda-2.jsonl b/leios-trace-verifier/examples/valid/agda-2.jsonl index 8790c6b43..7513f2b21 100644 --- a/leios-trace-verifier/examples/valid/agda-2.jsonl +++ b/leios-trace-verifier/examples/valid/agda-2.jsonl @@ -131,7 +131,7 @@ {"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} # # ∷ inj₁ (EB-Role-Action 8 ((3 ∷ 4 ∷ 5 ∷ []) ∷ []) , SLOT) -{"message":{"slot":8,"type":"EBGenerated","producer":"node-0","id":"0-8","input_blocks":[],"pipeline":0,"size_bytes":1616},"time_s":8.02} +{"message":{"slot":8,"type":"EBGenerated","producer":"node-0","id":"0-8","input_blocks":[],"endorser_blocks":[],"pipeline":0,"size_bytes":1616},"time_s":8.02} # # ∷ inj₁ (VT-Role-Action 8 , SLOT) {"message":{"slot":8,"type":"VTBundleGenerated","producer":"node-0","id":"0-8","votes":{},"pipeline":0,"size_bytes":105},"time_s":8.03} diff --git a/leios-trace-verifier/hs-src/test/Spec/Transition.hs b/leios-trace-verifier/hs-src/test/Spec/Transition.hs index 2516a1450..6fffb57de 100644 --- a/leios-trace-verifier/hs-src/test/Spec/Transition.hs +++ b/leios-trace-verifier/hs-src/test/Spec/Transition.hs @@ -214,6 +214,7 @@ transition GenerateEB = pipeline <- uses stageLength $ (slot `div`) . fromIntegral bytes <- lift arbitrary input_blocks <- lift . sublistOf =<< uses ibs (fmap BlockRef . S.toList) + endorser_blocks <- lift . sublistOf =<< uses ebs (fmap BlockRef . S.toList) pure [EBGenerated{..}] transition ReceiveEB = do diff --git a/simulation/src/LeiosProtocol/Short/Sim.hs b/simulation/src/LeiosProtocol/Short/Sim.hs index 3ebd5a287..6efd57392 100644 --- a/simulation/src/LeiosProtocol/Short/Sim.hs +++ b/simulation/src/LeiosProtocol/Short/Sim.hs @@ -355,6 +355,7 @@ sharedEvent leios nodeNames e = case e of Shared.EBGenerated { bytes = fromIntegral (messageSizeBytes eb) , input_blocks = map (Shared.BlockRef . T.pack . mkStringId) eb.inputBlocks + , endorser_blocks = map (Shared.BlockRef . T.pack . mkStringId) eb.endorseBlocksEarlierPipeline , pipeline = coerce $ endorseBlockPipeline leios eb , .. }