Skip to content

Commit 689783e

Browse files
facundomingueznbacquey
authored andcommitted
Adjust stalling test to have more kills by LoP
Co-authored-by: Nicolas Bacquey <[email protected]>
1 parent 7d10a4e commit 689783e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/Genesis/Setup/GenChains.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{-# LANGUAGE DerivingStrategies #-}
33
{-# LANGUAGE ExistentialQuantification #-}
44
{-# LANGUAGE NamedFieldPuns #-}
5-
{-# LANGUAGE NumericUnderscores #-}
65
{-# LANGUAGE ScopedTypeVariables #-}
76

87
module Test.Consensus.Genesis.Setup.GenChains (
@@ -132,10 +131,11 @@ genChainsWithExtraHonestPeers genNumExtraHonest genNumForks = do
132131
gtSlotLength,
133132
gtChainSyncTimeouts = chainSyncTimeouts gtSlotLength asc,
134133
gtBlockFetchTimeouts = blockFetchTimeouts,
135-
gtLoPBucketParams = LoPBucketParams { lbpCapacity = 100_000, lbpRate = 1_000 },
136-
-- ^ REVIEW: Do we want to generate those randomly? For now, the chosen
137-
-- values carry no special meaning. Someone needs to think about what values
138-
-- would make for interesting tests.
134+
gtLoPBucketParams = LoPBucketParams { lbpCapacity = 50, lbpRate = 10 },
135+
-- These values give little enough leeway (5s) so that some adversaries get disconnected
136+
-- by the LoP during the stalling attack test. Maybe we should design a way to override
137+
-- those values for individual tests?
138+
-- Also, we might want to generate these randomly.
139139
gtCSJParams = CSJParams $ fromIntegral scg,
140140
gtBlockTree = List.foldl' (flip BT.addBranch') (BT.mkTrunk goodChain) $ zipWith (genAdversarialFragment goodBlocks) [1..] alternativeChainSchemas,
141141
gtExtraHonestPeers,

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ prop_leashingAttackStalling =
213213
, scEnableLoE = True
214214
, scEnableLoP = True
215215
, scEnableCSJ = True
216+
, scEnableBlockFetchTimeouts = False
216217
}
217218

218219
shrinkPeerSchedules
@@ -234,7 +235,8 @@ prop_leashingAttackStalling =
234235
dropRandomPoints :: [(Time, SchedulePoint blk)] -> QC.Gen [(Time, SchedulePoint blk)]
235236
dropRandomPoints ps = do
236237
let lenps = length ps
237-
dropCount <- QC.choose (0, max 1 $ div lenps 5)
238+
dropsMax = max 1 $ lenps - 1
239+
dropCount <- QC.choose (div dropsMax 2, dropsMax)
238240
let dedup = map NE.head . NE.group
239241
is <- fmap (dedup . sort) $ replicateM dropCount $ QC.choose (0, lenps - 1)
240242
pure $ dropElemsAt ps is

0 commit comments

Comments
 (0)