Skip to content

Commit bd0598b

Browse files
committed
ChainDB q-s-m: remove references to in-future blocks
The notion of blocks from the future has been completely eliminated from the ChainDB in #1269, so remove any stale (implicit) references.
1 parent ffc3c2d commit bd0598b

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,7 @@ validate cfg Model{initLedger, invalid} chain =
842842
ledger
843843
(invalid <> mkInvalid b e)
844844
-- Valid block according to the ledger
845-
Right ledger'
846-
-- But the block has been recorded as an invalid block. It must be
847-
-- that it exceeded the clock skew in the past.
848-
| Map.member (blockHash b) invalid ->
849-
ValidatedChain validPrefix ledger invalid
850-
-- This is the good path
851-
| otherwise ->
852-
go (convertMapKind ledger') (validPrefix :> b) bs'
845+
Right ledger' -> go (convertMapKind ledger') (validPrefix :> b) bs'
853846

854847
chains ::
855848
forall blk.

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
-- These are the main tests for the chain DB. Commands include
2626
--
2727
-- * Add a block
28-
-- * Add a block with a @SlotNo@ that is ahead of the wall-clock.
2928
-- * Get the current chain and/or ledger state
3029
-- * Create a new iterator and use it to stream blocks
3130
-- * Create a new follower and use it to follow the chain
@@ -178,9 +177,7 @@ import Test.Util.WithEq
178177

179178
-- | Commands
180179
data Cmd blk it flr
181-
= -- | Advance the current slot to the block's slot (unless smaller than the
182-
-- current slot), add the block and run chain selection.
183-
AddBlock blk
180+
= AddBlock blk
184181
| GetCurrentChain
185182
| GetTipBlock
186183
| GetTipHeader
@@ -368,7 +365,6 @@ data ChainDBState m blk = ChainDBState
368365
data ChainDBEnv m blk = ChainDBEnv
369366
{ varDB :: StrictTVar m (ChainDBState m blk)
370367
, registry :: ResourceRegistry m
371-
, varCurSlot :: StrictTVar m SlotNo
372368
, varNextId :: StrictTVar m Id
373369
, varVolatileDbFs :: StrictTMVar m MockFS
374370
, args :: ChainDbArgs Identity m blk
@@ -407,7 +403,7 @@ run ::
407403
m (Success blk (TestIterator m blk) (TestFollower m blk))
408404
run cfg env@ChainDBEnv{varDB, ..} cmd =
409405
readTVarIO varDB >>= \st@ChainDBState{chainDB = ChainDB{..}, internal} -> case cmd of
410-
AddBlock blk -> Point <$> (advanceAndAdd st (blockSlot blk) blk)
406+
AddBlock blk -> Point <$> advanceAndAdd st blk
411407
GetCurrentChain -> Chain <$> atomically getCurrentChain
412408
GetTipBlock -> MbBlock <$> getTipBlock
413409
GetTipHeader -> MbHeader <$> getTipHeader
@@ -439,9 +435,8 @@ run cfg env@ChainDBEnv{varDB, ..} cmd =
439435
follower = fmap Flr . giveWithEq
440436
ignore _ = Unit ()
441437

442-
advanceAndAdd :: ChainDBState m blk -> SlotNo -> blk -> m (Point blk)
443-
advanceAndAdd ChainDBState{chainDB} newCurSlot blk = do
444-
atomically $ modifyTVar varCurSlot (max newCurSlot)
438+
advanceAndAdd :: ChainDBState m blk -> blk -> m (Point blk)
439+
advanceAndAdd ChainDBState{chainDB} blk = do
445440
-- `blockProcessed` always returns 'Just'
446441
res <- addBlock chainDB InvalidBlockPunishment.noPunishment blk
447442
ChainDB.triggerChainSelection chainDB
@@ -1606,7 +1601,6 @@ runCmdsLockstep loe (SmallChunkInfo chunkInfo) cmds =
16061601
threadRegistry <- unsafeNewRegistry
16071602
iteratorRegistry <- unsafeNewRegistry
16081603
(tracer, getTrace) <- recordingTracerIORef
1609-
varCurSlot <- uncheckedNewTVarM 0
16101604
varNextId <- uncheckedNewTVarM 0
16111605
nodeDBs <- emptyNodeDBs
16121606
varLoEFragment <- newTVarIO $ AF.Empty AF.AnchorGenesis
@@ -1631,7 +1625,6 @@ runCmdsLockstep loe (SmallChunkInfo chunkInfo) cmds =
16311625
ChainDBEnv
16321626
{ varDB
16331627
, registry = iteratorRegistry
1634-
, varCurSlot
16351628
, varNextId
16361629
, varVolatileDbFs = nodeDBsVol nodeDBs
16371630
, varLoEFragment

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ withTestChainDbEnv topLevelConfig chunkInfo extLedgerState cont =
449449
openChainDbEnv = do
450450
threadRegistry <- unsafeNewRegistry
451451
iteratorRegistry <- unsafeNewRegistry
452-
varCurSlot <- uncheckedNewTVarM 0
453452
varNextId <- uncheckedNewTVarM 0
454453
varLoEFragment <- newTVarIO $ AF.Empty AF.AnchorGenesis
455454
nodeDbs <- emptyNodeDBs
@@ -460,7 +459,6 @@ withTestChainDbEnv topLevelConfig chunkInfo extLedgerState cont =
460459
ChainDBEnv
461460
{ varDB
462461
, registry = iteratorRegistry
463-
, varCurSlot
464462
, varNextId
465463
, varVolatileDbFs = nodeDBsVol nodeDbs
466464
, args

0 commit comments

Comments
 (0)