Skip to content

Commit b36e927

Browse files
facundominguezneilmayhew
authored andcommitted
Groom comments and counterexample messages.
1 parent a98dd8d commit b36e927

File tree

1 file changed

+10
-8
lines changed
  • ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/Genesis/Tests

1 file changed

+10
-8
lines changed

ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/Genesis/Tests/Uniform.hs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ tests =
7878
testProperty "block fetch leashing attack" prop_blockFetchLeashingAttack
7979
]
8080

81+
-- | The conjunction of
82+
--
83+
-- * no honest peer has been disconnected,
84+
-- * the immutable tip is on the best chain, and
85+
-- * the immutable tip is no older than s + d + 1 slots
8186
theProperty ::
8287
GenesisTestFull TestBlock ->
8388
StateView TestBlock ->
@@ -92,16 +97,16 @@ theProperty genesisTest stateView@StateView{svSelectedChain} =
9297
-- to the governor that the density is too low.
9398
longerThanGenesisWindow ==>
9499
conjoin [
95-
counterexample "An honest peer was disconnected" (not $ any isHonestPeerId disconnected),
96-
counterexample ("The immutable tip is not honest: " ++ show immutableTip) $
100+
counterexample "Honest peers shouldn't be disconnected" (not $ any isHonestPeerId disconnected),
101+
counterexample ("The immutable tip should be honest: " ++ show immutableTip) $
97102
property (isHonest immutableTipHash),
98103
immutableTipIsRecent
99104
]
100105
where
101106
advCount = Map.size (adversarialPeers (psSchedule $ gtSchedule genesisTest))
102107

103108
immutableTipIsRecent =
104-
counterexample ("Age of the immutable tip: " ++ show immutableTipAge) $
109+
counterexample ("The immutable tip is too old: " ++ show immutableTipAge) $
105110
immutableTipAge `le` s + fromIntegral d + 1
106111

107112
SlotNo immutableTipAge = case (honestTipSlot, immutableTipSlot) of
@@ -263,8 +268,8 @@ prop_leashingAttackTimeLimited =
263268
{ scTrace = False
264269
, scEnableLoE = True
265270
, scEnableLoP = True
266-
, scEnableBlockFetchTimeouts = False
267271
, scEnableCSJ = True
272+
, scEnableBlockFetchTimeouts = False
268273
}
269274

270275
shrinkPeerSchedules
@@ -344,11 +349,8 @@ headCallStack = \case
344349
x:_ -> x
345350
_ -> error "headCallStack: empty list"
346351

347-
-- | Test that enabling the LoE using the updater that sets the LoE fragment to
348-
-- the shared prefix (as used by the GDDG) causes the selection to remain at
352+
-- | Test that enabling the LoE causes the selection to remain at
349353
-- the first fork intersection (keeping the immutable tip honest).
350-
--
351-
-- This is pretty slow since it relies on timeouts to terminate the test.
352354
prop_loeStalling :: Property
353355
prop_loeStalling =
354356
forAllGenesisTest

0 commit comments

Comments
 (0)