Skip to content

Commit e1a3f4b

Browse files
authored
Merge pull request #5566 from input-output-hk/jordan/bump-chap-20231207
Bump CHaP
2 parents 3aa3c17 + 7ccdce6 commit e1a3f4b

File tree

16 files changed

+55
-65
lines changed

16 files changed

+55
-65
lines changed

bench/plutus-scripts-bench/plutus-scripts-bench.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ library
7373
-- IOG dependencies
7474
--------------------------
7575
build-depends:
76-
, cardano-api ^>= 8.35
76+
, cardano-api ^>= 8.36.0.1
7777
, plutus-ledger-api >=1.0.0
7878
, plutus-tx >=1.0.0
7979
, plutus-tx-plugin >=1.0.0

bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SizedMetadata.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ measureBSCosts era = map (metadataSize era . Just . bsMetadata) [0..maxBSSize]
108108
metadataSize :: forall era . IsShelleyBasedEra era => AsType era -> Maybe TxMetadata -> Int
109109
metadataSize p m = dummyTxSize p m - dummyTxSize p Nothing
110110

111-
dummyTxSizeInEra :: forall era . IsShelleyBasedEra era => TxMetadataInEra era -> Int
112-
dummyTxSizeInEra metadata = case createAndValidateTransactionBody (shelleyBasedEra @era) dummyTx of
111+
dummyTxSizeInEra :: IsShelleyBasedEra era => TxMetadataInEra era -> Int
112+
dummyTxSizeInEra metadata = case createAndValidateTransactionBody shelleyBasedEra dummyTx of
113113
Right b -> BS.length $ serialiseToCBOR b
114114
Left err -> error $ "metaDataSize " ++ show err
115115
where
116-
dummyTx :: TxBodyContent BuildTx era
117-
dummyTx = defaultTxBodyContent (cardanoEra @era)
116+
dummyTx = defaultTxBodyContent shelleyBasedEra
118117
& setTxIns
119118
[ ( TxIn "dbaff4e270cfb55612d9e2ac4658a27c79da4a5271c6f90853042d1403733810" (TxIx 0)
120119
, BuildTxWith $ KeyWitness KeyWitnessForSpending

bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{-# LANGUAGE ConstraintKinds #-}
21
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE ConstraintKinds #-}
33
{-# LANGUAGE DataKinds #-}
44
{-# LANGUAGE FlexibleContexts #-}
55
{-# LANGUAGE FlexibleInstances #-}
@@ -25,8 +25,8 @@ module Cardano.Benchmarking.GeneratorTx.SubmissionClient
2525
, txSubmissionClient
2626
) where
2727

28-
import Prelude (error,fail)
2928
import Cardano.Prelude hiding (ByteString, atomically, retry, state, threadDelay)
29+
import Prelude (error, fail)
3030

3131
import Control.Arrow ((&&&))
3232

@@ -44,17 +44,16 @@ import Cardano.Tracing.OrphanInstances.Shelley ()
4444
import qualified Ouroboros.Consensus.Cardano as Consensus (CardanoBlock)
4545
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, GenTxId, txInBlockSize)
4646
import qualified Ouroboros.Consensus.Ledger.SupportsMempool as Mempool
47-
import qualified Ouroboros.Consensus.Shelley.Ledger.Mempool as Mempool (TxId(ShelleyTxId))
4847
import Ouroboros.Consensus.Shelley.Eras (StandardCrypto)
48+
import qualified Ouroboros.Consensus.Shelley.Ledger.Mempool as Mempool (TxId (ShelleyTxId))
4949

50-
import qualified Ouroboros.Consensus.Cardano.Block as Block (TxId(GenTxIdShelley, GenTxIdAllegra, GenTxIdAlonzo, GenTxIdMary,GenTxIdBabbage, GenTxIdConway))
50+
import qualified Ouroboros.Consensus.Cardano.Block as Block
51+
(TxId (GenTxIdAllegra, GenTxIdAlonzo, GenTxIdBabbage, GenTxIdConway, GenTxIdMary, GenTxIdShelley))
5152

5253
import Ouroboros.Network.Protocol.TxSubmission2.Client (ClientStIdle (..),
53-
ClientStTxIds (..),
54-
ClientStTxs (..),
55-
TxSubmissionClient (..))
54+
ClientStTxIds (..), ClientStTxs (..), TxSubmissionClient (..))
5655
import Ouroboros.Network.Protocol.TxSubmission2.Type (BlockingReplyList (..),
57-
TokBlockingStyle (..), TxSizeInBytes)
56+
TokBlockingStyle (..), TxSizeInBytes)
5857

5958
import Cardano.Api hiding (Active)
6059
import Cardano.Api.Shelley (fromShelleyTxId, toConsensusGenTx)
@@ -187,13 +186,8 @@ txSubmissionClient tr bmtr initialTxSource endOfProtocolCallback =
187186
txToIdSize = (Mempool.txId &&& txInBlockSize) . toGenTx
188187

189188
toGenTx :: tx -> GenTx CardanoBlock
190-
toGenTx tx = case shelleyBasedEra @era of
191-
ShelleyBasedEraShelley -> toConsensusGenTx $ TxInMode ShelleyEra tx
192-
ShelleyBasedEraAllegra -> toConsensusGenTx $ TxInMode AllegraEra tx
193-
ShelleyBasedEraMary -> toConsensusGenTx $ TxInMode MaryEra tx
194-
ShelleyBasedEraAlonzo -> toConsensusGenTx $ TxInMode AlonzoEra tx
195-
ShelleyBasedEraBabbage -> toConsensusGenTx $ TxInMode BabbageEra tx
196-
ShelleyBasedEraConway -> toConsensusGenTx $ TxInMode ConwayEra tx
189+
toGenTx tx = toConsensusGenTx $ TxInMode (shelleyBasedEra @era) tx
190+
197191

198192
fromGenTxId :: GenTxId CardanoBlock -> TxId
199193
fromGenTxId (Block.GenTxIdShelley (Mempool.ShelleyTxId i)) = fromShelleyTxId i

bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ benchmarkTxStream txStream targetNodes threadName tps txCount era = do
288288
Left err -> liftTxGenError err
289289
Right ctl -> setEnvThreads threadName ctl
290290

291-
evalGenerator :: forall era. IsShelleyBasedEra era => Generator -> TxGenTxParams -> AsType era -> ActionM (TxStream IO era)
291+
evalGenerator :: IsShelleyBasedEra era => Generator -> TxGenTxParams -> AsType era -> ActionM (TxStream IO era)
292292
evalGenerator generator txParams@TxGenTxParams{txParamFee = fee} era = do
293293
networkId <- getEnvNetworkId
294294
protocolParameters <- getProtocolParameters
295-
case convertToLedgerProtocolParameters (shelleyBasedEra @era) protocolParameters of
295+
case convertToLedgerProtocolParameters shelleyBasedEra protocolParameters of
296296
Left err -> throwE (Env.TxGenError (ApiError err))
297297
Right ledgerParameters ->
298298
case generator of
@@ -323,7 +323,7 @@ evalGenerator generator txParams@TxGenTxParams{txParamFee = fee} era = do
323323
let
324324
fundSource = walletSource wallet 1
325325
inToOut = Utils.includeChange fee coins
326-
txGenerator = genTx (cardanoEra @era) ledgerParameters (TxInsCollateralNone, []) feeInEra TxMetadataNone
326+
txGenerator = genTx shelleyBasedEra ledgerParameters (TxInsCollateralNone, []) feeInEra TxMetadataNone
327327
sourceToStore = sourceToStoreTransactionNew txGenerator fundSource inToOut $ mangleWithChange toUTxOChange toUTxO
328328
return $ Streaming.effect (Streaming.yield <$> sourceToStore)
329329

@@ -339,7 +339,7 @@ evalGenerator generator txParams@TxGenTxParams{txParamFee = fee} era = do
339339
let
340340
fundSource = walletSource wallet 1
341341
inToOut = Utils.inputsToOutputsWithFee fee count
342-
txGenerator = genTx (cardanoEra @era) ledgerParameters (TxInsCollateralNone, []) feeInEra TxMetadataNone
342+
txGenerator = genTx shelleyBasedEra ledgerParameters (TxInsCollateralNone, []) feeInEra TxMetadataNone
343343
sourceToStore = sourceToStoreTransactionNew txGenerator fundSource inToOut (mangle $ repeat toUTxO)
344344
return $ Streaming.effect (Streaming.yield <$> sourceToStore)
345345

@@ -351,7 +351,7 @@ evalGenerator generator txParams@TxGenTxParams{txParamFee = fee} era = do
351351
let
352352
fundSource = walletSource wallet inputs
353353
inToOut = Utils.inputsToOutputsWithFee fee outputs
354-
txGenerator = genTx (cardanoEra @era) ledgerParameters collaterals feeInEra (toMetadata metadataSize)
354+
txGenerator = genTx shelleyBasedEra ledgerParameters collaterals feeInEra (toMetadata metadataSize)
355355
sourceToStore = sourceToStoreTransactionNew txGenerator fundSource inToOut (mangle $ repeat toUTxO)
356356

357357
fundPreview <- liftIO $ walletPreview wallet inputs

bench/tx-generator/src/Cardano/TxGenerator/Genesis.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ mkGenesisTransaction key ttl fee txins txouts
126126
(\b -> signShelleyTransaction (shelleyBasedEra @era) b [WitnessGenesisUTxOKey key])
127127
(createAndValidateTransactionBody (shelleyBasedEra @era) txBodyContent)
128128
where
129-
txBodyContent = defaultTxBodyContent (cardanoEra @era)
129+
txBodyContent = defaultTxBodyContent shelleyBasedEra
130130
& setTxIns (zip txins $ repeat $ BuildTxWith $ KeyWitness KeyWitnessForSpending)
131131
& setTxOuts txouts
132132
& setTxFee (mkTxFee fee)

bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ generateTx TxEnvironment{..}
106106
generator =
107107
case convertToLedgerProtocolParameters shelleyBasedEra txEnvProtocolParams of
108108
Right ledgerParameters ->
109-
genTx BabbageEra ledgerParameters collateralFunds txEnvFee txEnvMetadata
109+
genTx ShelleyBasedEraBabbage ledgerParameters collateralFunds txEnvFee txEnvMetadata
110110
Left err -> \_ _ -> Left (ApiError err)
111111
where
112112
-- collateralFunds are needed for Plutus transactions
@@ -157,7 +157,7 @@ generateTxPure TxEnvironment{..} inQueue
157157
generator =
158158
case convertToLedgerProtocolParameters shelleyBasedEra txEnvProtocolParams of
159159
Right ledgerParameters ->
160-
genTx BabbageEra ledgerParameters collateralFunds txEnvFee txEnvMetadata
160+
genTx ShelleyBasedEraBabbage ledgerParameters collateralFunds txEnvFee txEnvMetadata
161161
Left err -> \_ _ -> Left (ApiError err)
162162
where
163163
-- collateralFunds are needed for Plutus transactions

bench/tx-generator/src/Cardano/TxGenerator/Tx.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,26 +159,26 @@ sourceTransactionPreview txGenerator inputFunds valueSplitter toStore =
159159
-- for a function type -- of two arguments.
160160
genTx :: forall era. ()
161161
=> IsShelleyBasedEra era
162-
=> CardanoEra era
162+
=> ShelleyBasedEra era
163163
-> LedgerProtocolParameters era
164164
-> (TxInsCollateral era, [Fund])
165165
-> TxFee era
166166
-> TxMetadataInEra era
167167
-> TxGenerator era
168-
genTx _era ledgerParameters (collateral, collFunds) fee metadata inFunds outputs
168+
genTx sbe ledgerParameters (collateral, collFunds) fee metadata inFunds outputs
169169
= bimap
170170
ApiError
171171
(\b -> (signShelleyTransaction (shelleyBasedEra @era) b $ map WitnessPaymentKey allKeys, getTxId b))
172172
(createAndValidateTransactionBody (shelleyBasedEra @era) txBodyContent)
173173
where
174174
allKeys = mapMaybe getFundKey $ inFunds ++ collFunds
175-
txBodyContent = defaultTxBodyContent (cardanoEra @era)
175+
txBodyContent = defaultTxBodyContent sbe
176176
& setTxIns (map (\f -> (getFundTxIn f, BuildTxWith $ getFundWitness f)) inFunds)
177177
& setTxInsCollateral collateral
178178
& setTxOuts outputs
179179
& setTxFee fee
180180
& setTxValidityLowerBound TxValidityNoLowerBound
181-
& setTxValidityUpperBound (defaultTxValidityUpperBound (cardanoEra @era))
181+
& setTxValidityUpperBound (defaultTxValidityUpperBound sbe)
182182
& setTxMetadata metadata
183183
& setTxProtocolParams (BuildTxWith (Just ledgerParameters))
184184

bench/tx-generator/src/Cardano/TxGenerator/Utils.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ includeChange fee spend have = case compare changeValue 0 of
6565

6666
-- | `mkTxFee` reinterprets the `Either` returned by
6767
-- `txFeesExplicitInEra` with `TxFee` constructors.
68-
mkTxFee :: forall era. IsCardanoEra era => Lovelace -> TxFee era
69-
mkTxFee f = caseByronOrShelleyBasedEra
70-
TxFeeImplicit
71-
(`TxFeeExplicit` f)
72-
(cardanoEra @era)
68+
mkTxFee :: IsShelleyBasedEra era => Lovelace -> TxFee era
69+
mkTxFee = TxFeeExplicit shelleyBasedEra
7370

7471
-- | `mkTxValidityUpperBound` rules out needing the
7572
-- `TxValidityNoUpperBound` with the constraint of `IsShelleyBasedEra`.
@@ -79,5 +76,5 @@ mkTxValidityUpperBound slotNo =
7976

8077
-- | `mkTxInModeCardano` never uses the `TxInByronSpecial` constructor
8178
-- because its type enforces it being a Shelley-based era.
82-
mkTxInModeCardano :: forall era . IsCardanoEra era => Tx era -> TxInMode
83-
mkTxInModeCardano = TxInMode cardanoEra
79+
mkTxInModeCardano :: IsShelleyBasedEra era => Tx era -> TxInMode
80+
mkTxInModeCardano = TxInMode shelleyBasedEra

bench/tx-generator/tx-generator.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ library
9898
, attoparsec-aeson
9999
, base16-bytestring
100100
, bytestring
101-
, cardano-api ^>= 8.35
101+
, cardano-api ^>= 8.36.0.1
102102
, cardano-binary
103-
, cardano-cli ^>= 8.16.0.1
103+
, cardano-cli ^>= 8.17.0.0
104104
, cardano-crypto-class
105105
, cardano-crypto-wrapper
106106
, cardano-data

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repository cardano-haskell-packages
1414
-- you need to run if you change them
1515
index-state:
1616
, hackage.haskell.org 2023-11-20T23:52:53Z
17-
, cardano-haskell-packages 2023-11-30T13:34:52Z
17+
, cardano-haskell-packages 2023-12-06T19:40:56Z
1818

1919
packages:
2020
cardano-git-rev

0 commit comments

Comments
 (0)