File tree 2 files changed +16
-3
lines changed
test-storage/Test/Ouroboros/Storage/ChainDB
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import Ouroboros.Consensus.Config
20
20
(TopLevelConfig (topLevelConfigLedger ),
21
21
configSecurityParam )
22
22
import Ouroboros.Consensus.Fragment.InFuture (CheckInFuture (.. ))
23
- import qualified Ouroboros.Consensus.Fragment.Validated as VF
24
23
import Ouroboros.Consensus.HardFork.History.EraParams (EraParams ,
25
24
eraEpochSize )
26
25
import Ouroboros.Consensus.Ledger.Basics (LedgerConfig )
@@ -103,7 +102,9 @@ fromMinimalChainDbArgs MinimalChainDbArgs {..} = ChainDbArgs {
103
102
-- ImmutableDB, as the VolatileDB. This is done in @extractBlockComponent@ in the iterator for the
104
103
-- ImmutableDB, and in @getBlockComponent@ for the VolatileDB.
105
104
, cdbGenesis = return mcdbInitLedger
106
- , cdbCheckInFuture = CheckInFuture $ \ vf -> pure (VF. validatedFragment vf, [] )
105
+ , cdbCheckInFuture = CheckInFuture {
106
+ checkInFuture = \ _ af -> pure (af, [] )
107
+ }
107
108
-- Blocks are never in the future.
108
109
, cdbImmutableDbCacheConfig = ImmutableDB. CacheConfig 2 60
109
110
-- Cache at most 2 chunks and expire each chunk after 60 seconds of being unused.
Original file line number Diff line number Diff line change @@ -1397,13 +1397,25 @@ genBlk chunkInfo Model{..} = frequency
1397
1397
)
1398
1398
]
1399
1399
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
+
1400
1408
-- Helper that generates a block that fits onto the given block.
1401
1409
genFitsOn :: TestBlock -> Gen TestBlock
1402
1410
genFitsOn b = frequency
1403
1411
[ (4 , do
1404
1412
slotNo <- if fromIsEBB (testBlockIsEBB b)
1405
1413
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
+ ]
1407
1419
body <- genBody
1408
1420
return $ mkNextBlock b slotNo body)
1409
1421
-- An EBB is never followed directly by another EBB, otherwise they
You can’t perform that action at this time.
0 commit comments