diff --git a/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal b/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal index 5e28ed4025..a8b32be074 100644 --- a/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal +++ b/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal @@ -450,7 +450,6 @@ test-suite cardano-test cardano-ledger-alonzo-test, cardano-ledger-api, cardano-ledger-babbage-test, - cardano-ledger-binary, cardano-ledger-binary:testlib, cardano-ledger-byron, cardano-ledger-conway:testlib, diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs index 727321d3d6..2c55483d80 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs @@ -332,7 +332,7 @@ data instance BlockQuery (ShelleyBlock proto era) fp result where => BlockQuery (ShelleyBlock proto era) QFNoTables (CG.RatifyState era) GetFuturePParams - :: BlockQuery (ShelleyBlock proto era) (Maybe (LC.PParams era)) + :: BlockQuery (ShelleyBlock proto era) QFNoTables (Maybe (LC.PParams era)) -- | Obtain a snapshot of big ledger peers. CLI can serialize these, -- and if made available to the node by topology configuration, diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs index 745067e214..52881aad31 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Forging.hs @@ -15,6 +15,7 @@ import Control.Monad (when) import Control.Monad.Except (runExcept) import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Except (ExceptT, runExceptT, throwE) +import Control.ResourceRegistry import Control.Tracer as Trace (nullTracer) import Data.Either (isRight) import Data.Maybe (isJust) @@ -45,7 +46,6 @@ import qualified Ouroboros.Consensus.Storage.ChainDB.API.Types.InvalidBlockPunis import Ouroboros.Consensus.Storage.LedgerDB.API import Ouroboros.Consensus.Ticked import Ouroboros.Consensus.Util.IOLike (atomically) -import Ouroboros.Consensus.Util.ResourceRegistry import Ouroboros.Network.AnchoredFragment as AF (Anchor (..), AnchoredFragment, AnchoredSeq (..), headPoint) import Ouroboros.Network.Protocol.LocalStateQuery.Type diff --git a/ouroboros-consensus-cardano/test/cardano-test/Test/Consensus/Cardano/Translation.hs b/ouroboros-consensus-cardano/test/cardano-test/Test/Consensus/Cardano/Translation.hs index 17b885df19..7245314436 100644 --- a/ouroboros-consensus-cardano/test/cardano-test/Test/Consensus/Cardano/Translation.hs +++ b/ouroboros-consensus-cardano/test/cardano-test/Test/Consensus/Cardano/Translation.hs @@ -17,7 +17,6 @@ import qualified Cardano.Chain.Block as Byron import qualified Cardano.Chain.UTxO as Byron import Cardano.Ledger.Alonzo () import Cardano.Ledger.BaseTypes (Network (Testnet), TxIx (..)) -import Cardano.Ledger.Binary.Version import qualified Cardano.Ledger.Core as Core import qualified Cardano.Ledger.Crypto as Crypto import qualified Cardano.Ledger.Genesis as Genesis @@ -35,7 +34,6 @@ import Cardano.Slotting.EpochInfo (fixedEpochInfo) import Cardano.Slotting.Slot (EpochNo (..)) import qualified Data.ListMap as ListMap import qualified Data.Map.Strict as Map -import Data.Maybe (fromMaybe) import Data.SOP.BasicFunctors import Data.SOP.Functors import Data.SOP.InPairs (RequiringBoth (..), provideBoth) @@ -56,8 +54,6 @@ import Ouroboros.Consensus.Ledger.Tables.Diff (Diff) import qualified Ouroboros.Consensus.Ledger.Tables.Diff as Diff import Ouroboros.Consensus.Ledger.Tables.Utils import Ouroboros.Consensus.Protocol.Praos -import Ouroboros.Consensus.Protocol.Praos.Common - (MaxMajorProtVer (..)) import Ouroboros.Consensus.Protocol.TPraos (TPraos) import Ouroboros.Consensus.Shelley.Eras import Ouroboros.Consensus.Shelley.HFEras () @@ -380,7 +376,6 @@ fixedShelleyLedgerConfig translationContext = mkShelleyLedgerConfig shelleyGenesis translationContext (fixedEpochInfo (sgEpochLength shelleyGenesis) (slotLengthFromSec 2)) - (MaxMajorProtVer (fromMaybe (error "this will never trigger") $ mkVersion (10 :: Int))) where shelleyGenesis = ShelleyGenesis { sgSystemStart = dawnOfTime diff --git a/ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/Cardano.hs b/ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/Cardano.hs index 1980f2db55..a2c0c5623b 100644 --- a/ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/Cardano.hs +++ b/ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/Cardano.hs @@ -30,6 +30,7 @@ import Data.Maybe (maybeToList) import Data.Proxy (Proxy (..)) import Data.Set (Set) import qualified Data.Set as Set +import Data.SOP.Functors import Data.Word (Word64) import Lens.Micro import Ouroboros.Consensus.Block.Forging (BlockForging) @@ -530,9 +531,9 @@ setByronProtVer = modifyExtLedger f elgr = elgr { ledgerState = f (ledgerState elgr ) } modifyHFLedgerState :: - (LedgerState x -> LedgerState x) - -> LedgerState (HardForkBlock (x : xs)) - -> LedgerState (HardForkBlock (x : xs)) + (LedgerState x mk -> LedgerState x mk) + -> LedgerState (HardForkBlock (x : xs)) mk + -> LedgerState (HardForkBlock (x : xs)) mk modifyHFLedgerState f (HardForkLedgerState (HardForkState (TZ st))) = - HardForkLedgerState (HardForkState (TZ st {currentState = f (currentState st)})) + HardForkLedgerState (HardForkState (TZ st {currentState = Flip $ f (unFlip $ currentState st)})) modifyHFLedgerState _ st = st diff --git a/ouroboros-consensus/ouroboros-consensus.cabal b/ouroboros-consensus/ouroboros-consensus.cabal index f87af5e41f..f3f7320145 100644 --- a/ouroboros-consensus/ouroboros-consensus.cabal +++ b/ouroboros-consensus/ouroboros-consensus.cabal @@ -602,7 +602,6 @@ test-suite consensus-test fingertree-rm, fs-api ^>=0.3, fs-sim, - generics-sop, hashable, io-classes, io-sim, @@ -632,7 +631,6 @@ test-suite consensus-test time, transformers, transformers-base, - tree-diff, typed-protocols ^>=0.3, typed-protocols-examples, typed-protocols-stateful, diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Tables/Diff.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Tables/Diff.hs index 7e070c4219..8903732218 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Tables/Diff.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Tables/Diff.hs @@ -210,7 +210,7 @@ toAntiDiff :: Diff k v -> Anti.Diff k v toAntiDiff (Diff d) = Anti.Diff (Map.map f d) where f (Insert v) = Anti.singletonInsert v - f Delete = Anti.singletonDelete undefined + f Delete = Anti.singletonDelete {------------------------------------------------------------------------------- Traversals and folds diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Impl/Common.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Impl/Common.hs index c112d1824f..f4d055424c 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Impl/Common.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Impl/Common.hs @@ -473,10 +473,3 @@ deriving instance ( Show (GenTx blk) , Show (ApplyTxErr blk) , StandardHash blk ) => Show (TraceEventMempool blk) - -deriving instance ( NoThunks (GenTx blk) - , NoThunks (Validated (GenTx blk)) - , NoThunks (GenTxId blk) - , NoThunks (ApplyTxErr blk) - , StandardHash blk - ) => NoThunks (TraceEventMempool blk) diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Update.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Update.hs index 8514e6ef59..40e0bd8127 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Update.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Update.hs @@ -440,8 +440,8 @@ implSyncWithLedger mpEnv = do -- If the point is gone, resync pure (Resync, is) case res of - OK v -> pure v - Resync -> implSyncWithLedger mpEnv + OK v -> pure v + Resync -> implSyncWithLedger mpEnv Retry _ -> error "Impossible!" where MempoolEnv { mpEnvStateVar = istate diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl.hs index 8f6d541f68..a4c6dcc23d 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl.hs @@ -38,7 +38,8 @@ import Control.Monad (void, when) import Control.Monad.Base (MonadBase) import Control.Monad.Trans.Class (lift) import Control.ResourceRegistry (WithTempRegistry, allocate, - runInnerWithTempRegistry, runWithTempRegistry) + runInnerWithTempRegistry, runWithTempRegistry, + withRegistry) import Control.Tracer import Data.Functor ((<&>)) import Data.Functor.Contravariant ((>$<)) diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/ChainSel.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/ChainSel.hs index c1c1261b15..fbda5bbc48 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/ChainSel.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/ChainSel.hs @@ -25,6 +25,7 @@ import Control.Monad (forM, forM_, unless, void, when) import Control.Monad.Except () import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.State.Strict +import Control.ResourceRegistry (ResourceRegistry, withRegistry) import Control.Tracer (Tracer, nullTracer, traceWith) import Data.Foldable (for_) import Data.Function (on) @@ -81,8 +82,6 @@ import Ouroboros.Consensus.Util import Ouroboros.Consensus.Util.AnchoredFragment import Ouroboros.Consensus.Util.Enclose (encloseWith) import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry (ResourceRegistry, - withRegistry) import Ouroboros.Consensus.Util.STM (WithFingerprint (..)) import Ouroboros.Network.AnchoredFragment (Anchor, AnchoredFragment, AnchoredSeq (..)) diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/Query.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/Query.hs index c1b0be11a6..7e1c2cab4b 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/Query.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/Query.hs @@ -29,6 +29,7 @@ module Ouroboros.Consensus.Storage.ChainDB.Impl.Query ( , getAnyKnownBlockComponent ) where +import Control.ResourceRegistry (ResourceRegistry) import qualified Data.Map.Strict as Map import qualified Data.Set as Set import Ouroboros.Consensus.Block @@ -49,7 +50,6 @@ import Ouroboros.Consensus.Storage.VolatileDB (VolatileDB) import qualified Ouroboros.Consensus.Storage.VolatileDB as VolatileDB import Ouroboros.Consensus.Util (eitherToMaybe) import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry (ResourceRegistry) import Ouroboros.Consensus.Util.STM (WithFingerprint (..)) import Ouroboros.Network.AnchoredFragment (AnchoredFragment) import qualified Ouroboros.Network.AnchoredFragment as AF diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ImmutableDB/Impl/Stream.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ImmutableDB/Impl/Stream.hs index bc7c568e5f..e722d66bcb 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ImmutableDB/Impl/Stream.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ImmutableDB/Impl/Stream.hs @@ -12,13 +12,13 @@ module Ouroboros.Consensus.Storage.ImmutableDB.Impl.Stream ( ) where import Control.Monad.Except +import Control.ResourceRegistry import GHC.Stack import Ouroboros.Consensus.Block import Ouroboros.Consensus.Storage.Common import Ouroboros.Consensus.Storage.ImmutableDB hiding (streamAll) import qualified Ouroboros.Consensus.Storage.ImmutableDB.API as ImmutableDB import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry {------------------------------------------------------------------------------- Abstraction over the streaming API provided by the Chain DB diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/API.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/API.hs index e9e2add224..bf502ef21d 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/API.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/API.hs @@ -157,6 +157,7 @@ module Ouroboros.Consensus.Storage.LedgerDB.API ( import Control.Monad (forM) import Control.Monad.Class.MonadTime.SI +import Control.ResourceRegistry import Data.Kind import Data.Set (Set) import Data.Word @@ -170,7 +171,6 @@ import Ouroboros.Consensus.Storage.ChainDB.Impl.BlockCache import Ouroboros.Consensus.Storage.LedgerDB.Impl.Snapshots import Ouroboros.Consensus.Util.CallStack import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry import Ouroboros.Network.Protocol.LocalStateQuery.Type {------------------------------------------------------------------------------- diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Args.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Args.hs index 9d985b564a..8c331ccca3 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Args.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Args.hs @@ -19,6 +19,7 @@ module Ouroboros.Consensus.Storage.LedgerDB.Impl.Args ( , defaultArgs ) where +import Control.ResourceRegistry import Control.Tracer import Data.Kind import Ouroboros.Consensus.Ledger.Abstract @@ -29,7 +30,6 @@ import Ouroboros.Consensus.Storage.LedgerDB.Impl.Snapshots import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.Args as V1 import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.Args as V2 import Ouroboros.Consensus.Util.Args -import Ouroboros.Consensus.Util.ResourceRegistry import System.FS.API {------------------------------------------------------------------------------- diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Validate.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Validate.hs index dc0d01f1a0..ad0d16b071 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Validate.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Impl/Validate.hs @@ -29,6 +29,7 @@ import Control.Monad.Except (ExceptT (..), MonadError (..), runExcept, runExceptT) import Control.Monad.Reader (ReaderT (..)) import Control.Monad.Trans (MonadTrans (..)) +import Control.ResourceRegistry import Data.Kind import Data.Set (Set) import qualified Data.Set as Set @@ -43,7 +44,6 @@ import qualified Ouroboros.Consensus.Storage.ChainDB.Impl.BlockCache as BlockCac import Ouroboros.Consensus.Storage.LedgerDB.API hiding (validate) import Ouroboros.Consensus.Util.CallStack import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry {------------------------------------------------------------------------------- Validation diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB.hs index 0c813acce3..bffa557eee 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB.hs @@ -463,7 +463,7 @@ newLMDBBackingStore dbTracer limits liveFS@(API.LiveLMDBFS liveFS') snapFS@(API. IOLike.atomically $ IOLike.writeTVar dbOpenHandles mempty liftIO $ LMDB.closeEnvironment dbEnv Trace.traceWith dbTracer API.BSClosed - pure (Closed, ()) + pure ((), Closed) where traceAlreadyClosed = Trace.traceWith dbTracer API.BSAlreadyClosed @@ -541,7 +541,7 @@ mkLMDBBackingStoreValueHandle db = do runCleanup cleanup IOLike.atomically $ IOLike.modifyTVar' dbOpenHandles (Map.delete vhId) Trace.traceWith tracer API.BSVHClosed - pure (Closed, ()) + pure ((), Closed) where traceAlreadyClosed = Trace.traceWith dbTracer API.BSAlreadyClosed traceTVHAlreadyClosed = Trace.traceWith tracer API.BSVHAlreadyClosed diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB/Status.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB/Status.hs index 878f0c8d90..3ce24850bf 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB/Status.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/BackingStore/Impl/LMDB/Status.hs @@ -18,12 +18,12 @@ module Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status ( ) where import Control.Exception (Exception) +import Control.RAWLock (RAWLock) +import qualified Control.RAWLock as RAW import Data.Functor ((<&>)) import GHC.Generics (Generic) import NoThunks.Class (NoThunks) import Ouroboros.Consensus.Util.IOLike (IOLike, MonadThrow (throwIO)) -import Ouroboros.Consensus.Util.MonadSTM.RAWLock (RAWLock) -import qualified Ouroboros.Consensus.Util.MonadSTM.RAWLock as RAW {------------------------------------------------------------------------------- Status @@ -58,7 +58,7 @@ withWriteAccess :: (IOLike m, Exception e) => StatusLock m -> e -- ^ The exception to throw - -> m (Status, a) -- ^ Action to perform, possibly updating the 'Status' + -> m (a, Status) -- ^ Action to perform, possibly updating the 'Status' -> m a withWriteAccess lock exc k = RAW.withWriteAccess (getStatusLock lock) $ \case @@ -70,12 +70,12 @@ withWriteAccess' :: IOLike m => StatusLock m -> m a - -> m (Status, a) + -> m (a, Status) -> m a withWriteAccess' lock def k = RAW.withWriteAccess (getStatusLock lock) $ \case Open -> k - Closed -> def <&> (Closed,) + Closed -> def <&> (,Closed) -- | A variant of 'RAW.withReadAccess' that throws an exception if @'Status' == -- 'Closed'@. diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Common.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Common.hs index 667845d408..6139adeaf4 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Common.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Common.hs @@ -4,6 +4,7 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleContexts #-} #if __GLASGOW_HASKELL__ <= 906 {-# LANGUAGE GADTs #-} @@ -104,7 +105,7 @@ data LedgerDBEnv m l blk = LedgerDBEnv { -- - when taking a snapshot of the ledger db, we need to prevent others -- from altering the backing store at the same time, thus we acquire a -- Write lock. - , ldbLock :: !(LedgerDBLock m) + , ldbLock :: !(AllowThunk (LedgerDBLock m)) -- | INVARIANT: this set contains only points that are in the -- VolatileDB. -- diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Forker.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Forker.hs index 2b8f98c018..a7e1a4517e 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Forker.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Forker.hs @@ -18,12 +18,14 @@ module Ouroboros.Consensus.Storage.LedgerDB.V1.Forker ( , acquireAtWellKnownPoint ) where +import Control.ResourceRegistry import Control.Tracer import Data.Functor.Contravariant ((>$<)) import qualified Data.Map.Strict as Map import Data.Semigroup import qualified Data.Set as Set import Data.Word +import NoThunks.Class import Ouroboros.Consensus.Block import Ouroboros.Consensus.Ledger.Abstract import Ouroboros.Consensus.Ledger.SupportsProtocol @@ -42,7 +44,6 @@ import Ouroboros.Consensus.Storage.LedgerDB.V1.DbChangelog import Ouroboros.Consensus.Storage.LedgerDB.V1.Lock import Ouroboros.Consensus.Util import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry import Ouroboros.Network.Protocol.LocalStateQuery.Type {------------------------------------------------------------------------------- @@ -59,8 +60,8 @@ newForkerAtWellKnownPoint :: -> ResourceRegistry m -> Target (Point blk) -> m (Forker m l blk) -newForkerAtWellKnownPoint h rr pt = getEnv h $ \ldbEnv -> do - withReadLock (ldbLock ldbEnv) (acquireAtWellKnownPoint ldbEnv rr pt) >>= newForker h ldbEnv +newForkerAtWellKnownPoint h rr pt = getEnv h $ \ldbEnv@LedgerDBEnv{ldbLock = AllowThunk lock} -> do + withReadLock lock (acquireAtWellKnownPoint ldbEnv rr pt) >>= newForker h ldbEnv newForkerAtPoint :: ( HeaderHash l ~ HeaderHash blk @@ -74,8 +75,8 @@ newForkerAtPoint :: -> ResourceRegistry m -> Point blk -> m (Either GetForkerError (Forker m l blk)) -newForkerAtPoint h rr pt = getEnv h $ \ldbEnv -> do - withReadLock (ldbLock ldbEnv) (acquireAtPoint ldbEnv rr pt) >>= traverse (newForker h ldbEnv) +newForkerAtPoint h rr pt = getEnv h $ \ldbEnv@LedgerDBEnv{ldbLock = AllowThunk lock} -> do + withReadLock lock (acquireAtPoint ldbEnv rr pt) >>= traverse (newForker h ldbEnv) newForkerAtFromTip :: ( IOLike m @@ -87,8 +88,8 @@ newForkerAtFromTip :: -> ResourceRegistry m -> Word64 -> m (Either ExceededRollback (Forker m l blk)) -newForkerAtFromTip h rr n = getEnv h $ \ldbEnv -> do - withReadLock (ldbLock ldbEnv) (acquireAtFromTip ldbEnv rr n) >>= traverse (newForker h ldbEnv) +newForkerAtFromTip h rr n = getEnv h $ \ldbEnv@LedgerDBEnv{ldbLock = AllowThunk lock} -> do + withReadLock lock (acquireAtFromTip ldbEnv rr n) >>= traverse (newForker h ldbEnv) -- | Close all open block and header 'Follower's. closeAllForkers :: diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Init.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Init.hs index 3a78c54585..e423d5ad3c 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Init.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Init.hs @@ -17,6 +17,7 @@ module Ouroboros.Consensus.Storage.LedgerDB.V1.Init (mkInitDb) where import Control.Monad import Control.Monad.Base +import Control.ResourceRegistry import Control.Tracer (nullTracer) import Data.Foldable import Data.Functor.Contravariant ((>$<)) @@ -25,6 +26,7 @@ import Data.Maybe (isJust) import Data.Set (Set) import qualified Data.Set as Set import Data.Word +import NoThunks.Class import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config import Ouroboros.Consensus.HardFork.Abstract @@ -57,7 +59,6 @@ import Ouroboros.Consensus.Util import Ouroboros.Consensus.Util.Args import Ouroboros.Consensus.Util.CallStack import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry import qualified Ouroboros.Network.AnchoredSeq as AS import System.FS.API @@ -112,7 +113,7 @@ mkInitDb args bss getBlock = let env = LedgerDBEnv { ldbChangelog = varDB , ldbBackingStore = lgrBackingStore - , ldbLock = flushLock + , ldbLock = AllowThunk flushLock , ldbPrevApplied = prevApplied , ldbForkers = forkers , ldbNextForkerKey = nextForkerKey @@ -255,9 +256,9 @@ implTryTakeSnapshot :: , IOLike m, LedgerDbSerialiseConstraints blk, LedgerSupportsProtocol blk ) => LedgerDBEnv m l blk -> Maybe (Time, Time) -> Word64 -> m SnapCounters -implTryTakeSnapshot env mTime nrBlocks = +implTryTakeSnapshot env@LedgerDBEnv{ldbLock = AllowThunk lock} mTime nrBlocks = if onDiskShouldTakeSnapshot (ldbSnapshotPolicy env) (uncurry (flip diffTime) <$> mTime) nrBlocks then do - void $ withReadLock (ldbLock env) (takeSnapshot + void $ withReadLock lock (takeSnapshot (ldbChangelog env) (configCodec . getExtLedgerCfg . ledgerDbCfg $ ldbCfg env) (LedgerDBSnapshotEvent >$< ldbTracer env) @@ -278,11 +279,11 @@ implTryTakeSnapshot env mTime nrBlocks = implTryFlush :: (IOLike m, HasLedgerTables l, GetTip l) => LedgerDBEnv m l blk -> m () -implTryFlush env = do +implTryFlush env@LedgerDBEnv{ldbLock = AllowThunk lock} = do ldb <- readTVarIO $ ldbChangelog env when (ldbShouldFlush env $ DbCh.flushableLength $ anchorlessChangelog ldb) (withWriteLock - (ldbLock env) + lock (flushLedgerDB (ldbChangelog env) (ldbBackingStore env)) ) @@ -352,11 +353,11 @@ implIntTakeSnapshot :: , l ~ ExtLedgerState blk ) => LedgerDBEnv m l blk -> Maybe DiskSnapshot -> m () -implIntTakeSnapshot env diskSnapshot = do +implIntTakeSnapshot env@LedgerDBEnv{ldbLock = AllowThunk lock} diskSnapshot = do withWriteLock - (ldbLock env) + lock (flushLedgerDB (ldbChangelog env) (ldbBackingStore env)) - void $ withReadLock (ldbLock env) $ + void $ withReadLock lock $ takeSnapshot (ldbChangelog env) (configCodec . getExtLedgerCfg . ledgerDbCfg $ ldbCfg env) diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Lock.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Lock.hs index bb4b19add3..48abead325 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Lock.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Lock.hs @@ -1,5 +1,10 @@ {-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MonoLocalBinds #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE UndecidableInstances #-} module Ouroboros.Consensus.Storage.LedgerDB.V1.Lock ( -- * LedgerDB lock @@ -14,9 +19,9 @@ module Ouroboros.Consensus.Storage.LedgerDB.V1.Lock ( , writeLocked ) where +import qualified Control.RAWLock as Lock import NoThunks.Class import Ouroboros.Consensus.Util.IOLike -import qualified Ouroboros.Consensus.Util.MonadSTM.RAWLock as Lock {------------------------------------------------------------------------------- LedgerDB lock @@ -45,7 +50,8 @@ import qualified Ouroboros.Consensus.Util.MonadSTM.RAWLock as Lock -- -- - Write lock when flushing differences. newtype LedgerDBLock m = LedgerDBLock (Lock.RAWLock m ()) - deriving newtype NoThunks + +deriving newtype instance NoThunks (Lock.RAWLock m ()) => NoThunks (LedgerDBLock m) mkLedgerDBLock :: IOLike m => m (LedgerDBLock m) mkLedgerDBLock = LedgerDBLock <$> Lock.new () @@ -77,4 +83,4 @@ writeLocked = WriteLocked -- | Acquire the ledger DB write lock and hold it while performing an action withWriteLock :: IOLike m => LedgerDBLock m -> WriteLocked m a -> m a withWriteLock (LedgerDBLock lock) m = - Lock.withWriteAccess lock (\() -> (,) () <$> runWriteLocked m) + Lock.withWriteAccess lock (\() -> (,()) <$> runWriteLocked m) diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Common.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Common.hs index 1b50b7278b..1236319184 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Common.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Common.hs @@ -2,6 +2,7 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -38,6 +39,9 @@ module Ouroboros.Consensus.Storage.LedgerDB.V2.Common ( import Control.Arrow import Control.Monad ((>=>)) +import Control.RAWLock (RAWLock) +import qualified Control.RAWLock as RAWLock +import Control.ResourceRegistry import Control.Tracer import Data.Functor.Contravariant ((>$<)) import Data.Kind @@ -47,6 +51,7 @@ import Data.Maybe (fromMaybe) import Data.Set (Set) import Data.Word import GHC.Generics +import NoThunks.Class import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config import Ouroboros.Consensus.Ledger.Abstract @@ -61,9 +66,7 @@ import Ouroboros.Consensus.Storage.LedgerDB.V2.LedgerSeq import Ouroboros.Consensus.Util import Ouroboros.Consensus.Util.CallStack import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.MonadSTM.RAWLock (RAWLock) -import qualified Ouroboros.Consensus.Util.MonadSTM.RAWLock as RAWLock -import Ouroboros.Consensus.Util.ResourceRegistry +import Ouroboros.Consensus.Util.NormalForm.StrictTVar () import qualified Ouroboros.Network.AnchoredSeq as AS import Ouroboros.Network.Protocol.LocalStateQuery.Type import Prelude hiding (read) @@ -104,7 +107,7 @@ data LedgerDBEnv m l blk = LedgerDBEnv { , ldbHasFS :: !(SomeHasFS m) , ldbResolveBlock :: !(ResolveBlock m blk) , ldbQueryBatchSize :: !(Maybe Int) - , ldbReleaseLock :: !(RAWLock m LDBLock) + , ldbReleaseLock :: !(AllowThunk (RAWLock m LDBLock)) } deriving (Generic) deriving instance ( IOLike m @@ -206,9 +209,11 @@ data ForkerEnv m l blk = ForkerEnv { deriving Generic closeForkerEnv :: IOLike m => (LedgerDBEnv m l blk, ForkerEnv m l blk) -> m () -closeForkerEnv (ldbEnv, frkEnv) = - RAWLock.withWriteAccess_ (ldbReleaseLock ldbEnv) $ - const $ sequence_ =<< readTVarIO (foeResourcesToRelease frkEnv) +closeForkerEnv (LedgerDBEnv{ldbReleaseLock = AllowThunk lock}, frkEnv) = + RAWLock.withWriteAccess lock $ + const $ do + sequence_ =<< readTVarIO (foeResourcesToRelease frkEnv) + pure ((), LDBLock) deriving instance ( IOLike m , LedgerSupportsProtocol blk @@ -486,8 +491,8 @@ newForkerAtWellKnownPoint :: -> ResourceRegistry m -> Target (Point blk) -> m (Forker m l blk) -newForkerAtWellKnownPoint h rr pt = getEnv h $ \ldbEnv -> do - RAWLock.withReadAccess (ldbReleaseLock ldbEnv) (acquireAtWellKnownPoint ldbEnv pt) >>= newForker h ldbEnv rr +newForkerAtWellKnownPoint h rr pt = getEnv h $ \ldbEnv@LedgerDBEnv{ldbReleaseLock = AllowThunk lock} -> do + RAWLock.withReadAccess lock (acquireAtWellKnownPoint ldbEnv pt) >>= newForker h ldbEnv rr newForkerAtPoint :: ( HeaderHash l ~ HeaderHash blk @@ -501,8 +506,8 @@ newForkerAtPoint :: -> ResourceRegistry m -> Point blk -> m (Either GetForkerError (Forker m l blk)) -newForkerAtPoint h rr pt = getEnv h $ \ldbEnv -> do - RAWLock.withReadAccess (ldbReleaseLock ldbEnv) (acquireAtPoint ldbEnv pt) >>= traverse (newForker h ldbEnv rr) +newForkerAtPoint h rr pt = getEnv h $ \ldbEnv@LedgerDBEnv{ldbReleaseLock = AllowThunk lock} -> do + RAWLock.withReadAccess lock (acquireAtPoint ldbEnv pt) >>= traverse (newForker h ldbEnv rr) newForkerAtFromTip :: ( IOLike m @@ -515,8 +520,8 @@ newForkerAtFromTip :: -> ResourceRegistry m -> Word64 -> m (Either ExceededRollback (Forker m l blk)) -newForkerAtFromTip h rr n = getEnv h $ \ldbEnv -> do - RAWLock.withReadAccess (ldbReleaseLock ldbEnv) (acquireAtFromTip ldbEnv n) >>= traverse (newForker h ldbEnv rr) +newForkerAtFromTip h rr n = getEnv h $ \ldbEnv@LedgerDBEnv{ldbReleaseLock = AllowThunk lock} -> do + RAWLock.withReadAccess lock (acquireAtFromTip ldbEnv n) >>= traverse (newForker h ldbEnv rr) -- | Close all open block and header 'Follower's. closeAllForkers :: diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/InMemory.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/InMemory.hs index 5ff8778a9e..3459409032 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/InMemory.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/InMemory.hs @@ -34,6 +34,7 @@ import qualified Codec.CBOR.Write as CBOR import Codec.Serialise (decode) import Control.Monad (unless, void) import Control.Monad.Except (runExceptT) +import Control.ResourceRegistry import Control.Tracer import qualified Data.ByteString.Lazy as BSL import qualified Data.List as List @@ -51,7 +52,6 @@ import Ouroboros.Consensus.Storage.LedgerDB.Impl.Common import Ouroboros.Consensus.Storage.LedgerDB.Impl.Snapshots import Ouroboros.Consensus.Storage.LedgerDB.V2.LedgerSeq import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry import Prelude hiding (read) import System.FS.API import System.FS.API.Lazy diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Init.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Init.hs index a5d8cdcea7..a8dfe9e8c6 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Init.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/Init.hs @@ -16,6 +16,8 @@ module Ouroboros.Consensus.Storage.LedgerDB.V2.Init (mkInitDb) where import Control.Monad (void) import Control.Monad.Base +import qualified Control.RAWLock as RAWLock +import Control.ResourceRegistry import Control.Tracer import Data.Foldable import Data.Functor.Contravariant ((>$<)) @@ -24,6 +26,7 @@ import Data.Maybe (isJust) import Data.Set (Set) import qualified Data.Set as Set import Data.Word +import NoThunks.Class import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config import Ouroboros.Consensus.HardFork.Abstract @@ -49,8 +52,6 @@ import Ouroboros.Consensus.Util import Ouroboros.Consensus.Util.Args import Ouroboros.Consensus.Util.CallStack import Ouroboros.Consensus.Util.IOLike -import qualified Ouroboros.Consensus.Util.MonadSTM.RAWLock as RAWLock -import Ouroboros.Consensus.Util.ResourceRegistry import qualified Ouroboros.Network.AnchoredSeq as AS import Ouroboros.Network.Protocol.LocalStateQuery.Type import System.FS.API @@ -101,7 +102,7 @@ mkInitDb args flavArgs getBlock = , ldbHasFS = lgrHasFS , ldbResolveBlock = getBlock , ldbQueryBatchSize = Nothing - , ldbReleaseLock = lock + , ldbReleaseLock = AllowThunk lock } h <- LDBHandle <$> newTVarIO (LedgerDBOpen env) pure $ implMkLedgerDb h bss diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/LedgerSeq.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/LedgerSeq.hs index 21c1720244..272bca29e8 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/LedgerSeq.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/LedgerSeq.hs @@ -49,6 +49,7 @@ module Ouroboros.Consensus.Storage.LedgerDB.V2.LedgerSeq ( , volatileStatesBimap ) where +import Control.ResourceRegistry import qualified Data.Bifunctor as B import Data.Function (on) import Data.Word @@ -61,7 +62,6 @@ import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.Tables.Utils import Ouroboros.Consensus.Storage.LedgerDB.API.Config import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry import Ouroboros.Network.AnchoredSeq hiding (anchor, last, map, rollback) import qualified Ouroboros.Network.AnchoredSeq as AS hiding (map) diff --git a/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool.hs b/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool.hs index 5503f30af3..649183f1cb 100644 --- a/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool.hs +++ b/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool.hs @@ -61,8 +61,8 @@ import Ouroboros.Consensus.Mock.Ledger hiding (TxId) import Ouroboros.Consensus.Util (repeatedly, repeatedlyM) import Ouroboros.Consensus.Util.Condense (condense) import Ouroboros.Consensus.Util.IOLike -import Test.Crypto.Hash () import Test.Consensus.Mempool.Util +import Test.Crypto.Hash () import Test.QuickCheck hiding (elements) import Test.Tasty (TestTree, testGroup) import Test.Tasty.QuickCheck (testProperty) diff --git a/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool/Util.hs b/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool/Util.hs index d5dc4e61a2..c00c8504ae 100644 --- a/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool/Util.hs +++ b/ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool/Util.hs @@ -4,20 +4,20 @@ module Test.Consensus.Mempool.Util ( TestBlock , TestTx - , TestTxId , TestTxError + , TestTxId , TheMeasure , applyTxToLedger , genInvalidTx + , genLargeInvalidTx , genTxs , genValidTx , genValidTxs + , mkTestLedgerConfig , mustBeValid , testInitLedger - , mkTestLedgerConfig - , genLargeInvalidTx - , txIsValid , testLedgerConfigNoSizeLimits + , txIsValid ) where import Cardano.Binary (Encoding, toCBOR) diff --git a/ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/LocalStateQuery/Server.hs b/ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/LocalStateQuery/Server.hs index 0be2ffac9d..79d3639f91 100644 --- a/ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/LocalStateQuery/Server.hs +++ b/ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/LocalStateQuery/Server.hs @@ -24,6 +24,7 @@ import Cardano.Crypto.DSIGN.Mock import Control.Concurrent.Class.MonadSTM.Strict.TMVar import Control.Monad.Base import Control.Monad.IOSim (runSimOrThrow) +import Control.ResourceRegistry import Control.Tracer import qualified Data.Map.Strict as Map import Data.Maybe (fromMaybe) @@ -47,7 +48,6 @@ import Ouroboros.Consensus.Storage.LedgerDB.Impl.Args import Ouroboros.Consensus.Storage.LedgerDB.Impl.Snapshots import Ouroboros.Consensus.Storage.LedgerDB.V1.Args import Ouroboros.Consensus.Util.IOLike hiding (newTVarIO) -import Ouroboros.Consensus.Util.ResourceRegistry import Ouroboros.Network.Mock.Chain (Chain (..)) import qualified Ouroboros.Network.Mock.Chain as Chain import Ouroboros.Network.Protocol.LocalStateQuery.Client @@ -56,7 +56,7 @@ import Ouroboros.Network.Protocol.LocalStateQuery.Examples import Ouroboros.Network.Protocol.LocalStateQuery.Server import Ouroboros.Network.Protocol.LocalStateQuery.Type (AcquireFailure (..), State (..), Target (..)) -import System.FS.API (HasFS, SomeHasFS (..)) +import System.FS.API (SomeHasFS (..)) import qualified System.FS.Sim.MockFS as MockFS import System.FS.Sim.STM import Test.QuickCheck hiding (Result) diff --git a/ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/LedgerDB/StateMachine.hs b/ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/LedgerDB/StateMachine.hs index bfa9a7ace4..01f1302c66 100644 --- a/ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/LedgerDB/StateMachine.hs +++ b/ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/LedgerDB/StateMachine.hs @@ -46,6 +46,7 @@ module Test.Ouroboros.Storage.LedgerDB.StateMachine (tests) where import Control.Monad.Except import Control.Monad.State hiding (state) +import Control.ResourceRegistry import Control.Tracer (nullTracer) import qualified Data.List as L import Data.Map.Strict (Map) @@ -73,7 +74,6 @@ import Ouroboros.Consensus.Storage.LedgerDB.V2.Init as V2 import Ouroboros.Consensus.Util hiding (Some) import Ouroboros.Consensus.Util.Args import Ouroboros.Consensus.Util.IOLike -import Ouroboros.Consensus.Util.ResourceRegistry import qualified Ouroboros.Network.AnchoredSeq as AS import qualified System.Directory as Dir import System.FS.API