Skip to content

Commit b06b8f8

Browse files
committed
Update tests
1 parent 89991c6 commit b06b8f8

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

ouroboros-consensus-test/src/Test/Util/ChainDB.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import Ouroboros.Consensus.Config
2020
(TopLevelConfig (topLevelConfigLedger),
2121
configSecurityParam)
2222
import Ouroboros.Consensus.Fragment.InFuture (CheckInFuture (..))
23-
import qualified Ouroboros.Consensus.Fragment.Validated as VF
2423
import Ouroboros.Consensus.HardFork.History.EraParams (EraParams,
2524
eraEpochSize)
2625
import Ouroboros.Consensus.Ledger.Basics (LedgerConfig)
@@ -103,7 +102,9 @@ fromMinimalChainDbArgs MinimalChainDbArgs {..} = ChainDbArgs {
103102
-- ImmutableDB, as the VolatileDB. This is done in @extractBlockComponent@ in the iterator for the
104103
-- ImmutableDB, and in @getBlockComponent@ for the VolatileDB.
105104
, cdbGenesis = return mcdbInitLedger
106-
, cdbCheckInFuture = CheckInFuture $ \vf -> pure (VF.validatedFragment vf, [])
105+
, cdbCheckInFuture = CheckInFuture {
106+
checkInFuture = \_ af -> pure (af, [])
107+
}
107108
-- Blocks are never in the future.
108109
, cdbImmutableDbCacheConfig = ImmutableDB.CacheConfig 2 60
109110
-- Cache at most 2 chunks and expire each chunk after 60 seconds of being unused.

ouroboros-consensus-test/test-storage/Test/Ouroboros/Storage/ChainDB/StateMachine.hs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1397,13 +1397,25 @@ genBlk chunkInfo Model{..} = frequency
13971397
)
13981398
]
13991399

1400+
genSlotFromFuture :: Gen SlotNo
1401+
genSlotFromFuture =
1402+
let farFuture = Model.currentSlot dbModel + SlotNo (Model.maxClockSkew dbModel + 1)
1403+
nearFuture = Model.currentSlot dbModel + SlotNo 1
1404+
in frequency
1405+
[ (4, chooseSlot nearFuture farFuture),
1406+
(1, chooseSlot farFuture (farFuture + SlotNo 10))]
1407+
14001408
-- Helper that generates a block that fits onto the given block.
14011409
genFitsOn :: TestBlock -> Gen TestBlock
14021410
genFitsOn b = frequency
14031411
[ (4, do
14041412
slotNo <- if fromIsEBB (testBlockIsEBB b)
14051413
then chooseSlot (blockSlot b) (blockSlot b + 2)
1406-
else chooseSlot (blockSlot b + 1) (blockSlot b + 3)
1414+
else do
1415+
frequency
1416+
[ (10, chooseSlot (blockSlot b + 1) (blockSlot b + 3))
1417+
, (1, genSlotFromFuture)
1418+
]
14071419
body <- genBody
14081420
return $ mkNextBlock b slotNo body)
14091421
-- An EBB is never followed directly by another EBB, otherwise they

0 commit comments

Comments
 (0)