Skip to content

Commit

Permalink
Remove ProtocolParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Feb 24, 2025
1 parent 545948a commit 70b995d
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 815 deletions.
3 changes: 0 additions & 3 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ test-suite cardano-api-test
Test.Cardano.Api.Metadata
Test.Cardano.Api.Ord
Test.Cardano.Api.Orphans
Test.Cardano.Api.ProtocolParameters
Test.Cardano.Api.RawBytes
Test.Cardano.Api.Transaction.Autobalance
Test.Cardano.Api.TxBody
Expand Down Expand Up @@ -386,7 +385,6 @@ test-suite cardano-api-golden
cardano-data >=1.0,
cardano-ledger-alonzo,
cardano-ledger-api >=1.9,
cardano-ledger-babbage >=1.9,
cardano-ledger-binary,
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14,
cardano-ledger-shelley,
Expand Down Expand Up @@ -415,7 +413,6 @@ test-suite cardano-api-golden
other-modules:
Test.Golden.Cardano.Api.Genesis
Test.Golden.Cardano.Api.Ledger
Test.Golden.Cardano.Api.ProtocolParameters
Test.Golden.Cardano.Api.Script
Test.Golden.Cardano.Api.Value
Test.Golden.ErrorsSpec
36 changes: 1 addition & 35 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module Test.Gen.Cardano.Api.Typed
, genMaybePraosNonce
, genPraosNonce
, genValidProtocolParameters
, genProtocolParameters
, genValueNestedRep
, genValueNestedBundle
, genByronKeyWitness
Expand Down Expand Up @@ -1170,40 +1169,7 @@ genPraosNonce = makePraosNonce <$> Gen.bytes (Range.linear 0 32)
genMaybePraosNonce :: Gen (Maybe PraosNonce)
genMaybePraosNonce = Gen.maybe genPraosNonce

genProtocolParameters :: CardanoEra era -> Gen ProtocolParameters
genProtocolParameters era = do
protocolParamProtocolVersion <- (,) <$> genNat <*> genNat
protocolParamDecentralization <- Gen.maybe genRational
protocolParamExtraPraosEntropy <- genMaybePraosNonce
protocolParamMaxBlockHeaderSize <- genNat
protocolParamMaxBlockBodySize <- genNat
protocolParamMaxTxSize <- genNat
protocolParamTxFeeFixed <- genLovelace
protocolParamTxFeePerByte <- genLovelace
protocolParamMinUTxOValue <- Gen.maybe genLovelace
protocolParamStakeAddressDeposit <- genLovelace
protocolParamStakePoolDeposit <- genLovelace
protocolParamMinPoolCost <- genLovelace
protocolParamPoolRetireMaxEpoch <- genEpochInterval
protocolParamStakePoolTargetNum <- genWord16
protocolParamPoolPledgeInfluence <- genRationalInt64
protocolParamMonetaryExpansion <- genRational
protocolParamTreasuryCut <- genRational
let protocolParamCostModels = mempty
-- TODO: Babbage figure out how to deal with
-- asymmetric cost model JSON instances
protocolParamPrices <- Gen.maybe genExecutionUnitPrices
protocolParamMaxTxExUnits <- Gen.maybe genExecutionUnits
protocolParamMaxBlockExUnits <- Gen.maybe genExecutionUnits
protocolParamMaxValueSize <- Gen.maybe genNat
protocolParamCollateralPercent <- Gen.maybe genNat
protocolParamMaxCollateralInputs <- Gen.maybe genNat
protocolParamUTxOCostPerByte <-
inEonForEra @BabbageEraOnwards (pure Nothing) (const (Just <$> genLovelace)) era

pure ProtocolParameters{..}

-- | Generate valid protocol parameters which pass validations in Cardano.Api.Internal.ProtocolParameters
-- | Generate valid protocol parameters which pass validations in Cardano.Api.ProtocolParameters
genValidProtocolParameters :: ShelleyBasedEra era -> Gen (LedgerProtocolParameters era)
genValidProtocolParameters sbe = shelleyBasedEraTestConstraints sbe $ LedgerProtocolParameters <$> Q.arbitrary

Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,6 @@ module Cardano.Api
, ProtocolParametersConversionError (..)

-- ** Conversions
, toLedgerPParams
, fromLedgerPParams
, toCtxUTxOTxOut
-- TODO: arrange not to export these
, fromNetworkMagic
Expand Down
Loading

0 comments on commit 70b995d

Please sign in to comment.