File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -766,7 +766,7 @@ instance Arbitrary ChainSyncClientSetup where
766766 , lastTick (getClientUpdates clientUpdates) - 1
767767 , lastTick (getServerUpdates serverUpdates) - 1
768768 ]
769- startTick <- choose (1 , maxStartTick)
769+ startTick <- chooseExponential 3 (1 , maxStartTick)
770770 let trapBlocks =
771771 [ blockHash b
772772 | AddBlock b <- joinSchedule (getServerUpdates serverUpdates)
@@ -829,6 +829,13 @@ instance Arbitrary ChainSyncClientSetup where
829829 , y <- shrink x
830830 ]
831831
832+ chooseExponential :: Enum a => Int -> (a , a ) -> Gen a
833+ chooseExponential decayFactor (low, up) =
834+ frequency
835+ [ (decayFactor, pure low)
836+ , (1 , chooseExponential decayFactor (succ low, up))
837+ ]
838+
832839prettyChainSyncClientSetup :: ChainSyncClientSetup -> String
833840prettyChainSyncClientSetup testSetup =
834841 unlines
You can’t perform that action at this time.
0 commit comments