Skip to content

Commit e2d831d

Browse files
committed
formatting
1 parent fcdb090 commit e2d831d

File tree

8 files changed

+44
-35
lines changed
  • ouroboros-consensus-cardano
    • src
      • ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano
      • unstable-cardano-tools/Cardano
    • test/byron-test/Test/ThreadNet
  • ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet
  • ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus

8 files changed

+44
-35
lines changed

ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Node.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,8 @@ protocolInfoCardano paramsCardano
996996
merge (This1 x) = x
997997
merge (That1 y) = y
998998

999-
let mkHardForkBlockForgings :: m (NonEmptyOptNP (BlockForging m) (CardanoEras c)) -> MkBlockForging m (CardanoBlock c)
999+
let mkHardForkBlockForgings ::
1000+
m (NonEmptyOptNP (BlockForging m) (CardanoEras c)) -> MkBlockForging m (CardanoBlock c)
10001001
mkHardForkBlockForgings mbfs = MkBlockForging $ do
10011002
bfs <- mbfs
10021003
mkBlockForging $ hardForkBlockForging (const "Cardano") (hmap (MkBlockForging . pure) bfs)

ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/Protocol/Types.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Cardano.Api.Protocol.Types
2222
import Cardano.Chain.Slotting (EpochSlots)
2323
import qualified Control.Tracer as Tracer
2424
import Data.Bifunctor (bimap)
25-
import Ouroboros.Consensus.Block.Forging (MkBlockForging(..))
25+
import Ouroboros.Consensus.Block.Forging (MkBlockForging (..))
2626
import Ouroboros.Consensus.Byron.ByronHFC (ByronBlockHFC)
2727
import Ouroboros.Consensus.Cardano
2828
import Ouroboros.Consensus.Cardano.Block

ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBSynthesizer/Run.hs

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -162,27 +162,31 @@ synthesize genTxs DBSynthesizerConfig{confOptions, confShelleyGenesis, confDbDir
162162
$ ChainDB.defaultArgs
163163

164164
mbfs <- mkForgers nullTracer
165-
allocatedForgers <- traverse (\mbf -> allocate registry (const (BlockForging.mkBlockForging mbf)) BlockForging.finalize) mbfs
165+
allocatedForgers <-
166+
traverse
167+
(\mbf -> allocate registry (const (BlockForging.mkBlockForging mbf)) BlockForging.finalize)
168+
mbfs
166169
let forgers = snd <$> allocatedForgers
167170
let fCount = length forgers
168171
putStrLn $ "--> forger count: " ++ show fCount
169-
r <- if fCount > 0
170-
then do
171-
putStrLn $ "--> opening ChainDB on file system with mode: " ++ show synthOpenMode
172-
preOpenChainDB synthOpenMode confDbDir
173-
let dbTracer = nullTracer
174-
ChainDB.withDB (ChainDB.updateTracer dbTracer dbArgs) $ \chainDB -> do
175-
slotNo <- do
176-
tip <- atomically (ChainDB.getTipPoint chainDB)
177-
pure $ case pointSlot tip of
178-
Origin -> 0
179-
At s -> succ s
172+
r <-
173+
if fCount > 0
174+
then do
175+
putStrLn $ "--> opening ChainDB on file system with mode: " ++ show synthOpenMode
176+
preOpenChainDB synthOpenMode confDbDir
177+
let dbTracer = nullTracer
178+
ChainDB.withDB (ChainDB.updateTracer dbTracer dbArgs) $ \chainDB -> do
179+
slotNo <- do
180+
tip <- atomically (ChainDB.getTipPoint chainDB)
181+
pure $ case pointSlot tip of
182+
Origin -> 0
183+
At s -> succ s
180184

181-
putStrLn $ "--> starting at: " ++ show slotNo
182-
runForge epochSize slotNo synthLimit chainDB forgers pInfoConfig $ genTxs pInfoConfig
183-
else do
184-
putStrLn "--> no forgers found; leaving possibly existing ChainDB untouched"
185-
pure $ ForgeResult 0
185+
putStrLn $ "--> starting at: " ++ show slotNo
186+
runForge epochSize slotNo synthLimit chainDB forgers pInfoConfig $ genTxs pInfoConfig
187+
else do
188+
putStrLn "--> no forgers found; leaving possibly existing ChainDB untouched"
189+
pure $ ForgeResult 0
186190
mapM_ (release . fst) allocatedForgers $> r
187191
where
188192
DBSynthesizerOptions

ouroboros-consensus-cardano/test/byron-test/Test/ThreadNet/DualByron.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ setupTestOutput setup@SetupDualByron{..} =
154154
testConfigB
155155
TestConfigMB
156156
{ nodeInfo = \coreNodeId -> do
157-
let (pInfo, bfs) = protocolInfoDualByron
158-
setupGenesis
159-
(setupParams setup)
160-
[coreNodeId]
157+
let (pInfo, bfs) =
158+
protocolInfoDualByron
159+
setupGenesis
160+
(setupParams setup)
161+
[coreNodeId]
161162
plainTestNodeInitialization pInfo (fmap (fmap (MkBlockForging . pure)) bfs)
162163
, mkRekeyM = Nothing -- TODO
163164
}

ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Network.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,9 @@ runThreadNetwork
10991099

11001100
mkBlockForgings <- mkBlockForging
11011101
let mkBlockForgings' =
1102-
map (\(MkBlockForging bfM) -> MkBlockForging $ fmap (\bf -> bf{forgeBlock = customForgeBlock bf}) bfM) mkBlockForgings
1102+
map
1103+
(\(MkBlockForging bfM) -> MkBlockForging $ fmap (\bf -> bf{forgeBlock = customForgeBlock bf}) bfM)
1104+
mkBlockForgings
11031105
setBlockForging nodeKernel mkBlockForgings'
11041106

11051107
let mempool = getMempool nodeKernel

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/Forging.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ data BlockForging m blk = BlockForging
156156
-- HotKeys, that *MUST* be finalized when the 'BlockForging' is no longer in
157157
-- use. Users of this code must call the 'finalize' function on the returned 'BlockForging' at least once after terminating otherwise allocated resources
158158
-- may leak.
159-
newtype MkBlockForging m blk =
160-
MkBlockForging { mkBlockForging :: m (BlockForging m blk) }
159+
newtype MkBlockForging m blk
160+
= MkBlockForging {mkBlockForging :: m (BlockForging m blk)}
161161

162162
data ShouldForge blk
163163
= -- | Before check whether we are a leader in this slot, we tried to update

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Embed/Binary.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{-# LANGUAGE LambdaCase #-}
44
{-# LANGUAGE OverloadedStrings #-}
55
{-# LANGUAGE ScopedTypeVariables #-}
6-
{-# LANGUAGE TypeOperators #-}
76
{-# LANGUAGE TypeFamilies #-}
7+
{-# LANGUAGE TypeOperators #-}
88

99
module Ouroboros.Consensus.HardFork.Combinator.Embed.Binary (protocolInfoBinary) where
1010

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Forging.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ hardForkBlockForging ::
8787
MkBlockForging m (HardForkBlock xs)
8888
hardForkBlockForging labelF mkBlockForgings = MkBlockForging $ do
8989
blockForgings <- htraverse' mkBlockForging mkBlockForgings
90-
pure BlockForging
91-
{ forgeLabel = labelF blockForgings
92-
, canBeLeader = hardForkCanBeLeader blockForgings
93-
, updateForgeState = hardForkUpdateForgeState blockForgings
94-
, checkCanForge = hardForkCheckCanForge blockForgings
95-
, forgeBlock = hardForkForgeBlock blockForgings
96-
, finalize = hardForkFinalize blockForgings
97-
}
90+
pure
91+
BlockForging
92+
{ forgeLabel = labelF blockForgings
93+
, canBeLeader = hardForkCanBeLeader blockForgings
94+
, updateForgeState = hardForkUpdateForgeState blockForgings
95+
, checkCanForge = hardForkCheckCanForge blockForgings
96+
, forgeBlock = hardForkForgeBlock blockForgings
97+
, finalize = hardForkFinalize blockForgings
98+
}
9899

99100
hardForkCanBeLeader ::
100101
CanHardFork xs =>

0 commit comments

Comments
 (0)