Skip to content

Commit 08f48da

Browse files
committed
claude: prototype-2026w27 wip
1 parent d77e363 commit 08f48da

74 files changed

Lines changed: 10579 additions & 60 deletions

Some content is hidden

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

cabal.project

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ repository cardano-haskell-packages
1010
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee
1111

1212
index-state:
13-
, hackage.haskell.org 2026-03-26T20:21:33Z
14-
, cardano-haskell-packages 2026-05-02T16:21:41Z
15-
active-repositories:
16-
, :rest
17-
, cardano-haskell-packages:override
13+
, hackage.haskell.org 2026-06-29T22:49:53Z
14+
, cardano-haskell-packages 2026-06-29T12:05:19Z
15+
-- No cardano-haskell-packages:override here (cardano-node doesn't use it either):
16+
-- it would mask newer Hackage-only versions, e.g. cuddle >= 1.8 needed by the
17+
-- SRP cardano-ledger-binary while CHaP still tops out at cuddle 1.2.
1818

1919
packages:
2020
cardano-db
@@ -23,6 +23,11 @@ packages:
2323
cardano-db-tool
2424
cardano-smash-server
2525
cardano-chain-gen
26+
-- Vendored from input-output-hk/iohk-monitoring-framework (master @ 1c8a7704,
27+
-- i.e. iohk-monitoring 0.2.1.2) and ported to contra-tracer >= 0.2.1, which the
28+
-- leios-prototype network stack requires but upstream iohk-monitoring rejects.
29+
vendor/iohk-monitoring
30+
vendor/tracer-transformers
2631

2732
package cardano-chain-gen
2833
ghc-options: -Wall -Werror -Wredundant-constraints -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -Wunused-imports -Wunused-packages
@@ -105,9 +110,9 @@ if impl (ghc >= 9.12)
105110

106111
source-repository-package
107112
type: git
108-
location: https://github.com/input-output-hk/cardano-node
109-
tag: 16b6bae87f5afeead5ae8c15d4a93b36b5a5b142
110-
--sha256: 1p87vw47a14sm6k5p7ixda77p8yghmx95v3g02awqqf9d5df2wab
113+
location: https://github.com/IntersectMBO/cardano-node
114+
tag: 3cc6340a896eadee5cdbf2b256751d23dc267ba3
115+
--sha256: sha256-f6jw2opMNOu98UPzRJmSlDI4HkXBK25HjWaRgRG6WCE=
111116
subdir:
112117
cardano-node
113118
trace-forward
@@ -116,23 +121,37 @@ source-repository-package
116121
source-repository-package
117122
type: git
118123
location: https://github.com/IntersectMBO/ouroboros-consensus
119-
tag: eddb8b78de9e5f0d45dbf1410289f8e491c515ab
120-
--sha256: sha256-ypNFYzmf6RcdQIuVPh8dPYSQEPoVlLyU1OCnjPAP2cc=
124+
tag: 63d4d4e3c7ffb1911a63a65e7a84dc5132f82137
125+
--sha256: sha256-sTsafdrdo/WQ9a+nL/ed2kc5zKhTYW9HaJO7g260fBk=
121126

122127
source-repository-package
123128
type: git
124129
location: https://github.com/IntersectMBO/cardano-ledger
125-
tag: c47305fcf47bd77437b837d0dfb9cb4181bfbc77
126-
--sha256: 1db2xc2gs44g5035srqzgqkbv3a2yacmvnwchd1jnjrfkibnxnak
130+
tag: 9edd1c664054803348e5f9edfa13529e4e844284
131+
--sha256: sha256-TkgeO5d1p18VwTMtuNY8SsPZXXyn1HIrZBZ4IHVTWuE=
127132
subdir:
133+
libs/cardano-data
134+
libs/cardano-ledger-api
135+
libs/small-steps
136+
libs/cardano-ledger-binary
128137
libs/cardano-ledger-core
138+
libs/cardano-protocol-tpraos
139+
eras/shelley/impl
140+
eras/shelley/test-suite
141+
eras/shelley-ma/test-suite
142+
eras/mary/impl
143+
eras/allegra/impl
144+
eras/alonzo/impl
145+
eras/alonzo/test-suite
146+
eras/babbage/impl
147+
eras/conway/impl
129148
eras/dijkstra/impl
130149

131150
source-repository-package
132151
type: git
133152
location: https://github.com/IntersectMBO/ouroboros-network
134-
tag: ff3e39af5aa51d4d89c23c72d67716fd9bfcc516
135-
--sha256: 00havv7igm3pjkw954mmz2s8wh4ki6pk9d2rnn1srx135xb3zp0a
153+
tag: 4b3ab7664f609a1aee0f0c24dcfcfd0ab899fc42
154+
--sha256: sha256-fIqpI2whstetodpiONmUDVgnhTpzXeq1/gmzuHItK5A=
136155
subdir:
137156
ouroboros-network
138157
cardano-diffusion
@@ -141,37 +160,37 @@ source-repository-package
141160
source-repository-package
142161
type: git
143162
location: https://github.com/IntersectMBO/cardano-api
144-
tag: 38add439ea702046e0633eae8cf828b3c1215162
145-
--sha256: 1pn41ggm06bzbrs9cyab6by92j43gyx7644p6l0kfhljdqszx26s
163+
tag: 28e2f4f085eceee4cb63c3eb9103a80e3852ce7a
164+
--sha256: sha256-9Wugp6Cd+ERSc8kfIUDFbq3QjuhIr1gu6rRSV3Yo/9M=
146165
subdir:
147166
cardano-api
148167
cardano-api-gen
168+
cardano-rpc
149169

150170
source-repository-package
151171
type: git
152172
location: https://github.com/IntersectMBO/cardano-cli
153-
tag: 4f0907405ad4faa9323f2ee543ea404a8a57421d
154-
--sha256: sha256-wxCFJ7KNgBMtUMa21MQjC1+KiPLoV0Sbz9GOPWZ2mtc=
173+
tag: 97a1258f9654478dff6c7e7497fcc693213b1a36
174+
--sha256: sha256-e2mxwfy2pN3itQIx0+1j2XV7JTNKckIpfzaN6rOtZn0=
155175
subdir:
156176
cardano-cli
157177

158-
if impl(ghc >= 9.12)
159-
-- GHC 9.12 support - master branch
160-
source-repository-package
161-
type: git
162-
location: https://github.com/google/proto-lens
163-
tag: 13ce67409ad87e8c29eea58b31aa37f44e82457c
164-
--sha256: sha256-8XPGLheOo5ZStL7YD5x29GechWFjubw+in5GsUrKWPc=
165-
subdir:
166-
discrimination-ieee754
167-
proto-lens-arbitrary
168-
proto-lens-benchmarks
169-
proto-lens-discrimination
170-
proto-lens-optparse
171-
proto-lens-protobuf-types
172-
proto-lens-protoc
173-
proto-lens-runtime
174-
proto-lens-setup
175-
proto-lens-tests-dep
176-
proto-lens-tests
177-
proto-lens
178+
source-repository-package
179+
type: git
180+
location: https://github.com/f-f/kes-agent.git
181+
tag: 32c1ed675d22a30735d9f22f7afa436a3ef3e64a
182+
--sha256: sha256-o7hFX1JnraS6Xq0WoXQwd9Z8GsPPv0Ls2DWvZ08o0ZU=
183+
subdir:
184+
kes-agent
185+
kes-agent-crypto
186+
187+
source-repository-package
188+
type: git
189+
location: https://github.com/f-f/ekg-forward
190+
tag: b24b3aba2806ce223c62f8ce3e267ec92dcc52e2
191+
--sha256: sha256-s5Hxxm04HmFVmdBjAnFEsJEhTqr5Z/uiB4K1s2VaVwE=
192+
193+
-- The former ghc >= 9.12 proto-lens source-repository-package was removed:
194+
-- haskell.nix picks up SRP stanzas regardless of the surrounding `if impl`
195+
-- guard, and its proto-lens 0.7.1.6 conflicts with cardano-rpc's
196+
-- proto-lens >= 0.7.1.7 requirement.

cardano-chain-gen/test/Test/Cardano/Db/Mock/Config.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ withConfig :: FilePath -> FilePath -> CommandLineArgs -> SyncNodeConfig -> (Conf
262262
withConfig staticDir mutableDir cmdLineArgs config action = do
263263
let cfgDir = mkConfigDir staticDir
264264
genCfg <- runOrThrowIO $ runExceptT (readCardanoGenesisConfig config)
265-
let (pInfoDbSync, _) = mkProtocolInfoCardano genCfg []
265+
(pInfoDbSync, _) <- mkProtocolInfoCardano genCfg []
266266
cryptoInit
267267
creds <- mkShelleyCredentials $ cfgDir </> "pools" </> "bulk1.creds"
268-
let (pInfoForger, mkForgings) = mkProtocolInfoCardano genCfg creds
268+
(pInfoForger, mkForgings) <- mkProtocolInfoCardano genCfg creds
269269
bracket
270270
(allocateRes mkForgings)
271271
(mapM finalize)

cardano-db-sync/cardano-db-sync.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ library
202202
, network
203203
, lifted-base
204204
, memory
205+
, mempack
205206
, microlens
206207
, network-mux
207208
, ouroboros-consensus

cardano-db-sync/src/Cardano/DbSync/Api.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,15 @@ mkSyncEnvFromConfig metricsSetters trce dbEnv syncOptions genCfg syncNodeConfigF
444444
, " /= "
445445
, textShow (Shelley.sgSystemStart $ scConfig sCfg)
446446
]
447-
| otherwise ->
447+
| otherwise -> do
448+
pInfo <- fst <$> mkProtocolInfoCardano genCfg []
448449
Right
449450
<$> mkSyncEnv
450451
metricsSetters
451452
trce
452453
dbEnv
453454
syncOptions
454-
(fst $ mkProtocolInfoCardano genCfg [])
455+
pInfo
455456
(Shelley.sgNetworkId $ scConfig sCfg)
456457
(Shelley.sgMaxLovelaceSupply $ scConfig sCfg)
457458
(NetworkMagic . unProtocolMagicId $ Byron.configProtocolMagicId bCfg)

cardano-db-sync/src/Cardano/DbSync/Config/Cardano.hs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ import Ouroboros.Consensus.Config (TopLevelConfig (..), emptyCheckpointsMap)
4141
import Ouroboros.Consensus.Node.ProtocolInfo (ProtocolInfo)
4242
import qualified Ouroboros.Consensus.Node.ProtocolInfo as Consensus
4343
import Ouroboros.Consensus.Shelley.Node (ShelleyGenesis (..))
44+
import System.FS.API (SomeHasFS (..))
45+
import System.FS.API.Types (MountPoint (MountPoint))
46+
import System.FS.IO (ioHasFS)
47+
import System.FilePath (takeDirectory)
4448

4549
-- Usually only one constructor, but may have two when we are preparing for a HFC event.
4650
data GenesisConfig
@@ -73,8 +77,8 @@ readCardanoGenesisConfig enc =
7377

7478
-- -------------------------------------------------------------------------------------------------
7579

76-
mkTopLevelConfig :: GenesisConfig -> TopLevelConfig CardanoBlock
77-
mkTopLevelConfig cfg = Consensus.pInfoConfig $ fst $ mkProtocolInfoCardano cfg []
80+
mkTopLevelConfig :: GenesisConfig -> IO (TopLevelConfig CardanoBlock)
81+
mkTopLevelConfig cfg = Consensus.pInfoConfig . fst <$> mkProtocolInfoCardano cfg []
7882

7983
-- Need a concrete type for 'm' ('IO') to make the type checker happy.
8084

@@ -85,10 +89,11 @@ mkTopLevelConfig cfg = Consensus.pInfoConfig $ fst $ mkProtocolInfoCardano cfg [
8589
mkProtocolInfoCardano ::
8690
GenesisConfig ->
8791
[Consensus.ShelleyLeaderCredentials StandardCrypto] -> -- this is not empty only in tests
88-
(ProtocolInfo CardanoBlock, IO [MkBlockForging IO CardanoBlock])
92+
IO (ProtocolInfo CardanoBlock, IO [MkBlockForging IO CardanoBlock])
8993
mkProtocolInfoCardano genesisConfig shelleyCred =
90-
second (\f -> f nullTracer) $
91-
protocolInfoCardano $
94+
second (\f -> f nullTracer)
95+
<$> protocolInfoCardano
96+
shelleyGenesisFS
9297
CardanoProtocolParams
9398
{ byronProtocolParams =
9499
Consensus.ProtocolParamsByron
@@ -130,6 +135,14 @@ mkProtocolInfoCardano genesisConfig shelleyCred =
130135
alonzoGenesis
131136
conwayGenesis = genesisConfig
132137

138+
-- Mirrors cardano-node: the consensus layer uses this filesystem (rooted at
139+
-- the directory holding the Shelley genesis) to resolve ledger InjectionData
140+
-- referenced from sgExtraConfig when building the initial ledger state.
141+
shelleyGenesisFS :: SomeHasFS IO
142+
shelleyGenesisFS =
143+
SomeHasFS . ioHasFS . MountPoint . takeDirectory . unGenesisFile $
144+
dncShelleyGenesisFile dnc
145+
133146
shelleyPraosNonce :: GenesisHashShelley -> Nonce
134147
shelleyPraosNonce hsh = Nonce (Crypto.castHash . unGenesisHashShelley $ hsh)
135148

cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Generic/Metadata.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ import qualified Data.Aeson as Aeson
2727
import qualified Data.Aeson.Key as Aeson
2828
import qualified Data.Aeson.Text as Aeson.Text
2929
import qualified Data.ByteString.Base16 as Base16
30+
import qualified Data.ByteString.Short as SBS
3031
import qualified Data.Map.Strict as Map
3132
import qualified Data.Text as Text
3233
import qualified Data.Text.Encoding as Text
3334
import qualified Data.Text.Lazy as Text.Lazy
35+
import Data.MemPack.Buffer (byteArrayToShortByteString)
3436
import Data.Tuple.Extra (both)
3537
import qualified Data.Vector as Vector
3638
import Ouroboros.Consensus.Cardano.Block (AllegraEra, MaryEra, ShelleyEra)
@@ -101,7 +103,7 @@ bytesPrefix = "0x"
101103
fromMetadatum :: Shelley.Metadatum -> TxMetadataValue
102104
fromMetadatum = \case
103105
Shelley.I x -> TxMetaNumber x
104-
Shelley.B x -> TxMetaBytes x
106+
Shelley.B x -> TxMetaBytes (SBS.fromShort (byteArrayToShortByteString x))
105107
Shelley.S x -> TxMetaText x
106108
Shelley.List xs -> TxMetaList $ map fromMetadatum xs
107109
Shelley.Map xs -> TxMetaMap $ map (both fromMetadatum) xs

cardano-db-sync/src/Cardano/DbSync/Tracing/ToObjectOrphans.hs

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,81 @@
1+
{-# LANGUAGE FlexibleContexts #-}
12
{-# LANGUAGE FlexibleInstances #-}
23
{-# LANGUAGE MultiParamTypeClasses #-}
34
{-# LANGUAGE OverloadedStrings #-}
5+
{-# LANGUAGE UndecidableInstances #-}
46
{-# OPTIONS_GHC -fno-warn-orphans #-}
57

68
module Cardano.DbSync.Tracing.ToObjectOrphans () where
79

810
import Cardano.BM.Data.Severity (Severity (..))
911
import Cardano.BM.Data.Tracer
1012
import Cardano.Client.Subscription (SubscriptionTrace (..))
11-
import Cardano.Tracing.OrphanInstances.Network ()
1213
import Data.Aeson ((.=))
1314
import Data.Text (Text)
1415
import qualified Data.Text as Text
16+
import qualified Network.Mux as Mux
17+
import Network.TypedProtocol.Codec (AnyMessage)
1518
import Ouroboros.Consensus.Byron.Ledger.Block (ByronBlock)
1619
import Ouroboros.Network.Block (Point (..), Tip (..))
1720
import Ouroboros.Network.Driver (TraceSendRecv (..))
1821
import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync)
1922

23+
-- The instances for 'TraceSendRecv' and 'Mux.WithBearer' used to come from
24+
-- cardano-node's Cardano.Tracing.OrphanInstances.Network, which was removed
25+
-- along with the rest of the legacy tracing system, so they are defined
26+
-- locally here instead.
27+
28+
instance HasPrivacyAnnotation (TraceSendRecv a)
29+
instance HasSeverityAnnotation (TraceSendRecv a) where
30+
getSeverityAnnotation _ = Debug
31+
32+
instance Show (AnyMessage ps) => ToObject (TraceSendRecv ps) where
33+
toObject _verb (TraceSendMsg msg) =
34+
mconcat
35+
[ "kind" .= ("Send" :: String)
36+
, "msg" .= show msg
37+
]
38+
toObject _verb (TraceRecvMsg msg) =
39+
mconcat
40+
[ "kind" .= ("Recv" :: String)
41+
, "msg" .= show msg
42+
]
43+
2044
instance HasTextFormatter (TraceSendRecv (ChainSync blk (Point blk) (Tip blk))) where
2145
formatText _ = Text.pack . show
2246

47+
instance
48+
Show (AnyMessage (ChainSync blk (Point blk) (Tip blk))) =>
49+
Transformable Text IO (TraceSendRecv (ChainSync blk (Point blk) (Tip blk)))
50+
where
51+
trTransformer = trStructuredText
52+
53+
instance HasPrivacyAnnotation (Mux.WithBearer peer a)
54+
instance HasSeverityAnnotation (Mux.WithBearer peer a) where
55+
getSeverityAnnotation _ = Debug
56+
57+
instance (Show peer, Show a) => ToObject (Mux.WithBearer peer a) where
58+
toObject _verb (Mux.WithBearer peer ev) =
59+
mconcat
60+
[ "kind" .= ("WithBearer" :: String)
61+
, "bearer" .= show peer
62+
, "event" .= show ev
63+
]
64+
65+
instance (Show peer, Show a) => HasTextFormatter (Mux.WithBearer peer a) where
66+
formatText (Mux.WithBearer peer ev) _o =
67+
"Bearer on " <> Text.pack (show peer) <> " event: " <> Text.pack (show ev)
68+
69+
instance (Show peer, Show a) => Transformable Text IO (Mux.WithBearer peer a) where
70+
trTransformer = trStructuredText
71+
2372
instance ToObject ByronBlock where
2473
toObject _verb msg =
2574
mconcat
2675
[ "kind" .= ("ByronBlock" :: String)
2776
, "event" .= show msg
2877
]
2978

30-
instance Transformable Text IO (TraceSendRecv (ChainSync blk (Point blk) (Tip blk))) where
31-
trTransformer = trStructuredText
32-
3379
instance HasPrivacyAnnotation (SubscriptionTrace a)
3480
instance HasSeverityAnnotation (SubscriptionTrace a) where
3581
getSeverityAnnotation (SubscriptionResult _) = Info

cardano-db-sync/src/Cardano/DbSync/Util/Cbor.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ import Cardano.Ledger.Binary.Encoding (serialize')
99
import Cardano.Ledger.Binary.Version (shelleyProtVer)
1010
import Cardano.Ledger.Shelley.TxAuxData (Metadatum (..))
1111
import Cardano.Prelude
12+
import qualified Data.ByteString.Short as SBS
13+
import Data.MemPack.Buffer (byteArrayFromShortByteString, byteArrayToShortByteString)
1214
import Prelude ()
1315

1416
serialiseTxMetadataToCbor :: Map Word64 TxMetadataValue -> ByteString
1517
serialiseTxMetadataToCbor = serialize' shelleyProtVer . map toShelleyMetadatum
1618
where
1719
toShelleyMetadatum :: TxMetadataValue -> Metadatum
1820
toShelleyMetadatum (TxMetaNumber n) = I n
19-
toShelleyMetadatum (TxMetaBytes b) = B b
21+
toShelleyMetadatum (TxMetaBytes b) = B (byteArrayFromShortByteString (SBS.toShort b))
2022
toShelleyMetadatum (TxMetaText s) = S s
2123
toShelleyMetadatum (TxMetaList xs) = List $ map toShelleyMetadatum xs
2224
toShelleyMetadatum (TxMetaMap ms) =
@@ -29,7 +31,7 @@ deserialiseTxMetadataFromCbor =
2931
where
3032
fromShelleyMetadatum :: Metadatum -> TxMetadataValue
3133
fromShelleyMetadatum (I n) = TxMetaNumber n
32-
fromShelleyMetadatum (B b) = TxMetaBytes b
34+
fromShelleyMetadatum (B b) = TxMetaBytes (SBS.fromShort (byteArrayToShortByteString b))
3335
fromShelleyMetadatum (S s) = TxMetaText s
3436
fromShelleyMetadatum (List xs) = TxMetaList $ map fromShelleyMetadatum xs
3537
fromShelleyMetadatum (Map ms) =

0 commit comments

Comments
 (0)