@@ -68,7 +68,7 @@ genHonestChainSchema = do
6868
6969-- | Random generator for one alternative chain schema forking off a given
7070-- honest chain schema. The alternative chain schema is returned as the pair of
71- -- a slot number on the honest chain schema and a list of active slots.
71+ -- a block number on the honest chain schema and a list of active slots.
7272--
7373-- REVIEW: Use 'SlotNo' instead of 'Int'?
7474genAlternativeChainSchema :: (H. HonestRecipe , H. ChainSchema base hon ) -> QC. Gen (Int , [S ])
@@ -153,6 +153,11 @@ genChainsWithExtraHonestPeers genNumExtraHonest genNumForks = do
153153 -- those values for individual tests?
154154 -- Also, we might want to generate these randomly.
155155 gtCSJParams = CSJParams $ fromIntegral scg,
156+ -- The generated alternative chains (branches added to the @goodChain@)
157+ -- can end up having the same @prefixCount@, meaning they fork at the same block. but are
158+ -- The assigned fork number has no relation with the order in which the
159+ -- branching happens, but is just a means to distinguish among then for
160+ -- pretty printing.
156161 gtBlockTree = List. foldl' (flip BT. addBranch') (BT. mkTrunk goodChain) $ zipWith (genAdversarialFragment goodBlocks) [1 .. ] alternativeChainSchemas,
157162 gtExtraHonestPeers,
158163 gtSchedule = ()
@@ -170,6 +175,9 @@ genChainsWithExtraHonestPeers genNumExtraHonest genNumForks = do
170175 mkTestFragment =
171176 AF. fromNewestFirst AF. AnchorGenesis
172177
178+ -- Cons new blocks acoording to the given active block schema
179+ -- and mark the first with the corresponding fork number; the
180+ -- next blocks get a zero fork number.
173181 mkTestBlocks :: [blk ] -> [S ] -> Int -> [blk ]
174182 mkTestBlocks pre active forkNo =
175183 fst (List. foldl' folder ([] , 0 ) active)
0 commit comments