Skip to content

Commit 9528017

Browse files
committed
workbench: resolve conflicts with 'master'
2 parents 1f5cc37 + d9ff0ef commit 9528017

File tree

119 files changed

+3370
-1041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3370
-1041
lines changed

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ trace-documentation:
4040
###
4141
### Workbench
4242
###
43-
CI_TARGETS := hlint workbench-ci-test haddock-hoogle
43+
workbench-ci: workbench-ci-test ci-test-auto ci-test-autonix ci-test-autonomad
44+
CI_TARGETS := hlint workbench-ci haddock-hoogle
4445
ci: ci-report ci-targets
4546
ci-report:
4647
@echo -e "\033[34mGoals under test\033[0m: \033[33m$(CI_TARGETS)\033[0m"
4748
ci-targets: $(CI_TARGETS)
4849

50+
workbench-internals-walkthrough:
51+
emn nix/workbench/doc.org
52+
4953
##
5054
## Base targets:
5155
##
@@ -71,7 +75,7 @@ ps: ## Plain-text list of profiles
7175
##
7276
PROFILES_BASE := default plutus plutus-secp-ecdsa plutus-secp-schnorr oldtracing idle tracer-only
7377
PROFILES_STARTSTOP := startstop startstop-p2p startstop-plutus startstop-notracer startstop-oldtracing
74-
PROFILES_CI_TEST := ci-test ci-test-p2p ci-test-plutus ci-test-notracer ci-test-dense10
78+
PROFILES_CI_TEST := ci-test ci-test-p2p ci-test-plutus ci-test-notracer ci-test-dense10 aws-test
7579
PROFILES_CI_BENCH := ci-bench ci-bench-p2p ci-bench-plutus ci-bench-plutus-secp-ecdsa ci-bench-plutus-secp-schnorr ci-bench-notracer
7680
PROFILES_PLUTUSCALL := plutuscall-loop-plain plutuscall-secp-ecdsa-plain plutuscall-secp-schnorr-plain
7781
PROFILES_PLUTUSCALL += plutuscall-loop-half plutuscall-secp-ecdsa-half plutuscall-secp-schnorr-half

bench/cardano-topology/cardano-topology.hs

+33-17
Original file line numberDiff line numberDiff line change
@@ -170,31 +170,37 @@ intraConnectRing withChords bidirectional specs =
170170

171171
main :: IO ()
172172
main = do
173-
(topoParams, topoJson, topoDot) <- execParser opts
173+
(topoParams, topoJson, topoDot, withExplorer) <- execParser opts
174174

175175
let topoSpec = mkTopology topoParams
176-
topo = mkNode <$> topoSpec
176+
cores = mkNode <$> topoSpec
177+
relays = [ mkExplorer (locationRegion EU) cores
178+
| withExplorer ]
177179

178-
writeTopo topo topoJson
180+
writeTopo cores relays topoJson
179181
maybe (pure ()) (writeDot topoSpec) topoDot
180182
where
181183
opts = info (cliParser <**> helper)
182184
( fullDesc
183185
<> progDesc "Cardano topology generator"
184186
<> header "make-topology - generate Cardano node topologies" )
185187

186-
cliParser :: Parser (TopoParams, FilePath, Maybe FilePath)
188+
cliParser :: Parser (TopoParams, FilePath, Maybe FilePath, Bool)
187189
cliParser =
188-
(,,) <$> subparser topoParamsParser
189-
<*> strOption
190-
( long "topology-output"
191-
<> help "Topology file to write"
192-
<> metavar "OUTFILE" )
193-
<*> optional
194-
(strOption
195-
( long "dot-output"
196-
<> help "Dot file to write"
197-
<> metavar "OUTFILE" ))
190+
(,,,)
191+
<$> subparser topoParamsParser
192+
<*> strOption
193+
( long "topology-output"
194+
<> help "Topology file to write"
195+
<> metavar "OUTFILE" )
196+
<*> optional
197+
(strOption
198+
( long "dot-output"
199+
<> help "Dot file to write"
200+
<> metavar "OUTFILE" ))
201+
<*> flag False True
202+
( long "with-explorer"
203+
<> help "Add an explorer to the topology")
198204

199205
topoParamsParser =
200206
command "torus"
@@ -255,10 +261,10 @@ main = do
255261

256262
--- * To JSON topology
257263
---
258-
writeTopo :: [Node] -> FilePath -> IO ()
259-
writeTopo topo f =
264+
writeTopo :: [Node] -> [Node] -> FilePath -> IO ()
265+
writeTopo cores relays f =
260266
IO.withFile f IO.WriteMode $ \hnd ->
261-
LBS.hPutStrLn hnd . encode $ Topology topo []
267+
LBS.hPutStrLn hnd . encode $ Topology cores relays
262268

263269
mkNode :: Spec -> Node
264270
mkNode Spec{..} = Node{..}
@@ -271,6 +277,16 @@ mkNode Spec{..} = Node{..}
271277
region = locationRegion loc
272278
producers = idName <$> links
273279

280+
mkExplorer :: String -> [Node] -> Node
281+
mkExplorer region cores = Node{ name = "explorer"
282+
, ..}
283+
where
284+
org = "IOHK"
285+
nodeId = length cores
286+
pools = Nothing
287+
stakePool = False
288+
producers = name <$> cores
289+
274290
data Topology = Topology
275291
{ coreNodes :: [Node]
276292
, relayNodes :: [Node]

bench/locli/src/Cardano/Analysis/API/Dictionary.hs

+15
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,22 @@ import Data.Map.Strict qualified as M
1212
import Cardano.Analysis.API.Field
1313
import Cardano.Analysis.API.Types
1414
import Cardano.Analysis.API.Metrics ()
15+
import Cardano.Util (showText)
1516

1617

1718
data DictEntry where
1819
DictEntry ::
1920
{ deField :: !Text
2021
, deShortDesc :: !Text
2122
, deDescription :: !Text
23+
, deLogScale :: !Text
24+
, deRange :: !Text
25+
, deUnit :: !Text
2226
} -> DictEntry
2327
deriving (Generic, FromJSON, ToJSON, Show)
2428

29+
data ChartArgs
30+
2531
data Dictionary where
2632
Dictionary ::
2733
{ dBlockProp :: !(Map Text DictEntry)
@@ -41,4 +47,13 @@ metricDictionary =
4147
{ deField = fId
4248
, deShortDesc = fShortDesc
4349
, deDescription = fDescription
50+
, deLogScale = case fScale of
51+
Log -> "true"
52+
Lin -> "false"
53+
, deRange = case fRange of
54+
Free -> ""
55+
Z0 x -> "0:" <> showText x
56+
Z1 x -> "0:" <> showText x
57+
R01 -> "0:1"
58+
, deUnit = renderUnit fUnit
4459
}

bench/locli/src/Cardano/Analysis/API/Field.hs

+16-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ data Unit
5656

5757
renderUnit :: Unit -> Text
5858
renderUnit = \case
59-
Sec -> "sec"
59+
Sec -> "s"
6060
Hz -> "Hz"
6161
B -> "B"
6262
KB -> "KB"
@@ -115,10 +115,21 @@ data Precision
115115
| P3
116116
deriving (Eq, Enum, Ord, Show)
117117

118-
{-# INLINE width #-}
119-
width :: Width -> Int
120-
width Wno = 80
121-
width x = fromEnum x
118+
{-# INLINE unWidth #-}
119+
unWidth :: Width -> Maybe Int
120+
unWidth Wno = Nothing
121+
unWidth x = Just $ fromEnum x
122+
123+
{-# INLINE unsafeUnWidth #-}
124+
unsafeUnWidth :: String -> Width -> Int
125+
unsafeUnWidth ctx Wno = error $ "Unexpected Wno (indeterminate width): " <> ctx
126+
unsafeUnWidth _ x = fromEnum x
127+
128+
{-# INLINE mapWidth #-}
129+
mapWidth :: a -> (Int -> a) -> Width -> a
130+
mapWidth wNo wSome = \case
131+
Wno -> wNo
132+
x -> wSome (fromEnum x)
122133

123134
-- | Encapsulate all metadata about a metric (a projection) of
124135
-- a certain projectible (a kind of analysis results):

0 commit comments

Comments
 (0)