Skip to content

Commit 615800f

Browse files
authored
Merge pull request #6131 from IntersectMBO/fmaste/remove-protocol-parameters
wb | port ProtocolParameters
2 parents 238b4c8 + 4a836e1 commit 615800f

File tree

10 files changed

+681
-17
lines changed

10 files changed

+681
-17
lines changed

bench/tx-generator/src/Cardano/Api/Internal/ProtocolParameters.hs

Lines changed: 657 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import qualified Data.Attoparsec.ByteString as Atto
2222
import qualified Data.Yaml as Yaml (encode)
2323

2424
import Cardano.Api
25-
import Cardano.Api.Shelley (ProtocolParameters)
25+
import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters)
2626

2727
import Cardano.Benchmarking.Script.Types
2828
import Cardano.TxGenerator.Internal.Orphans ()

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
module Cardano.Benchmarking.Script.Core
1919
where
2020

21-
import Cardano.Api
22-
import Cardano.Api.Shelley (PlutusScriptOrReferenceInput (..), ProtocolParameters,
23-
ShelleyLedgerEra, convertToLedgerProtocolParameters, protocolParamMaxTxExUnits,
24-
protocolParamPrices)
21+
import Cardano.Api hiding (toLedgerPParams, fromLedgerPParams)
22+
import Cardano.Api.Shelley (PlutusScriptOrReferenceInput (..),
23+
ShelleyLedgerEra)
24+
import Cardano.Api.Internal.ProtocolParameters (toLedgerPParams, fromLedgerPParams, ProtocolParameters, convertToLedgerProtocolParameters, protocolParamPrices, protocolParamMaxTxExUnits)
2525

2626
import Cardano.Benchmarking.GeneratorTx as GeneratorTx (AsyncBenchmarkControl)
2727
import qualified Cardano.Benchmarking.GeneratorTx as GeneratorTx (waitBenchmark, walletBenchmark)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module Cardano.Benchmarking.Script.Types (
4040

4141
import Cardano.Api
4242
import qualified Cardano.Api.Ledger as L
43-
import Cardano.Api.Shelley
43+
import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters)
4444

4545
import Cardano.Benchmarking.OuroborosImports (SigningKeyFile)
4646
import Cardano.Node.Configuration.NodeAddress (NodeIPv4Address)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module Cardano.TxGenerator.PlutusContext
2626
where
2727

2828
import Cardano.Api
29-
import Cardano.Api.Shelley (ProtocolParameters (..))
29+
import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters (..))
3030

3131
import Cardano.Ledger.Coin (Coin)
3232
import Cardano.TxGenerator.Setup.Plutus (preExecutePlutusScript)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Cardano.TxGenerator.PureExample
77
where
88

99
import Cardano.Api
10-
import Cardano.Api.Shelley (convertToLedgerProtocolParameters)
10+
import Cardano.Api.Internal.ProtocolParameters (convertToLedgerProtocolParameters)
1111

1212
import qualified Cardano.Ledger.Coin as L
1313
import Cardano.TxGenerator.FundQueue

bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import Control.Monad.Writer (runWriter)
2626
import Cardano.CLI.Read (readFileScriptInAnyLang)
2727

2828
import Cardano.Api
29-
import Cardano.Api.Shelley (PlutusScript (..), ProtocolParameters (..), fromAlonzoExUnits,
30-
protocolParamCostModels, toPlutusData)
29+
import Cardano.Api.Shelley (PlutusScript (..), fromAlonzoExUnits, toPlutusData)
30+
import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters (..))
3131
import Cardano.Ledger.Plutus.TxInfo (exBudgetToExUnits)
3232

3333
import qualified PlutusLedgerApi.V1 as PlutusV1

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ module Cardano.TxGenerator.Types
1414
where
1515

1616
import Cardano.Api
17-
import Cardano.Api.Shelley (ProtocolParameters)
18-
17+
import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters)
1918
import qualified Cardano.Ledger.Coin as L
2019
import Cardano.Ledger.Crypto (StandardCrypto)
2120
import qualified Cardano.Ledger.Shelley.API as Ledger (ShelleyGenesis)

bench/tx-generator/test/ApiTest.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ module Main (module Main) where
1414

1515
import Cardano.Api
1616
import qualified Cardano.Api.Ledger as Api
17-
import Cardano.Api.Shelley (ProtocolParameters (..), fromPlutusData)
17+
import Cardano.Api.Shelley (fromPlutusData, sgNetworkMagic)
18+
import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters (..))
1819

1920
#ifdef WITH_LIBRARY
2021
import Cardano.Benchmarking.PlutusScripts
@@ -116,7 +117,7 @@ main
116117
-- helper functions move them out-of-line, with an extra helper to
117118
-- avoid repeating the failure message.
118119
showFundCore :: IsShelleyBasedEra era => Maybe (AddressInEra era, Api.Coin) -> String
119-
showFundCore = maybe "fund check failed" show
120+
showFundCore = maybe "no fund found for given key in genesis" show
120121

121122
showBabbage :: Maybe (AddressInEra BabbageEra, Api.Coin) -> String
122123
showBabbage = ("Babbage: " ++) . showFundCore
@@ -135,14 +136,16 @@ checkFund nixService shelleyGenesis signingKey
135136
| AnyCardanoEra ConwayEra <- _nix_era nixService
136137
= showConway $ checkFundCore shelleyGenesis signingKey
137138
| otherwise
138-
= "ApiTest: unrecognized era"
139+
= "ApiTest.checkFund: unrecognized era"
139140

140141
checkFundCore ::
141142
IsShelleyBasedEra era
142143
=> ShelleyGenesis
143144
-> SigningKey PaymentKey
144145
-> Maybe (AddressInEra era, Api.Coin)
145-
checkFundCore = genesisInitialFundForKey Mainnet
146+
checkFundCore sg = genesisInitialFundForKey networkId sg
147+
where
148+
networkId = fromNetworkMagic $ NetworkMagic $ sgNetworkMagic sg
146149

147150
checkPlutusBuiltin :: FilePath -> IO ()
148151
#ifndef WITH_LIBRARY

bench/tx-generator/tx-generator.cabal

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ library
5353
-- TODO: switch back to -Wwarn=deprecations having dropped Cardano.Api.ProtocolParameters.ProtocolParameters in favour of Cardano.Api.Ledger.PParams
5454
-Wno-deprecations
5555

56-
exposed-modules: Cardano.Benchmarking.Command
56+
exposed-modules: Cardano.Api.Internal.ProtocolParameters
57+
Cardano.Benchmarking.Command
5758
Cardano.Benchmarking.Compiler
5859
Cardano.Benchmarking.GeneratorTx
5960
Cardano.Benchmarking.GeneratorTx.NodeToNode
@@ -158,6 +159,10 @@ library
158159
, transformers-except
159160
, unordered-containers
160161
, yaml
162+
-- Needed by "Cardano.Api.Internal.ProtocolParameters" port.
163+
, either
164+
, scientific
165+
, cardano-ledger-babbage
161166

162167
default-language: Haskell2010
163168
default-extensions: OverloadedStrings

0 commit comments

Comments
 (0)