Skip to content

Commit 7163d06

Browse files
Niolsneilmayhew
authored andcommitted
Document all tests that did not have documentation
1 parent 36fa7e9 commit 7163d06

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ tests =
4242
]
4343

4444
-- | Tests that the selection advances in presence of the LoE when a peer is
45-
-- killed by something that is not LoE-aware, eg. the timeouts.
45+
-- killed by something that is not LoE-aware, eg. the timeouts. This test
46+
-- features an honest peer behaving normally and an adversarial peer behaving
47+
-- such that it will get killed by timeouts. We check that, after the adversary
48+
-- gets disconnected, the LoE gets updated to stop taking it into account. There
49+
-- are two variants of the test: one with timeouts enabled, and one without. In
50+
-- the case where timeouts are disabled, we check that we do in fact remain
51+
-- stuck at the intersection between trunk and other chain.
52+
--
4653
-- NOTE: Same as 'LoP.prop_delayAttack' with timeouts instead of LoP.
4754
prop_adversaryHitsTimeouts :: Bool -> Property
4855
prop_adversaryHitsTimeouts timeoutsEnabled =

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ tests =
5959
testProperty "delaying attack fails with LoP" (prop_delayAttack True)
6060
]
6161

62+
-- | Simple test in which we connect to only one peer, who advertises the tip of
63+
-- the block tree trunk and then does nothing. If the given boolean,
64+
-- @mustTimeout@, if @True@, then we wait just long enough for the LoP bucket to
65+
-- empty; we expect to observe an 'EmptyBucket' exception in the ChainSync
66+
-- client. If @mustTimeout@ is @False@, then we wait not quite as long, so the
67+
-- LoP bucket should not be empty at the end of the test and we should observe
68+
-- no exception in the ChainSync client.
6269
prop_wait :: Bool -> Property
6370
prop_wait mustTimeout =
6471
forAllGenesisTest
@@ -90,6 +97,13 @@ prop_wait mustTimeout =
9097
, psMinEndTime = Time $ timeout + offset
9198
}
9299

100+
-- | Simple test in which we connect to only one peer, who advertises the tip of
101+
-- the block tree trunk, serves all of its headers, and then does nothing.
102+
-- Because the peer does not send its blocks, then the ChainSync client will end
103+
-- up stuck, waiting behind the forecast horizon. We expect that the LoP will
104+
-- then be disabled and that, therefore, one could wait forever in this state.
105+
-- We disable the timeouts and check that, indeed, the ChainSync client observes
106+
-- no exception.
93107
prop_waitBehindForecastHorizon :: Property
94108
prop_waitBehindForecastHorizon =
95109
forAllGenesisTest

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ tests =
3434
testProperty "one adversary" prop_longRangeAttack
3535
]
3636

37+
-- | This test case features a long-range attack with one adversary. The honest
38+
-- peer serves the block tree trunk, while the adversary serves its own chain,
39+
-- forking off the trunk by at least @k@ blocks, but less good than the trunk.
40+
-- The adversary serves the chain more rapidly than the honest peer. We check at
41+
-- the end that the selection is honest. This property does not hold with Praos,
42+
-- but should hold with Genesis.
3743
prop_longRangeAttack :: Property
3844
prop_longRangeAttack =
3945
-- NOTE: `shrinkPeerSchedules` only makes sense for tests that expect the

0 commit comments

Comments
 (0)