Skip to content

Commit

Permalink
Remove or relocate comments in import lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo authored and jorisdral committed Mar 22, 2023
1 parent b0e91c7 commit d072fd6
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 115 deletions.
Expand Up @@ -90,7 +90,6 @@ import Test.Util.Range
import Test.Util.TestBlock hiding (TestBlock, TestBlockCodecConfig,
TestBlockStorageConfig)

-- For the Arbitrary instance of 'MemPolicy'
import Codec.Serialise (Serialise)
import Test.Ouroboros.Storage.LedgerDB.InMemory ()
import Test.Ouroboros.Storage.LedgerDB.OrphanArbitrary ()
Expand Down
98 changes: 0 additions & 98 deletions ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator.hs
Expand Up @@ -5,141 +5,43 @@
-- Intended for unqualified import
module Ouroboros.Consensus.HardFork.Combinator (module X) where

-- Defines 'SingleEraInfo' and 'LedgerEraInfo'
import Ouroboros.Consensus.HardFork.Combinator.Info as X

-- Defines 'SingleEraBlock' and 'CanHardFork'
import Ouroboros.Consensus.HardFork.Combinator.Abstract as X

-- Defines 'HardForkProtocol', 'HardForkBlock', and 'LedgerState',
-- as well as various config types.
import Ouroboros.Consensus.HardFork.Combinator.Basics as X

-- Defines 'HasPartialConsensusConfig' and 'HasPartialLedgerConfig'
import Ouroboros.Consensus.HardFork.Combinator.PartialConfig as X

-- Instances for 'BlockHasCodecConfig', 'GetHeader', 'HasHeader',
-- 'BasicEnvelopeValidation'
import Ouroboros.Consensus.HardFork.Combinator.Block as X

-- Instances for 'IsLedger', 'ApplyBlock', 'UpdateLedger',
-- 'LedgerSupportsProtocol', 'HasHardForkHistory', 'ValidateEnvelope'
import Ouroboros.Consensus.HardFork.Combinator.Ledger as X

-- Instances for 'ApplyTx', 'HasTxId', 'HasTxs'
import Ouroboros.Consensus.HardFork.Combinator.Mempool as X

-- Instance for 'ConsensusProtocol'
import Ouroboros.Consensus.HardFork.Combinator.Protocol as X

-- Instance for 'CommonProtocolParams'
import Ouroboros.Consensus.HardFork.Combinator.Ledger.CommonProtocolParams as X ()

-- Instance for 'LedgerSupportsPeerSelection'
import Ouroboros.Consensus.HardFork.Combinator.Ledger.PeerSelection as X ()

-- Instances for 'ShowQuery' and 'QueryLedger'
-- Definition of 'Query', required for serialisation code
import Ouroboros.Consensus.HardFork.Combinator.Ledger.Query as X

-- Instance for 'ChainSelection'
import Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel as X

-- Re-export only the types that are useful in RunNode instances for HFC blocks
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras as X
(MismatchEraInfo (..), OneEraApplyTxErr (..),
OneEraBlock (..), OneEraGenTx (..), OneEraGenTxId (..),
OneEraHash (..), OneEraHeader (..), OneEraTipInfo (..),
PerEraCodecConfig (..), PerEraLedgerConfig (..))

-- Re-export types required to initialize 'ProtocolInfo'
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras as X
(PerEraBlockConfig (..), PerEraConsensusConfig (..),
PerEraStorageConfig (..))

-- Defines the various translation types required for concrete HFC instances
import Ouroboros.Consensus.HardFork.Combinator.Translation as X

-- Combinator for 'BlockForging'
import Ouroboros.Consensus.HardFork.Combinator.Forging as X
(HardForkForgeStateInfo (..), hardForkBlockForging)

-- Instances for 'RunNode' and 'ConfigSupportsNode'
import Ouroboros.Consensus.HardFork.Combinator.Node as X ()

-- Instance for 'NodeInitStorage'
import Ouroboros.Consensus.HardFork.Combinator.Node.InitStorage as X ()

-- Instance for 'BlockSupportsMetrics'
import Ouroboros.Consensus.HardFork.Combinator.Node.Metrics as X ()

-- Definition of InPairs (required to define translations)
import Ouroboros.Consensus.HardFork.Combinator.Util.InPairs as X
(InPairs (..))

-- Definition of Telescope (required to define serialisation code)
import Ouroboros.Consensus.HardFork.Combinator.Util.Telescope as X
(Telescope (..))

-- Definition of 'Mismatch' (required to define serialisation code)
import Ouroboros.Consensus.HardFork.Combinator.Util.Match as X
(Mismatch (..))

-- Definition of HardForkState (required to define serialisation code)
-- Also export functions required to define 'protocolInfo'.
import Ouroboros.Consensus.HardFork.Combinator.State as X
(HardForkState (..), initHardForkState)

-- Definition of 'InjectTx' (required to define tx injections)
import Ouroboros.Consensus.HardFork.Combinator.InjectTxs as X
(InjectTx, InjectValidatedTx, cannotInjectTx,
cannotInjectValidatedTx, pattern InjectTx,
pattern InjectValidatedTx)
import Ouroboros.Consensus.HardFork.Combinator.Util.Functors as X
(Product2 (..))

-- Omitted from this export:
--
-- * "Ouroboros.Consensus.HardFork.Combinator.State"
-- This defines 'HardForkState', a wrapper around a 'Telescope'. We use this
-- to define 'HardForkLedgerState', 'HardForkLedgerView' as well as
-- 'HardForkChainDepState', but the type itself should mostly be internal to
-- the hard fork combinator. We do export the constructor for it, as this may
-- be required for serialisation code.
--
-- * "module Ouroboros.Consensus.HardFork.Combinator.State.Infra"
-- This module is only separate from @.State@ to avoid some cyclic module
-- dependencies. Most modules internally to the HFC should import from
-- @.State@ directly, and outside of the HFC not even @.State@ should be
-- needed (see above).
--
-- * "Ouroboros.Consensus.HardFork.Combinator.Protocol.LedgerView"
-- This is internal to "Ouroboros.Consensus.HardFork.Combinator.Protocol"
--
-- * "Ouroboros.Consensus.HardFork.Combinator.Protocol.State"
-- This is internal to "Ouroboros.Consensus.HardFork.Combinator.Protocol"
--
-- * "Ouroboros.Consensus.HardFork.Combinator.Degenerate"
-- This defines 'DegenFork', which is useful as a test case that the hard
-- fork combinator when applied to a single block results in a system
-- that is equivalent to just using that single block directly.
--
-- * "Ouroboros.Consensus.HardFork.Combinator.Embed.Unary"
-- Mostly used in combination with 'DegenFork'.
--
-- * "Ouroboros.Consensus.HardFork.Combinator.Embed.Nary"
-- Used for injection into n-ary sums. Alternative to @Unary@.
--
-- * Most of @Ouroboros.Consensus.HardFork.Combinator.SingleEra.*@
-- These types are primarily used internally to define the HFC types.
-- In a few cases some of the HFC types /are/ types from the SingleEra
-- module hierarchy directly; in such cases, we should export them from
-- this module.
-- TODO: Currently we only do this for @SingleEra.Info@, but we might also
-- need to do it for other types.
--
-- * Ouroboros.Consensus.HardFork.Combinator.Util.*
-- We omit most utility functions and types, which are for internal use. Some
-- exceptions the defintion of InPairs, which will be required to define
-- translations, and the definition of a Telescope, which might be needed to
-- define serialisation code.
Expand Up @@ -36,7 +36,6 @@ import Ouroboros.Consensus.HeaderValidation hiding (validateHeader)
import qualified Ouroboros.Consensus.HeaderValidation as HeaderValidation
import Ouroboros.Consensus.Protocol.Abstract

-- Support for tests
import qualified Data.List.NonEmpty as NE
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Extended
Expand Down
Expand Up @@ -95,7 +95,6 @@ import Ouroboros.Consensus.Storage.LedgerDB (LedgerDB')
import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB
import Ouroboros.Consensus.Storage.Serialisation

-- Support for tests
import Ouroboros.Network.Mock.Chain (Chain (..))
import qualified Ouroboros.Network.Mock.Chain as Chain

Expand Down
Expand Up @@ -2,10 +2,10 @@ module Ouroboros.Consensus.Storage.ImmutableDB.Chunks (module X) where


import Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Layout as X

-- Only export public API from the Internal module
import Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal as X
(ChunkInfo (..), ChunkNo, ChunkSize (..),
chunkInfoSupportsEBBs, chunksBetween, compareRelativeSlot,
countChunks, firstChunkNo, getChunkSize, mkRelativeSlot,
nextChunkNo, prevChunkNo, simpleChunkInfo, singleChunkInfo)

-- The Internal re-export only exposes public API
Expand Up @@ -10,7 +10,8 @@
-- | Layout of individual chunks on disk
--
-- This module is not re-exported from the public Chunks API, since it's only
-- relevant internally in the immutable DB.
-- relevant internally in the immutable DB. This module makes the layout
-- decisions.
module Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Layout (
-- * Relative slots
NextRelativeSlot (..)
Expand Down Expand Up @@ -54,9 +55,6 @@ import Ouroboros.Consensus.Storage.ImmutableDB.API (Tip (..))
import Ouroboros.Consensus.Storage.ImmutableDB.Impl.Types
(BlockOrEBB (..))

-- Most types in the Chunks interface are opaque in the public API, since their
-- interpretation is subject to layout decisions. In this module we /make/ those
-- layout decisions, however, and so here we need access to the internal types.
import Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal

{-------------------------------------------------------------------------------
Expand Down
Expand Up @@ -26,7 +26,6 @@ import Ouroboros.Consensus.Util.CBOR (ReadIncrementalErr)

import Ouroboros.Consensus.Storage.ImmutableDB.API (Tip)

-- Importing from Internal to avoid circular dependency
import Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal
(ChunkNo)

Expand Down
1 change: 0 additions & 1 deletion ouroboros-consensus/src/Ouroboros/Consensus/Util/CBOR.hs
Expand Up @@ -59,7 +59,6 @@ import qualified Streaming as S
import qualified Streaming.Prelude as S
import Streaming.Prelude (Of (..), Stream)

--import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Util.IOLike

{-------------------------------------------------------------------------------
Expand Down
Expand Up @@ -42,7 +42,6 @@ import Cardano.Crypto.KES (MockKES, NeverKES, SigKES, SignedKES (..),
import Ouroboros.Consensus.Util.HList (All, HList (..))
import qualified Ouroboros.Consensus.Util.HList as HList

-- Imports from lower-level libs to avoid circular dependencies
import Cardano.Slotting.Block (BlockNo (..))
import Cardano.Slotting.Slot (EpochNo (..), SlotNo (..),
WithOrigin (..))
Expand Down
Expand Up @@ -15,7 +15,6 @@ module Ouroboros.Consensus.Util.MonadSTM.NormalForm (
import GHC.Stack
import NoThunks.Class (NoThunks (..), unsafeNoThunks)


import Ouroboros.Consensus.Util.MonadSTM.StrictMVar hiding
(newEmptyMVar, newEmptyMVarWithInvariant, newMVar,
newMVarWithInvariant)
Expand All @@ -24,17 +23,18 @@ import Control.Concurrent.Class.MonadSTM.Strict.TMVar as StrictSTM hid
(newTMVar, newTMVarIO)
import Control.Concurrent.Class.MonadSTM.Strict.TVar as StrictSTM hiding
(newTVar, newTVarIO, newTVarWithInvariantIO)
-- TODO: use strict versions of 'TQueue' and 'TBQueue'. Previously the
-- 'Control.Monad.Class.MonadSTM.Strict' was imported which
-- exported lazy 'TQueue' and 'TBQueue', I (@coot) think that the intention was
-- to use strict versions.
import Control.Concurrent.Class.MonadSTM.TBQueue as LazySTM
import Control.Concurrent.Class.MonadSTM.TQueue as LazySTM
import Control.Monad.Class.MonadSTM as StrictSTM

import qualified Control.Concurrent.Class.MonadSTM.Strict as Strict
import qualified Ouroboros.Consensus.Util.MonadSTM.StrictMVar as Strict

-- TODO: use strict versions of 'TQueue' and 'TBQueue'. Previously the
-- 'Control.Monad.Class.MonadSTM.Strict' was imported which
-- exported lazy 'TQueue' and 'TBQueue', I (@coot) think that the intention was
-- to use strict versions.

{-------------------------------------------------------------------------------
Wrappers that check for thunks
-------------------------------------------------------------------------------}
Expand Down

0 comments on commit d072fd6

Please sign in to comment.