Skip to content

Commit e2a7ea3

Browse files
committed
Update to node-8.12
Use textShow from Cardano.Prelude Native Script pattern and classes adjusted
1 parent 7d51a70 commit e2a7ea3

File tree

42 files changed

+156
-188
lines changed

Some content is hidden

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

42 files changed

+156
-188
lines changed

cabal.project

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

1212
index-state:
13-
, hackage.haskell.org 2024-03-26T06:28:59Z
14-
, cardano-haskell-packages 2024-05-14T16:00:00Z
13+
, hackage.haskell.org 2024-06-13T08:49:27Z
14+
, cardano-haskell-packages 2024-06-20T14:49:55Z
1515

1616
packages:
1717
cardano-db
@@ -79,8 +79,8 @@ allow-newer:
7979
source-repository-package
8080
type: git
8181
location: https://github.com/IntersectMBO/cardano-node
82-
tag: 4a18841e7df0d10edab98a612c80217ea49a5c11
83-
--sha256: sha256-T5kZqlzTnaain3rypUwhpmY3YcZoDtbSqEQADeucJH4=
82+
tag: ae8bc933ee6b6366c04854c1e127fd8dfb29b556
83+
--sha256: sha256-//1Tgd0ZFWMca2CDx/SPxencvTbn9/qd3bu/bqa98c0=
8484
subdir:
8585
cardano-node
8686
cardano-submit-api

cardano-chain-gen/src/Cardano/Mock/Forging/Interpreter.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import qualified Cardano.Mock.Forging.Tx.Babbage as Babbage
4343
import qualified Cardano.Mock.Forging.Tx.Conway as Conway
4444
import qualified Cardano.Mock.Forging.Tx.Shelley as Shelley
4545
import Cardano.Mock.Forging.Types
46-
import Cardano.Prelude (bimap, throwIO)
46+
import Cardano.Prelude (bimap, textShow, throwIO)
4747
import Control.Concurrent.Class.MonadSTM.Strict (
4848
StrictTVar,
4949
atomically,
@@ -60,7 +60,6 @@ import qualified Data.List as List
6060
import Data.Map.Strict (Map)
6161
import qualified Data.Map.Strict as Map
6262
import Data.SOP.Strict (NS (S, Z))
63-
import Data.Text (Text)
6463
import qualified Data.Text as Text
6564
import qualified Data.Text.IO as Text
6665
import Data.Word (Word64)
@@ -626,8 +625,5 @@ mkForecast ::
626625
Forecast (LedgerView (BlockProtocol CardanoBlock))
627626
mkForecast cfg st = ledgerViewForecastAt (configLedger cfg) (ledgerState st)
628627

629-
textShow :: Show a => a -> Text
630-
textShow = Text.pack . show
631-
632628
throwLeftIO :: Exception e => Either e a -> IO a
633629
throwLeftIO = either throwIO pure

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import Cardano.Mock.ChainSync.Server
5656
import Cardano.Mock.Forging.Interpreter
5757
import Cardano.Node.Protocol.Shelley (readLeaderCredentials)
5858
import Cardano.Node.Types (ProtocolFilepaths (..))
59-
import Cardano.Prelude (ReaderT, panic, stderr)
59+
import Cardano.Prelude (ReaderT, panic, stderr, textShow)
6060
import Cardano.SMASH.Server.PoolDataLayer
6161
import Control.Concurrent.Async (Async, async, cancel, poll)
6262
import Control.Concurrent.STM (atomically)
@@ -74,7 +74,6 @@ import Control.Monad.Logger (NoLoggingT, runNoLoggingT)
7474
import Control.Monad.Trans.Except.Extra (runExceptT)
7575
import Control.Tracer (nullTracer)
7676
import Data.Text (Text)
77-
import qualified Data.Text as Text
7877
import Database.Persist.Postgresql (createPostgresqlPool)
7978
import Database.Persist.Sql (SqlBackend)
8079
import Ouroboros.Consensus.Block.Forging
@@ -526,9 +525,6 @@ recreateDir path = do
526525
removePathForcibly path
527526
createDirectoryIfMissing True path
528527

529-
textShow :: (Show a) => a -> Text
530-
textShow = Text.pack . show
531-
532528
replaceConfigFile :: FilePath -> DBSyncEnv -> IO DBSyncEnv
533529
replaceConfigFile newFilename dbSync@DBSyncEnv {..} = do
534530
cfg <- readSyncNodeConfig $ mkConfigFile configDir newFilename

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module Cardano.DbSync (
2626

2727
import Cardano.BM.Trace (Trace, logError, logInfo, logWarning)
2828
import qualified Cardano.Crypto as Crypto
29-
import Cardano.Db (textShow)
3029
import qualified Cardano.Db as Db
3130
import Cardano.DbSync.Api
3231
import Cardano.DbSync.Api.Types (InsertOptions (..), RunMigration, SyncEnv (..), SyncOptions (..), envLedgerEnv)

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ logDbState env = do
368368
showTip tipInfo =
369369
mconcat
370370
[ "slot "
371-
, DB.textShow (unSlotNo $ bSlotNo tipInfo)
371+
, textShow (unSlotNo $ bSlotNo tipInfo)
372372
, ", block "
373-
, DB.textShow (unBlockNo $ bBlockNo tipInfo)
373+
, textShow (unBlockNo $ bBlockNo tipInfo)
374374
]
375375

376376
tracer :: Trace IO Text
@@ -490,19 +490,19 @@ mkSyncEnvFromConfig trce backend connectionString syncOptions genCfg syncNodeCon
490490
. SNErrCardanoConfig
491491
$ mconcat
492492
[ "ProtocolMagicId "
493-
, DB.textShow (unProtocolMagicId $ Byron.configProtocolMagicId bCfg)
493+
, textShow (unProtocolMagicId $ Byron.configProtocolMagicId bCfg)
494494
, " /= "
495-
, DB.textShow (Shelley.sgNetworkMagic $ scConfig sCfg)
495+
, textShow (Shelley.sgNetworkMagic $ scConfig sCfg)
496496
]
497497
| Byron.gdStartTime (Byron.configGenesisData bCfg) /= Shelley.sgSystemStart (scConfig sCfg) ->
498498
pure
499499
. Left
500500
. SNErrCardanoConfig
501501
$ mconcat
502502
[ "SystemStart "
503-
, DB.textShow (Byron.gdStartTime $ Byron.configGenesisData bCfg)
503+
, textShow (Byron.gdStartTime $ Byron.configGenesisData bCfg)
504504
, " /= "
505-
, DB.textShow (Shelley.sgSystemStart $ scConfig sCfg)
505+
, textShow (Shelley.sgSystemStart $ scConfig sCfg)
506506
]
507507
| otherwise ->
508508
Right

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Cardano.DbSync.Era.Util
1919
import Cardano.DbSync.Error
2020
import Cardano.DbSync.Ledger.State
2121
import Cardano.DbSync.Types
22+
import Cardano.Ledger.Allegra.Scripts (Timelock)
2223
import Cardano.Ledger.Alonzo.Scripts
2324
import Cardano.Ledger.Babbage.Core
2425
import Cardano.Ledger.Babbage.TxBody (BabbageTxOut)
@@ -28,7 +29,7 @@ import Cardano.Ledger.Mary.Value
2829
import Cardano.Ledger.Shelley.LedgerState
2930
import Cardano.Ledger.TxIn
3031
import Cardano.Ledger.UTxO (UTxO (..))
31-
import Cardano.Prelude (lift)
32+
import Cardano.Prelude (lift, textShow)
3233
import Control.Concurrent.Class.MonadSTM.Strict (atomically, readTVarIO, writeTVar)
3334
import Control.Monad.Extra
3435
import Control.Monad.IO.Class (MonadIO, liftIO)
@@ -75,7 +76,7 @@ migrateBootstrapUTxO syncEnv txCache = do
7576
when (count > 0) $
7677
liftIO $
7778
logWarning trce $
78-
"Found and deleted " <> DB.textShow count <> " tx_out."
79+
"Found and deleted " <> textShow count <> " tx_out."
7980
storeUTxOFromLedger syncEnv txCache cls
8081
lift $ DB.insertExtraMigration DB.BootstrapFinished
8182
liftIO $ logInfo trce "UTxO bootstrap migration done"
@@ -107,6 +108,7 @@ storeUTxO ::
107108
, MonadIO m
108109
, MonadBaseControl IO m
109110
, DBPlutusScript era
111+
, NativeScript era ~ Timelock era
110112
) =>
111113
SyncEnv ->
112114
TxCache ->
@@ -117,9 +119,9 @@ storeUTxO env txCache mp = do
117119
logInfo trce $
118120
mconcat
119121
[ "Inserting "
120-
, DB.textShow size
122+
, textShow size
121123
, " tx_out as pages of "
122-
, DB.textShow pageSize
124+
, textShow pageSize
123125
]
124126
mapM_ (storePage env txCache pagePerc) . zip [0 ..] . chunksOf pageSize . Map.toList $ mp
125127
where
@@ -135,6 +137,7 @@ storePage ::
135137
, TxOut era ~ BabbageTxOut era
136138
, DBPlutusScript era
137139
, BabbageEraTxOut era
140+
, NativeScript era ~ Timelock era
138141
, MonadIO m
139142
, MonadBaseControl IO m
140143
) =>
@@ -162,6 +165,7 @@ prepareTxOut ::
162165
, MonadIO m
163166
, MonadBaseControl IO m
164167
, DBPlutusScript era
168+
, NativeScript era ~ Timelock era
165169
) =>
166170
SyncEnv ->
167171
TxCache ->

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ queryPoolKeyOrInsert txt trce cache cacheUA logsWarning hsh = do
294294
logWarning trce $
295295
mconcat
296296
[ "Failed with "
297-
, DB.textShow err
297+
, textShow err
298298
, " while trying to find pool "
299-
, DB.textShow hsh
299+
, textShow hsh
300300
, " for "
301301
, txt
302302
, ". We will assume that the pool exists and move on."

cardano-db-sync/src/Cardano/DbSync/Cache/Types.hs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -112,56 +112,56 @@ textShowStats (ActiveCache ic) = do
112112
[ "\nCache Statistics:"
113113
, "\n Stake Addresses: "
114114
, "cache size: "
115-
, DB.textShow (LRU.getCapacity stakeHashRaws)
115+
, textShow (LRU.getCapacity stakeHashRaws)
116116
, if credsQueries stats == 0
117117
then ""
118-
else ", hit rate: " <> DB.textShow (100 * credsHits stats `div` credsQueries stats) <> "%"
118+
else ", hit rate: " <> textShow (100 * credsHits stats `div` credsQueries stats) <> "%"
119119
, ", hits: "
120-
, DB.textShow (credsHits stats)
120+
, textShow (credsHits stats)
121121
, ", misses: "
122-
, DB.textShow (credsQueries stats - credsHits stats)
122+
, textShow (credsQueries stats - credsHits stats)
123123
, "\n Pools: "
124124
, "cache size: "
125-
, DB.textShow (Map.size pools)
125+
, textShow (Map.size pools)
126126
, if poolsQueries stats == 0
127127
then ""
128-
else ", hit rate: " <> DB.textShow (100 * poolsHits stats `div` poolsQueries stats) <> "%"
128+
else ", hit rate: " <> textShow (100 * poolsHits stats `div` poolsQueries stats) <> "%"
129129
, ", hits: "
130-
, DB.textShow (poolsHits stats)
130+
, textShow (poolsHits stats)
131131
, ", misses: "
132-
, DB.textShow (poolsQueries stats - poolsHits stats)
132+
, textShow (poolsQueries stats - poolsHits stats)
133133
, "\n Datums: "
134134
, "cache capacity: "
135-
, DB.textShow (LRU.getCapacity datums)
135+
, textShow (LRU.getCapacity datums)
136136
, ", cache size: "
137-
, DB.textShow (LRU.getSize datums)
137+
, textShow (LRU.getSize datums)
138138
, if datumQueries stats == 0
139139
then ""
140-
else ", hit rate: " <> DB.textShow (100 * datumHits stats `div` datumQueries stats) <> "%"
140+
else ", hit rate: " <> textShow (100 * datumHits stats `div` datumQueries stats) <> "%"
141141
, ", hits: "
142-
, DB.textShow (datumHits stats)
142+
, textShow (datumHits stats)
143143
, ", misses: "
144-
, DB.textShow (datumQueries stats - datumHits stats)
144+
, textShow (datumQueries stats - datumHits stats)
145145
, "\n Multi Assets: "
146146
, "cache capacity: "
147-
, DB.textShow (LRU.getCapacity mAssets)
147+
, textShow (LRU.getCapacity mAssets)
148148
, ", cache size: "
149-
, DB.textShow (LRU.getSize mAssets)
149+
, textShow (LRU.getSize mAssets)
150150
, if multiAssetsQueries stats == 0
151151
then ""
152-
else ", hit rate: " <> DB.textShow (100 * multiAssetsHits stats `div` multiAssetsQueries stats) <> "%"
152+
else ", hit rate: " <> textShow (100 * multiAssetsHits stats `div` multiAssetsQueries stats) <> "%"
153153
, ", hits: "
154-
, DB.textShow (multiAssetsHits stats)
154+
, textShow (multiAssetsHits stats)
155155
, ", misses: "
156-
, DB.textShow (multiAssetsQueries stats - multiAssetsHits stats)
156+
, textShow (multiAssetsQueries stats - multiAssetsHits stats)
157157
, "\n Previous Block: "
158158
, if prevBlockQueries stats == 0
159159
then ""
160-
else "hit rate: " <> DB.textShow (100 * prevBlockHits stats `div` prevBlockQueries stats) <> "%"
160+
else "hit rate: " <> textShow (100 * prevBlockHits stats `div` prevBlockQueries stats) <> "%"
161161
, ", hits: "
162-
, DB.textShow (prevBlockHits stats)
162+
, textShow (prevBlockHits stats)
163163
, ", misses: "
164-
, DB.textShow (prevBlockQueries stats - prevBlockHits stats)
164+
, textShow (prevBlockQueries stats - prevBlockHits stats)
165165
]
166166

167167
useNoCache :: CacheStatus

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ module Cardano.DbSync.Config.Alonzo (
88
) where
99

1010
import qualified Cardano.Crypto.Hash as Crypto
11-
import Cardano.Db (textShow)
1211
import Cardano.DbSync.Config.Types
1312
import Cardano.DbSync.Error
1413
import Cardano.Ledger.Alonzo.Genesis
14+
import Cardano.Prelude (textShow)
1515
import Control.Monad.Trans.Except (ExceptT)
1616
import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT, hoistEither, left)
1717
import qualified Data.Aeson as Aeson

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ module Cardano.DbSync.Config.Shelley (
1010
) where
1111

1212
import qualified Cardano.Crypto.Hash as Crypto
13-
import Cardano.Db (textShow)
1413
import Cardano.DbSync.Config.Types
1514
import Cardano.DbSync.Error
15+
import Cardano.Prelude (textShow)
1616
import Control.Monad.Trans.Except (ExceptT)
1717
import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT, hoistEither, left)
1818
import qualified Data.Aeson as Aeson

0 commit comments

Comments
 (0)