From 75f1b9930cce78a2cada1e31e5e922a57492994b Mon Sep 17 00:00:00 2001 From: Alexander Esgen Date: Thu, 28 Sep 2023 11:26:20 +0200 Subject: [PATCH 1/4] Bump CHaP, allow newer Plutus/Ledger/Consensus --- cabal.project | 3 +-- cardano-api/cardano-api.cabal | 16 ++++++++-------- flake.lock | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/cabal.project b/cabal.project index c143c5f52b..d1cd02b9fe 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2023-08-06T23:58:58Z - , cardano-haskell-packages 2023-09-07T15:55:30Z + , cardano-haskell-packages 2023-09-28T08:17:07Z packages: cardano-api @@ -41,4 +41,3 @@ write-ghc-environment-files: always -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. - diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 6ae27eb70b..9ee3e40385 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -175,18 +175,18 @@ library internal , mtl , network , optparse-applicative-fork - , ouroboros-consensus >= 0.9 - , ouroboros-consensus-cardano >= 0.8 - , ouroboros-consensus-diffusion >= 0.7 - , ouroboros-consensus-protocol >= 0.5.0.4 + , ouroboros-consensus ^>= 0.12 + , ouroboros-consensus-cardano ^>= 0.10 + , ouroboros-consensus-diffusion ^>= 0.8.0.1 + , ouroboros-consensus-protocol ^>= 0.5.0.7 , ouroboros-network , ouroboros-network-api , ouroboros-network-framework , ouroboros-network-protocols , parsec - , plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>= 1.9 + , plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>= 1.11 , prettyprinter - , prettyprinter-configurable ^>= 1.9 + , prettyprinter-configurable ^>= 1.11 , random , scientific , serialise @@ -350,8 +350,8 @@ test-suite cardano-api-golden , hedgehog >= 1.1 , hedgehog-extras ^>= 0.4.7.0 , microlens - , plutus-core ^>= 1.9 - , plutus-ledger-api ^>= 1.9 + , plutus-core ^>= 1.11 + , plutus-ledger-api ^>= 1.11 , tasty , tasty-hedgehog , time diff --git a/flake.lock b/flake.lock index 7dfbdbe893..08eb8e1e1d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1694155919, - "narHash": "sha256-sdbrl4GlUszafQPZqr+ud1mBeT2yAFtj2zaXO693qUc=", + "lastModified": 1695892572, + "narHash": "sha256-2e2dMPExPHjEsdK+FJuDMWqiBcTdGaKB0jJdeUh+I8M=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "92255dd59e1e851b1dd36042d52611b818d19549", + "rev": "2ec769bb0b46bfe3dd84fa782425242657b6917d", "type": "github" }, "original": { From 6f39381552c60824058236721929ae66faeacb44 Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Tue, 19 Sep 2023 17:08:45 +0200 Subject: [PATCH 2/4] input-output-hk/cardano-cli#288 Add support for conway era protocol parameters --- .../Cardano/Api/Eon/ConwayEraOnwards.hs | 1 + .../Governance/Actions/ProposalProcedure.hs | 32 +- cardano-api/internal/Cardano/Api/Orphans.hs | 312 +++++++++--------- .../Cardano/Api/ProtocolParameters.hs | 54 ++- cardano-api/src/Cardano/Api/Shelley.hs | 1 + 5 files changed, 197 insertions(+), 203 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs index 93fc0b08ab..be88ddd10f 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs @@ -34,6 +34,7 @@ import qualified Cardano.Ledger.Api as L import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.Conway.Core as L import qualified Cardano.Ledger.Conway.Governance as L +import qualified Cardano.Ledger.Conway.PParams as L import qualified Cardano.Ledger.Conway.TxCert as L import qualified Cardano.Ledger.SafeHash as L import qualified Cardano.Ledger.UTxO as L diff --git a/cardano-api/internal/Cardano/Api/Governance/Actions/ProposalProcedure.hs b/cardano-api/internal/Cardano/Api/Governance/Actions/ProposalProcedure.hs index a1d731d3aa..cb456e8d9b 100644 --- a/cardano-api/internal/Cardano/Api/Governance/Actions/ProposalProcedure.hs +++ b/cardano-api/internal/Cardano/Api/Governance/Actions/ProposalProcedure.hs @@ -81,19 +81,15 @@ toGovernanceAction _ (ProposeNewConstitution prevGovAction anchor) = , Gov.constitutionScript = SNothing -- TODO: Conway era } toGovernanceAction _ (ProposeNewCommittee prevGovId oldCommitteeMembers newCommitteeMembers quor) = - Gov.NewCommittee - prevGovId - (Set.fromList $ map toCommitteeMember oldCommitteeMembers) - Gov.Committee - { Gov.committeeMembers = Map.mapKeys toCommitteeMember newCommitteeMembers - , Gov.committeeQuorum = - fromMaybe - (error $ mconcat ["toGovernanceAction: the given quorum " + Gov.UpdateCommittee + prevGovId -- previous governance action id + (Set.fromList $ map toCommitteeMember oldCommitteeMembers) -- members to remove + (Map.mapKeys toCommitteeMember newCommitteeMembers) -- members to add + (fromMaybe (error $ mconcat ["toGovernanceAction: the given quorum " , show quor , " was outside of the unit interval!" ]) - $ boundRational @UnitInterval quor - } + $ boundRational @UnitInterval quor) toGovernanceAction _ InfoAct = Gov.InfoAction toGovernanceAction _ (TreasuryWithdrawal withdrawals) = let m = Map.fromList [(L.mkRwdAcnt nw (toShelleyStakeCredential sc), toShelleyLovelace l) | (nw,sc,l) <- withdrawals] @@ -124,16 +120,12 @@ fromGovernanceAction sbe = \case | (rwdAcnt, coin) <- Map.toList withdrawlMap ] in TreasuryWithdrawal res - Gov.NewCommittee prevGovId oldCommitteeMembers newCommittee -> - let Gov.Committee - { Gov.committeeMembers = newCommitteeMembers - , Gov.committeeQuorum = quor - } = newCommittee - in ProposeNewCommittee - prevGovId - (map fromCommitteeMember $ Set.toList oldCommitteeMembers) - (Map.mapKeys fromCommitteeMember newCommitteeMembers) - (unboundRational quor) + Gov.UpdateCommittee prevGovId oldCommitteeMembers newCommitteeMembers quor -> + ProposeNewCommittee + prevGovId + (map fromCommitteeMember $ Set.toList oldCommitteeMembers) + (Map.mapKeys fromCommitteeMember newCommitteeMembers) + (unboundRational quor) Gov.InfoAction -> InfoAct diff --git a/cardano-api/internal/Cardano/Api/Orphans.hs b/cardano-api/internal/Cardano/Api/Orphans.hs index 4fb0a2b218..52f7347e6d 100644 --- a/cardano-api/internal/Cardano/Api/Orphans.hs +++ b/cardano-api/internal/Cardano/Api/Orphans.hs @@ -146,94 +146,94 @@ instance ToJSON (PraosState StandardCrypto) where -- In this instance we take the last 'Just' value or the only 'Just' value instance Semigroup (Ledger.ShelleyPParams StrictMaybe era) where (<>) pp1 pp2 = - let fsppMinFeeA = lastMappend (Ledger.sppMinFeeA pp1) (Ledger.sppMinFeeA pp2) - fsppMinFeeB = lastMappend (Ledger.sppMinFeeB pp1) (Ledger.sppMinFeeB pp2) - fsppMaxBBSize = lastMappend (Ledger.sppMaxBBSize pp1) (Ledger.sppMaxBBSize pp2) - fsppMaxTxSize = lastMappend (Ledger.sppMaxTxSize pp1) (Ledger.sppMaxTxSize pp2) - fsppMaxBHSize = lastMappend (Ledger.sppMaxBHSize pp1) (Ledger.sppMaxBHSize pp2) - fsppKeyDeposit = lastMappend (Ledger.sppKeyDeposit pp1) (Ledger.sppKeyDeposit pp2) - fsppPoolDeposit = lastMappend (Ledger.sppPoolDeposit pp1) (Ledger.sppPoolDeposit pp2) - fsppEMax = lastMappend (Ledger.sppEMax pp1) (Ledger.sppEMax pp2) - fsppNOpt = lastMappend (Ledger.sppNOpt pp1) (Ledger.sppNOpt pp2) - fsppA0 = lastMappend (Ledger.sppA0 pp1) (Ledger.sppA0 pp2) - fsppRho = lastMappend (Ledger.sppRho pp1) (Ledger.sppRho pp2) - fsppTau = lastMappend (Ledger.sppTau pp1) (Ledger.sppTau pp2) - fsppD = lastMappend (Ledger.sppD pp1) (Ledger.sppD pp2) - fsppExtraEntropy = lastMappend (Ledger.sppExtraEntropy pp1) (Ledger.sppExtraEntropy pp2) - fsppProtocolVersion = lastMappend (Ledger.sppProtocolVersion pp1) (Ledger.sppProtocolVersion pp2) - fsppMinUTxOValue = lastMappend (Ledger.sppMinUTxOValue pp1) (Ledger.sppMinUTxOValue pp2) - fsppMinPoolCost = lastMappend (Ledger.sppMinPoolCost pp1) (Ledger.sppMinPoolCost pp2) + let fsppMinFeeA = lastMappendWith Ledger.sppMinFeeA pp1 pp2 + fsppMinFeeB = lastMappendWith Ledger.sppMinFeeB pp1 pp2 + fsppMaxBBSize = lastMappendWith Ledger.sppMaxBBSize pp1 pp2 + fsppMaxTxSize = lastMappendWith Ledger.sppMaxTxSize pp1 pp2 + fsppMaxBHSize = lastMappendWith Ledger.sppMaxBHSize pp1 pp2 + fsppKeyDeposit = lastMappendWith Ledger.sppKeyDeposit pp1 pp2 + fsppPoolDeposit = lastMappendWith Ledger.sppPoolDeposit pp1 pp2 + fsppEMax = lastMappendWith Ledger.sppEMax pp1 pp2 + fsppNOpt = lastMappendWith Ledger.sppNOpt pp1 pp2 + fsppA0 = lastMappendWith Ledger.sppA0 pp1 pp2 + fsppRho = lastMappendWith Ledger.sppRho pp1 pp2 + fsppTau = lastMappendWith Ledger.sppTau pp1 pp2 + fsppD = lastMappendWith Ledger.sppD pp1 pp2 + fsppExtraEntropy = lastMappendWith Ledger.sppExtraEntropy pp1 pp2 + fsppProtocolVersion = lastMappendWith Ledger.sppProtocolVersion pp1 pp2 + fsppMinUTxOValue = lastMappendWith Ledger.sppMinUTxOValue pp1 pp2 + fsppMinPoolCost = lastMappendWith Ledger.sppMinPoolCost pp1 pp2 in Ledger.ShelleyPParams - { Ledger.sppMinFeeA = fsppMinFeeA - , Ledger.sppMinFeeB = fsppMinFeeB - , Ledger.sppMaxBBSize = fsppMaxBBSize - , Ledger.sppMaxTxSize = fsppMaxTxSize - , Ledger.sppMaxBHSize = fsppMaxBHSize - , Ledger.sppKeyDeposit = fsppKeyDeposit - , Ledger.sppPoolDeposit = fsppPoolDeposit - , Ledger.sppEMax = fsppEMax - , Ledger.sppNOpt = fsppNOpt - , Ledger.sppA0 = fsppA0 - , Ledger.sppRho = fsppRho - , Ledger.sppTau = fsppTau - , Ledger.sppD = fsppD - , Ledger.sppExtraEntropy = fsppExtraEntropy + { Ledger.sppMinFeeA = fsppMinFeeA + , Ledger.sppMinFeeB = fsppMinFeeB + , Ledger.sppMaxBBSize = fsppMaxBBSize + , Ledger.sppMaxTxSize = fsppMaxTxSize + , Ledger.sppMaxBHSize = fsppMaxBHSize + , Ledger.sppKeyDeposit = fsppKeyDeposit + , Ledger.sppPoolDeposit = fsppPoolDeposit + , Ledger.sppEMax = fsppEMax + , Ledger.sppNOpt = fsppNOpt + , Ledger.sppA0 = fsppA0 + , Ledger.sppRho = fsppRho + , Ledger.sppTau = fsppTau + , Ledger.sppD = fsppD + , Ledger.sppExtraEntropy = fsppExtraEntropy , Ledger.sppProtocolVersion = fsppProtocolVersion - , Ledger.sppMinUTxOValue = fsppMinUTxOValue - , Ledger.sppMinPoolCost = fsppMinPoolCost + , Ledger.sppMinUTxOValue = fsppMinUTxOValue + , Ledger.sppMinPoolCost = fsppMinPoolCost } instance Semigroup (Ledger.AlonzoPParams StrictMaybe era) where (<>) p1 p2 = - let fappMinFeeA = lastMappend (Ledger.appMinFeeA p1) (Ledger.appMinFeeA p2) - fappMinFeeB = lastMappend (Ledger.appMinFeeB p1) (Ledger.appMinFeeB p2) - fappMaxBBSize = lastMappend (Ledger.appMaxBBSize p1) (Ledger.appMaxBBSize p2) - fappMaxTxSize = lastMappend (Ledger.appMaxTxSize p1) (Ledger.appMaxTxSize p2) - fappMaxBHSize = lastMappend (Ledger.appMaxBHSize p1) (Ledger.appMaxBHSize p2) - fappKeyDeposit = lastMappend (Ledger.appKeyDeposit p1) (Ledger.appKeyDeposit p2) - fappPoolDeposit = lastMappend (Ledger.appPoolDeposit p1) (Ledger.appPoolDeposit p2) - fappEMax = lastMappend (Ledger.appEMax p1) (Ledger.appEMax p2) - fappNOpt = lastMappend (Ledger.appNOpt p1) (Ledger.appNOpt p2) - fappA0 = lastMappend (Ledger.appA0 p1) (Ledger.appA0 p2) - fappRho = lastMappend (Ledger.appRho p1) (Ledger.appRho p2) - fappTau = lastMappend (Ledger.appTau p1) (Ledger.appTau p2) - fappD = lastMappend (Ledger.appD p1) (Ledger.appD p2) - fappExtraEntropy = lastMappend (Ledger.appExtraEntropy p1) (Ledger.appExtraEntropy p2) - fappProtocolVersion = lastMappend (Ledger.appProtocolVersion p1) (Ledger.appProtocolVersion p2) - fappMinPoolCost = lastMappend (Ledger.appMinPoolCost p1) (Ledger.appMinPoolCost p2) - fappCoinsPerUTxOWord = lastMappend (Ledger.appCoinsPerUTxOWord p1) (Ledger.appCoinsPerUTxOWord p2) - fappCostModels = lastMappend (Ledger.appCostModels p1) (Ledger.appCostModels p2) - fappPrices = lastMappend (Ledger.appPrices p1) (Ledger.appPrices p2) - fappMaxTxExUnits = lastMappend (Ledger.appMaxTxExUnits p1) (Ledger.appMaxTxExUnits p2) - fappMaxBlockExUnits = lastMappend (Ledger.appMaxBlockExUnits p1) (Ledger.appMaxBlockExUnits p2) - fappMaxValSize = lastMappend (Ledger.appMaxValSize p1) (Ledger.appMaxValSize p2) - fappCollateralPercentage = lastMappend (Ledger.appCollateralPercentage p1) (Ledger.appCollateralPercentage p2) - fappMaxCollateralInputs = lastMappend (Ledger.appMaxCollateralInputs p1) (Ledger.appMaxCollateralInputs p2) + let fappMinFeeA = lastMappendWith Ledger.appMinFeeA p1 p2 + fappMinFeeB = lastMappendWith Ledger.appMinFeeB p1 p2 + fappMaxBBSize = lastMappendWith Ledger.appMaxBBSize p1 p2 + fappMaxTxSize = lastMappendWith Ledger.appMaxTxSize p1 p2 + fappMaxBHSize = lastMappendWith Ledger.appMaxBHSize p1 p2 + fappKeyDeposit = lastMappendWith Ledger.appKeyDeposit p1 p2 + fappPoolDeposit = lastMappendWith Ledger.appPoolDeposit p1 p2 + fappEMax = lastMappendWith Ledger.appEMax p1 p2 + fappNOpt = lastMappendWith Ledger.appNOpt p1 p2 + fappA0 = lastMappendWith Ledger.appA0 p1 p2 + fappRho = lastMappendWith Ledger.appRho p1 p2 + fappTau = lastMappendWith Ledger.appTau p1 p2 + fappD = lastMappendWith Ledger.appD p1 p2 + fappExtraEntropy = lastMappendWith Ledger.appExtraEntropy p1 p2 + fappProtocolVersion = lastMappendWith Ledger.appProtocolVersion p1 p2 + fappMinPoolCost = lastMappendWith Ledger.appMinPoolCost p1 p2 + fappCoinsPerUTxOWord = lastMappendWith Ledger.appCoinsPerUTxOWord p1 p2 + fappCostModels = lastMappendWith Ledger.appCostModels p1 p2 + fappPrices = lastMappendWith Ledger.appPrices p1 p2 + fappMaxTxExUnits = lastMappendWith Ledger.appMaxTxExUnits p1 p2 + fappMaxBlockExUnits = lastMappendWith Ledger.appMaxBlockExUnits p1 p2 + fappMaxValSize = lastMappendWith Ledger.appMaxValSize p1 p2 + fappCollateralPercentage = lastMappendWith Ledger.appCollateralPercentage p1 p2 + fappMaxCollateralInputs = lastMappendWith Ledger.appMaxCollateralInputs p1 p2 in Ledger.AlonzoPParams - { Ledger.appMinFeeA = fappMinFeeA - , Ledger.appMinFeeB = fappMinFeeB - , Ledger.appMaxBBSize = fappMaxBBSize - , Ledger.appMaxTxSize = fappMaxTxSize - , Ledger.appMaxBHSize = fappMaxBHSize - , Ledger.appKeyDeposit = fappKeyDeposit - , Ledger.appPoolDeposit = fappPoolDeposit - , Ledger.appEMax = fappEMax - , Ledger.appNOpt = fappNOpt - , Ledger.appA0 = fappA0 - , Ledger.appRho = fappRho - , Ledger.appTau = fappTau - , Ledger.appD = fappD - , Ledger.appExtraEntropy = fappExtraEntropy - , Ledger.appProtocolVersion = fappProtocolVersion - , Ledger.appMinPoolCost = fappMinPoolCost - , Ledger.appCoinsPerUTxOWord = fappCoinsPerUTxOWord - , Ledger.appCostModels = fappCostModels - , Ledger.appPrices = fappPrices - , Ledger.appMaxTxExUnits = fappMaxTxExUnits - , Ledger.appMaxBlockExUnits = fappMaxBlockExUnits - , Ledger.appMaxValSize = fappMaxValSize + { Ledger.appMinFeeA = fappMinFeeA + , Ledger.appMinFeeB = fappMinFeeB + , Ledger.appMaxBBSize = fappMaxBBSize + , Ledger.appMaxTxSize = fappMaxTxSize + , Ledger.appMaxBHSize = fappMaxBHSize + , Ledger.appKeyDeposit = fappKeyDeposit + , Ledger.appPoolDeposit = fappPoolDeposit + , Ledger.appEMax = fappEMax + , Ledger.appNOpt = fappNOpt + , Ledger.appA0 = fappA0 + , Ledger.appRho = fappRho + , Ledger.appTau = fappTau + , Ledger.appD = fappD + , Ledger.appExtraEntropy = fappExtraEntropy + , Ledger.appProtocolVersion = fappProtocolVersion + , Ledger.appMinPoolCost = fappMinPoolCost + , Ledger.appCoinsPerUTxOWord = fappCoinsPerUTxOWord + , Ledger.appCostModels = fappCostModels + , Ledger.appPrices = fappPrices + , Ledger.appMaxTxExUnits = fappMaxTxExUnits + , Ledger.appMaxBlockExUnits = fappMaxBlockExUnits + , Ledger.appMaxValSize = fappMaxValSize , Ledger.appCollateralPercentage = fappCollateralPercentage - , Ledger.appMaxCollateralInputs = fappMaxCollateralInputs + , Ledger.appMaxCollateralInputs = fappMaxCollateralInputs } -- We're not interested in trying to mappend the underlying `Maybe` types @@ -244,85 +244,91 @@ lastMappend a b = Ledger.maybeToStrictMaybe . getLast $ strictMaybeToLast a <> s strictMaybeToLast :: StrictMaybe a -> Last a strictMaybeToLast = Last . strictMaybeToMaybe +lastMappendWith :: (a -> StrictMaybe b) -> a -> a -> StrictMaybe b +lastMappendWith l = under2 l lastMappend + where + under2 :: (a -> c) -> (c -> c -> c) -> a -> a -> c + under2 f g x y = g (f x) (f y) + instance Semigroup (Ledger.BabbagePParams StrictMaybe era) where (<>) p1 p2 = - let fbppMinFeeA = lastMappend (Ledger.bppMinFeeA p1) (Ledger.bppMinFeeA p2) - fbppMinFeeB = lastMappend (Ledger.bppMinFeeB p1) (Ledger.bppMinFeeB p2) - fbppMaxBBSize = lastMappend (Ledger.bppMaxBBSize p1) (Ledger.bppMaxBBSize p2) - fbppMaxTxSize = lastMappend (Ledger.bppMaxTxSize p1) (Ledger.bppMaxTxSize p2) - fbppMaxBHSize = lastMappend (Ledger.bppMaxBHSize p1) (Ledger.bppMaxBHSize p2) - fbppKeyDeposit = lastMappend (Ledger.bppKeyDeposit p1) (Ledger.bppKeyDeposit p2) - fbppPoolDeposit = lastMappend (Ledger.bppPoolDeposit p1) (Ledger.bppPoolDeposit p2) - fbppEMax = lastMappend (Ledger.bppEMax p1) (Ledger.bppEMax p2) - fbppNOpt = lastMappend (Ledger.bppNOpt p1) (Ledger.bppNOpt p2) - fbppA0 = lastMappend (Ledger.bppA0 p1) (Ledger.bppA0 p2) - fbppRho = lastMappend (Ledger.bppRho p1) (Ledger.bppRho p2) - fbppTau = lastMappend (Ledger.bppTau p1) (Ledger.bppTau p2) - fbppProtocolVersion = lastMappend (Ledger.bppProtocolVersion p1) (Ledger.bppProtocolVersion p2) - fbppMinPoolCost = lastMappend (Ledger.bppMinPoolCost p1) (Ledger.bppMinPoolCost p2) - fbppCoinsPerUTxOByte = lastMappend (Ledger.bppCoinsPerUTxOByte p1) (Ledger.bppCoinsPerUTxOByte p2) - fbppCostModels = lastMappend (Ledger.bppCostModels p1) (Ledger.bppCostModels p2) - fbppPrices = lastMappend (Ledger.bppPrices p1) (Ledger.bppPrices p2) - fbppMaxTxExUnits = lastMappend (Ledger.bppMaxTxExUnits p1) (Ledger.bppMaxTxExUnits p2) - fbppMaxBlockExUnits = lastMappend (Ledger.bppMaxBlockExUnits p1) (Ledger.bppMaxBlockExUnits p2) - fbppMaxValSize = lastMappend (Ledger.bppMaxValSize p1) (Ledger.bppMaxValSize p2) - fbppCollateralPercentage = lastMappend (Ledger.bppCollateralPercentage p1) (Ledger.bppCollateralPercentage p2) - fbppMaxCollateralInputs = lastMappend (Ledger.bppMaxCollateralInputs p1) (Ledger.bppMaxCollateralInputs p2) + let fbppMinFeeA = lastMappendWith Ledger.bppMinFeeA p1 p2 + fbppMinFeeB = lastMappendWith Ledger.bppMinFeeB p1 p2 + fbppMaxBBSize = lastMappendWith Ledger.bppMaxBBSize p1 p2 + fbppMaxTxSize = lastMappendWith Ledger.bppMaxTxSize p1 p2 + fbppMaxBHSize = lastMappendWith Ledger.bppMaxBHSize p1 p2 + fbppKeyDeposit = lastMappendWith Ledger.bppKeyDeposit p1 p2 + fbppPoolDeposit = lastMappendWith Ledger.bppPoolDeposit p1 p2 + fbppEMax = lastMappendWith Ledger.bppEMax p1 p2 + fbppNOpt = lastMappendWith Ledger.bppNOpt p1 p2 + fbppA0 = lastMappendWith Ledger.bppA0 p1 p2 + fbppRho = lastMappendWith Ledger.bppRho p1 p2 + fbppTau = lastMappendWith Ledger.bppTau p1 p2 + fbppProtocolVersion = lastMappendWith Ledger.bppProtocolVersion p1 p2 + fbppMinPoolCost = lastMappendWith Ledger.bppMinPoolCost p1 p2 + fbppCoinsPerUTxOByte = lastMappendWith Ledger.bppCoinsPerUTxOByte p1 p2 + fbppCostModels = lastMappendWith Ledger.bppCostModels p1 p2 + fbppPrices = lastMappendWith Ledger.bppPrices p1 p2 + fbppMaxTxExUnits = lastMappendWith Ledger.bppMaxTxExUnits p1 p2 + fbppMaxBlockExUnits = lastMappendWith Ledger.bppMaxBlockExUnits p1 p2 + fbppMaxValSize = lastMappendWith Ledger.bppMaxValSize p1 p2 + fbppCollateralPercentage = lastMappendWith Ledger.bppCollateralPercentage p1 p2 + fbppMaxCollateralInputs = lastMappendWith Ledger.bppMaxCollateralInputs p1 p2 in Ledger.BabbagePParams - { Ledger.bppMinFeeA = fbppMinFeeA - , Ledger.bppMinFeeB = fbppMinFeeB - , Ledger.bppMaxBBSize = fbppMaxBBSize - , Ledger.bppMaxTxSize = fbppMaxTxSize - , Ledger.bppMaxBHSize = fbppMaxBHSize - , Ledger.bppKeyDeposit = fbppKeyDeposit - , Ledger.bppPoolDeposit = fbppPoolDeposit - , Ledger.bppEMax = fbppEMax - , Ledger.bppNOpt = fbppNOpt - , Ledger.bppA0 = fbppA0 - , Ledger.bppRho = fbppRho - , Ledger.bppTau = fbppTau - , Ledger.bppProtocolVersion = fbppProtocolVersion - , Ledger.bppMinPoolCost = fbppMinPoolCost - , Ledger.bppCoinsPerUTxOByte = fbppCoinsPerUTxOByte - , Ledger.bppCostModels = fbppCostModels - , Ledger.bppPrices = fbppPrices - , Ledger.bppMaxTxExUnits = fbppMaxTxExUnits - , Ledger.bppMaxBlockExUnits = fbppMaxBlockExUnits - , Ledger.bppMaxValSize = fbppMaxValSize + { Ledger.bppMinFeeA = fbppMinFeeA + , Ledger.bppMinFeeB = fbppMinFeeB + , Ledger.bppMaxBBSize = fbppMaxBBSize + , Ledger.bppMaxTxSize = fbppMaxTxSize + , Ledger.bppMaxBHSize = fbppMaxBHSize + , Ledger.bppKeyDeposit = fbppKeyDeposit + , Ledger.bppPoolDeposit = fbppPoolDeposit + , Ledger.bppEMax = fbppEMax + , Ledger.bppNOpt = fbppNOpt + , Ledger.bppA0 = fbppA0 + , Ledger.bppRho = fbppRho + , Ledger.bppTau = fbppTau + , Ledger.bppProtocolVersion = fbppProtocolVersion + , Ledger.bppMinPoolCost = fbppMinPoolCost + , Ledger.bppCoinsPerUTxOByte = fbppCoinsPerUTxOByte + , Ledger.bppCostModels = fbppCostModels + , Ledger.bppPrices = fbppPrices + , Ledger.bppMaxTxExUnits = fbppMaxTxExUnits + , Ledger.bppMaxBlockExUnits = fbppMaxBlockExUnits + , Ledger.bppMaxValSize = fbppMaxValSize , Ledger.bppCollateralPercentage = fbppCollateralPercentage - , Ledger.bppMaxCollateralInputs = fbppMaxCollateralInputs + , Ledger.bppMaxCollateralInputs = fbppMaxCollateralInputs } instance Semigroup (Ledger.ConwayPParams StrictMaybe era) where (<>) p1 p2 = Ledger.ConwayPParams - { Ledger.cppMinFeeA = Ledger.cppMinFeeA p1 `lastMappend` Ledger.cppMinFeeA p2 - , Ledger.cppMinFeeB = Ledger.cppMinFeeB p1 `lastMappend` Ledger.cppMinFeeB p2 - , Ledger.cppMaxBBSize = Ledger.cppMaxBBSize p1 `lastMappend` Ledger.cppMaxBBSize p2 - , Ledger.cppMaxTxSize = Ledger.cppMaxTxSize p1 `lastMappend` Ledger.cppMaxTxSize p2 - , Ledger.cppMaxBHSize = Ledger.cppMaxBHSize p1 `lastMappend` Ledger.cppMaxBHSize p2 - , Ledger.cppKeyDeposit = Ledger.cppKeyDeposit p1 `lastMappend` Ledger.cppKeyDeposit p2 - , Ledger.cppPoolDeposit = Ledger.cppPoolDeposit p1 `lastMappend` Ledger.cppPoolDeposit p2 - , Ledger.cppEMax = Ledger.cppEMax p1 `lastMappend` Ledger.cppEMax p2 - , Ledger.cppNOpt = Ledger.cppNOpt p1 `lastMappend` Ledger.cppNOpt p2 - , Ledger.cppA0 = Ledger.cppA0 p1 `lastMappend` Ledger.cppA0 p2 - , Ledger.cppRho = Ledger.cppRho p1 `lastMappend` Ledger.cppRho p2 - , Ledger.cppTau = Ledger.cppTau p1 `lastMappend` Ledger.cppTau p2 - , Ledger.cppProtocolVersion = Ledger.cppProtocolVersion p1 `lastMappend` Ledger.cppProtocolVersion p2 - , Ledger.cppMinPoolCost = Ledger.cppMinPoolCost p1 `lastMappend` Ledger.cppMinPoolCost p2 - , Ledger.cppCoinsPerUTxOByte = Ledger.cppCoinsPerUTxOByte p1 `lastMappend` Ledger.cppCoinsPerUTxOByte p2 - , Ledger.cppCostModels = Ledger.cppCostModels p1 `lastMappend` Ledger.cppCostModels p2 - , Ledger.cppPrices = Ledger.cppPrices p1 `lastMappend` Ledger.cppPrices p2 - , Ledger.cppMaxTxExUnits = Ledger.cppMaxTxExUnits p1 `lastMappend` Ledger.cppMaxTxExUnits p2 - , Ledger.cppMaxBlockExUnits = Ledger.cppMaxBlockExUnits p1 `lastMappend` Ledger.cppMaxBlockExUnits p2 - , Ledger.cppMaxValSize = Ledger.cppMaxValSize p1 `lastMappend` Ledger.cppMaxValSize p2 - , Ledger.cppCollateralPercentage = Ledger.cppCollateralPercentage p1 `lastMappend` Ledger.cppCollateralPercentage p2 - , Ledger.cppMaxCollateralInputs = Ledger.cppMaxCollateralInputs p1 `lastMappend` Ledger.cppMaxCollateralInputs p2 - , Ledger.cppPoolVotingThresholds = Ledger.cppPoolVotingThresholds p1 `lastMappend` Ledger.cppPoolVotingThresholds p2 - , Ledger.cppDRepVotingThresholds = Ledger.cppDRepVotingThresholds p1 `lastMappend` Ledger.cppDRepVotingThresholds p2 - , Ledger.cppMinCommitteeSize = Ledger.cppMinCommitteeSize p1 `lastMappend` Ledger.cppMinCommitteeSize p2 - , Ledger.cppCommitteeTermLimit = Ledger.cppCommitteeTermLimit p1 `lastMappend` Ledger.cppCommitteeTermLimit p2 - , Ledger.cppGovActionExpiration = Ledger.cppGovActionExpiration p1 `lastMappend` Ledger.cppGovActionExpiration p2 - , Ledger.cppGovActionDeposit = Ledger.cppGovActionDeposit p1 `lastMappend` Ledger.cppGovActionDeposit p2 - , Ledger.cppDRepDeposit = Ledger.cppDRepDeposit p1 `lastMappend` Ledger.cppDRepDeposit p2 - , Ledger.cppDRepActivity = Ledger.cppDRepActivity p1 `lastMappend` Ledger.cppDRepActivity p2 + { Ledger.cppMinFeeA = lastMappendWith Ledger.cppMinFeeA p1 p2 + , Ledger.cppMinFeeB = lastMappendWith Ledger.cppMinFeeB p1 p2 + , Ledger.cppMaxBBSize = lastMappendWith Ledger.cppMaxBBSize p1 p2 + , Ledger.cppMaxTxSize = lastMappendWith Ledger.cppMaxTxSize p1 p2 + , Ledger.cppMaxBHSize = lastMappendWith Ledger.cppMaxBHSize p1 p2 + , Ledger.cppKeyDeposit = lastMappendWith Ledger.cppKeyDeposit p1 p2 + , Ledger.cppPoolDeposit = lastMappendWith Ledger.cppPoolDeposit p1 p2 + , Ledger.cppEMax = lastMappendWith Ledger.cppEMax p1 p2 + , Ledger.cppNOpt = lastMappendWith Ledger.cppNOpt p1 p2 + , Ledger.cppA0 = lastMappendWith Ledger.cppA0 p1 p2 + , Ledger.cppRho = lastMappendWith Ledger.cppRho p1 p2 + , Ledger.cppTau = lastMappendWith Ledger.cppTau p1 p2 + , Ledger.cppProtocolVersion = lastMappendWith Ledger.cppProtocolVersion p1 p2 + , Ledger.cppMinPoolCost = lastMappendWith Ledger.cppMinPoolCost p1 p2 + , Ledger.cppCoinsPerUTxOByte = lastMappendWith Ledger.cppCoinsPerUTxOByte p1 p2 + , Ledger.cppCostModels = lastMappendWith Ledger.cppCostModels p1 p2 + , Ledger.cppPrices = lastMappendWith Ledger.cppPrices p1 p2 + , Ledger.cppMaxTxExUnits = lastMappendWith Ledger.cppMaxTxExUnits p1 p2 + , Ledger.cppMaxBlockExUnits = lastMappendWith Ledger.cppMaxBlockExUnits p1 p2 + , Ledger.cppMaxValSize = lastMappendWith Ledger.cppMaxValSize p1 p2 + , Ledger.cppCollateralPercentage = lastMappendWith Ledger.cppCollateralPercentage p1 p2 + , Ledger.cppMaxCollateralInputs = lastMappendWith Ledger.cppMaxCollateralInputs p1 p2 + , Ledger.cppPoolVotingThresholds = lastMappendWith Ledger.cppPoolVotingThresholds p1 p2 + , Ledger.cppDRepVotingThresholds = lastMappendWith Ledger.cppDRepVotingThresholds p1 p2 + , Ledger.cppCommitteeMinSize = lastMappendWith Ledger.cppCommitteeMinSize p1 p2 + , Ledger.cppCommitteeMaxTermLength = lastMappendWith Ledger.cppCommitteeMaxTermLength p1 p2 + , Ledger.cppGovActionLifetime = lastMappendWith Ledger.cppGovActionLifetime p1 p2 + , Ledger.cppGovActionDeposit = lastMappendWith Ledger.cppGovActionDeposit p1 p2 + , Ledger.cppDRepDeposit = lastMappendWith Ledger.cppDRepDeposit p1 p2 + , Ledger.cppDRepActivity = lastMappendWith Ledger.cppDRepActivity p1 p2 } diff --git a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs index 17643aaa42..0bc1a2a71c 100644 --- a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs +++ b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs @@ -44,6 +44,7 @@ module Cardano.Api.ProtocolParameters ( ShelleyToAlonzoPParams(..), ShelleyToAlonzoPParams'(..), IntroducedInBabbagePParams(..), + IntroducedInConwayPParams(..), createEraBasedProtocolParamUpdate, convertToLedgerProtocolParameters, createPParams, @@ -93,7 +94,6 @@ module Cardano.Api.ProtocolParameters ( -- ** Era-dependent protocol features ProtocolUTxOCostPerByteFeature(..), ProtocolUTxOCostPerWordFeature(..), - ) where import Cardano.Api.Address @@ -127,10 +127,11 @@ import Cardano.Ledger.Api.PParams import qualified Cardano.Ledger.Babbage.Core as Ledger import Cardano.Ledger.BaseTypes (strictMaybeToMaybe) import qualified Cardano.Ledger.BaseTypes as Ledger +import qualified Cardano.Ledger.Conway.PParams as Ledger import Cardano.Ledger.Crypto (StandardCrypto) import qualified Cardano.Ledger.Keys as Ledger import qualified Cardano.Ledger.Shelley.API as Ledger -import Cardano.Slotting.Slot (EpochNo) +import Cardano.Slotting.Slot (EpochNo (..)) import Control.Monad import Data.Aeson (FromJSON (..), ToJSON (..), object, withObject, (.!=), (.:), (.:?), @@ -227,47 +228,40 @@ data EraBasedProtocolParametersUpdate era where :: CommonProtocolParametersUpdate -> AlonzoOnwardsPParams ConwayEra -> IntroducedInBabbagePParams ConwayEra - -- TODO: Conway era - need new ledger release - -- -> IntroducedInConwayPParamsUpdate (ShelleyLedgerEra ConwayEra) + -> IntroducedInConwayPParams (ShelleyLedgerEra ConwayEra) -> EraBasedProtocolParametersUpdate ConwayEra deriving instance Show (EraBasedProtocolParametersUpdate era) -{- - -TODO: Conway era - need new ledger release - -data IntroducedInConwayPParamsUpdate era - = IntroducedInConwayPParamsUpdate - { icPoolVotingThresholds :: StrictMaybe PoolVotingThresholds - , icDRepVotingThresholds :: StrictMaybe DRepVotingThresholds - , icMinCommitteeSize :: StrictMaybe Natural - , icCommitteeTermLimit :: StrictMaybe Natural - , icGovActionExpiration :: StrictMaybe Natural - , icGovActionDeposit :: StrictMaybe Coin - , icDRepDeposit :: StrictMaybe Coin - , icDRepActivity :: StrictMaybe EpochNo - } +data IntroducedInConwayPParams era + = IntroducedInConwayPParams + { icPoolVotingThresholds :: StrictMaybe Ledger.PoolVotingThresholds + , icDRepVotingThresholds :: StrictMaybe Ledger.DRepVotingThresholds + , icMinCommitteeSize :: StrictMaybe Natural + , icCommitteeTermLength :: StrictMaybe Natural + , icGovActionLifetime :: StrictMaybe EpochNo + , icGovActionDeposit :: StrictMaybe Ledger.Coin + , icDRepDeposit :: StrictMaybe Ledger.Coin + , icDRepActivity :: StrictMaybe EpochNo + } deriving Show createIntroducedInConwayPParams :: Ledger.ConwayEraPParams ledgerera - => IntroducedInConwayPParamsUpdate ledgerera + => IntroducedInConwayPParams ledgerera -> Ledger.PParamsUpdate ledgerera -createIntroducedInConwayPParams IntroducedInConwayPParamsUpdate{..} = - +createIntroducedInConwayPParams IntroducedInConwayPParams{..} = Ledger.emptyPParamsUpdate & Ledger.ppuPoolVotingThresholdsL .~ icPoolVotingThresholds & Ledger.ppuDRepVotingThresholdsL .~ icDRepVotingThresholds - & Ledger.ppuMinCommitteeSizeL .~ icMinCommitteeSize - & Ledger.ppuCommitteeTermLimitL .~ icCommitteeTermLimit - & Ledger.ppuGovActionExpirationL .~ icGovActionExpiration + & Ledger.ppuCommitteeMinSizeL .~ icMinCommitteeSize + & Ledger.ppuCommitteeMaxTermLengthL .~ icCommitteeTermLength + & Ledger.ppuGovActionLifetimeL .~ icGovActionLifetime & Ledger.ppuGovActionDepositL .~ icGovActionDeposit & Ledger.ppuDRepDepositL .~ icDRepDeposit & Ledger.ppuDRepActivityL .~ icDRepActivity --} createEraBasedProtocolParamUpdate :: ShelleyBasedEra era @@ -306,12 +300,12 @@ createEraBasedProtocolParamUpdate sbe eraPParamsUpdate = Ledger.PParamsUpdate inBAb = createIntroducedInBabbagePParams sbe introInBabbage in Ledger.PParamsUpdate $ common <> inAlonzoPParams <> inBAb - ConwayEraBasedProtocolParametersUpdate c introInAlonzo introInBabbage -> + ConwayEraBasedProtocolParametersUpdate c introInAlonzo introInBabbage introInConway -> let Ledger.PParamsUpdate common = createCommonPParamsUpdate c Ledger.PParamsUpdate inAlonzoPParams = createPParamsUpdateIntroducedInAlonzo sbe introInAlonzo - Ledger.PParamsUpdate inBAb = createIntroducedInBabbagePParams sbe introInBabbage - -- TODO: Conway era - need new ledger release for updated types - in Ledger.PParamsUpdate $ common <> inAlonzoPParams <> inBAb + Ledger.PParamsUpdate inBab = createIntroducedInBabbagePParams sbe introInBabbage + Ledger.PParamsUpdate inCon = createIntroducedInConwayPParams introInConway + in Ledger.PParamsUpdate $ common <> inAlonzoPParams <> inBab <> inCon -- | Protocol parameters common to each era. This can only ever be reduced diff --git a/cardano-api/src/Cardano/Api/Shelley.hs b/cardano-api/src/Cardano/Api/Shelley.hs index 26cfe350ff..e35fd337b5 100644 --- a/cardano-api/src/Cardano/Api/Shelley.hs +++ b/cardano-api/src/Cardano/Api/Shelley.hs @@ -118,6 +118,7 @@ module Cardano.Api.Shelley ShelleyToAlonzoPParams(..), ShelleyToAlonzoPParams'(..), IntroducedInBabbagePParams(..), + IntroducedInConwayPParams(..), createEraBasedProtocolParamUpdate, convertToLedgerProtocolParameters, From a99e93d6fc4ca77594d420875b14dd51e7140796 Mon Sep 17 00:00:00 2001 From: Alexander Esgen Date: Tue, 26 Sep 2023 10:46:19 +0200 Subject: [PATCH 3/4] Integrate Consensus changes --- .../internal/Cardano/Api/LedgerState.hs | 108 ++++++------------ cardano-api/internal/Cardano/Api/Protocol.hs | 7 +- 2 files changed, 42 insertions(+), 73 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/LedgerState.hs b/cardano-api/internal/Cardano/Api/LedgerState.hs index 455569a5fa..be11c712d5 100644 --- a/cardano-api/internal/Cardano/Api/LedgerState.hs +++ b/cardano-api/internal/Cardano/Api/LedgerState.hs @@ -116,6 +116,8 @@ import qualified Cardano.Crypto.ProtocolMagic import qualified Cardano.Crypto.VRF as Crypto import qualified Cardano.Crypto.VRF.Class as VRF import Cardano.Ledger.Alonzo.Genesis (AlonzoGenesis (..)) +import qualified Cardano.Ledger.Api.Era as Ledger +import qualified Cardano.Ledger.Api.Transition as Ledger import Cardano.Ledger.BaseTypes (Globals (..), Nonce, ProtVer (..), natVersion, (⭒)) import qualified Cardano.Ledger.BaseTypes as Ledger import qualified Cardano.Ledger.BHeaderView as Ledger @@ -126,7 +128,6 @@ import qualified Cardano.Ledger.PoolDistr as SL import qualified Cardano.Ledger.Shelley.API as ShelleyAPI import qualified Cardano.Ledger.Shelley.Core as Core import qualified Cardano.Ledger.Shelley.Genesis as Ledger -import Cardano.Ledger.Shelley.Translation (emptyFromByronTranslationContext) import qualified Cardano.Protocol.TPraos.API as TPraos import Cardano.Protocol.TPraos.BHeader (checkLeaderNatValue) import qualified Cardano.Protocol.TPraos.BHeader as TPraos @@ -156,7 +157,6 @@ import Ouroboros.Consensus.Protocol.Abstract (ChainDepState, Consensus import qualified Ouroboros.Consensus.Protocol.Abstract as Consensus import qualified Ouroboros.Consensus.Protocol.Praos.Common as Consensus import Ouroboros.Consensus.Protocol.Praos.VRF (mkInputVRF, vrfLeaderValue) -import Ouroboros.Consensus.Protocol.TPraos (TPraos) import qualified Ouroboros.Consensus.Protocol.TPraos as TPraos import qualified Ouroboros.Consensus.Shelley.Eras as Shelley import qualified Ouroboros.Consensus.Shelley.Ledger.Block as Shelley @@ -760,18 +760,18 @@ genesisConfigToEnv -- enp genCfg = case genCfg of - GenesisCardano _ bCfg sCfg _ _ - | Cardano.Crypto.ProtocolMagic.unProtocolMagicId (Cardano.Chain.Genesis.configProtocolMagicId bCfg) /= Ledger.sgNetworkMagic (scConfig sCfg) -> + GenesisCardano _ bCfg _ transCfg + | Cardano.Crypto.ProtocolMagic.unProtocolMagicId (Cardano.Chain.Genesis.configProtocolMagicId bCfg) /= Ledger.sgNetworkMagic shelleyGenesis -> Left . NECardanoConfig $ mconcat [ "ProtocolMagicId ", textShow (Cardano.Crypto.ProtocolMagic.unProtocolMagicId $ Cardano.Chain.Genesis.configProtocolMagicId bCfg) - , " /= ", textShow (Ledger.sgNetworkMagic $ scConfig sCfg) + , " /= ", textShow (Ledger.sgNetworkMagic shelleyGenesis) ] - | Cardano.Chain.Genesis.gdStartTime (Cardano.Chain.Genesis.configGenesisData bCfg) /= Ledger.sgSystemStart (scConfig sCfg) -> + | Cardano.Chain.Genesis.gdStartTime (Cardano.Chain.Genesis.configGenesisData bCfg) /= Ledger.sgSystemStart shelleyGenesis -> Left . NECardanoConfig $ mconcat [ "SystemStart ", textShow (Cardano.Chain.Genesis.gdStartTime $ Cardano.Chain.Genesis.configGenesisData bCfg) - , " /= ", textShow (Ledger.sgSystemStart $ scConfig sCfg) + , " /= ", textShow (Ledger.sgSystemStart shelleyGenesis) ] | otherwise -> let @@ -781,6 +781,8 @@ genesisConfigToEnv { envLedgerConfig = Consensus.topLevelConfigLedger topLevelConfig , envProtocolConfig = Consensus.topLevelConfigProtocol topLevelConfig } + where + shelleyGenesis = transCfg ^. Ledger.tcShelleyGenesisL readNodeConfig :: NodeConfigFile 'In -> ExceptT Text IO NodeConfig readNodeConfig (File ncf) = do @@ -804,23 +806,7 @@ data NodeConfig = NodeConfig , ncConwayGenesisHash :: !GenesisHashConway , ncRequiresNetworkMagic :: !Cardano.Crypto.RequiresNetworkMagic , ncByronProtocolVersion :: !Cardano.Chain.Update.ProtocolVersion - - -- Per-era parameters for the hardfok transitions: - , ncByronToShelley :: !(Consensus.ProtocolTransitionParams - Byron.ByronBlock - (Shelley.ShelleyBlock (TPraos Shelley.StandardCrypto) Shelley.StandardShelley) - ) - , ncShelleyToAllegra :: !(Consensus.ProtocolTransitionParams - (Shelley.ShelleyBlock (TPraos Shelley.StandardCrypto) Shelley.StandardShelley) - (Shelley.ShelleyBlock (TPraos Shelley.StandardCrypto) Shelley.StandardAllegra) - ) - , ncAllegraToMary :: !(Consensus.ProtocolTransitionParams - (Shelley.ShelleyBlock (TPraos Shelley.StandardCrypto) Shelley.StandardAllegra) - (Shelley.ShelleyBlock (TPraos Shelley.StandardCrypto) Shelley.StandardMary) - ) - , ncMaryToAlonzo :: !Consensus.TriggerHardFork - , ncAlonzoToBabbage :: !Consensus.TriggerHardFork - , ncBabbageToConway :: !Consensus.TriggerHardFork + , ncHardForkTriggers :: !Consensus.CardanoHardForkTriggers } instance FromJSON NodeConfig where @@ -841,15 +827,7 @@ instance FromJSON NodeConfig where <*> fmap GenesisHashConway (o .: "ConwayGenesisHash") <*> o .: "RequiresNetworkMagic" <*> parseByronProtocolVersion o - <*> (Consensus.ProtocolTransitionParamsByronToShelley emptyFromByronTranslationContext - <$> parseShelleyHardForkEpoch o) - <*> (Consensus.ProtocolTransitionParamsIntraShelley () - <$> parseAllegraHardForkEpoch o) - <*> (Consensus.ProtocolTransitionParamsIntraShelley () - <$> parseMaryHardForkEpoch o) - <*> parseAlonzoHardForkEpoch o - <*> parseBabbageHardForkEpoch o - <*> parseConwayHardForkEpoch o + <*> parseHardForkTriggers o parseByronProtocolVersion :: Object -> Parser Cardano.Chain.Update.ProtocolVersion parseByronProtocolVersion o = @@ -858,6 +836,16 @@ instance FromJSON NodeConfig where <*> o .: "LastKnownBlockVersion-Minor" <*> o .: "LastKnownBlockVersion-Alt" + parseHardForkTriggers :: Object -> Parser Consensus.CardanoHardForkTriggers + parseHardForkTriggers o = + Consensus.CardanoHardForkTriggers' + <$> parseShelleyHardForkEpoch o + <*> parseAllegraHardForkEpoch o + <*> parseMaryHardForkEpoch o + <*> parseAlonzoHardForkEpoch o + <*> parseBabbageHardForkEpoch o + <*> parseConwayHardForkEpoch o + parseShelleyHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork parseShelleyHardForkEpoch o = asum @@ -982,9 +970,8 @@ data GenesisConfig = GenesisCardano !NodeConfig !Cardano.Chain.Genesis.Config - !ShelleyConfig - !AlonzoGenesis - !(ConwayGenesis Shelley.StandardCrypto) + !GenesisHashShelley + !(Ledger.TransitionConfig (Ledger.LatestKnownEra Shelley.StandardCrypto)) newtype LedgerStateDir = LedgerStateDir { unLedgerStateDir :: FilePath @@ -1003,7 +990,7 @@ mkProtocolInfoCardano :: (Consensus.CardanoEras Consensus.StandardCrypto)) , IO [BlockForging IO (HFC.HardForkBlock (Consensus.CardanoEras Consensus.StandardCrypto))]) -mkProtocolInfoCardano (GenesisCardano dnc byronGenesis shelleyGenesis alonzoGenesis conwayGenesis) +mkProtocolInfoCardano (GenesisCardano dnc byronGenesis shelleyGenesisHash transCfg) = Consensus.protocolInfoCardano Consensus.CardanoProtocolParams { Consensus.paramsByron = Consensus.ProtocolParamsByron @@ -1016,8 +1003,7 @@ mkProtocolInfoCardano (GenesisCardano dnc byronGenesis shelleyGenesis alonzoGene } , Consensus.paramsShelleyBased = Consensus.ProtocolParamsShelleyBased - { Consensus.shelleyBasedGenesis = scConfig shelleyGenesis - , Consensus.shelleyBasedInitialNonce = shelleyPraosNonce shelleyGenesis + { Consensus.shelleyBasedInitialNonce = shelleyPraosNonce shelleyGenesisHash , Consensus.shelleyBasedLeaderCredentials = [] } , Consensus.paramsShelley = @@ -1050,43 +1036,25 @@ mkProtocolInfoCardano (GenesisCardano dnc byronGenesis shelleyGenesis alonzoGene { Consensus.conwayProtVer = ProtVer (natVersion @10) 0 , Consensus.conwayMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure } - , Consensus.transitionParamsByronToShelley = - ncByronToShelley dnc - , Consensus.transitionParamsShelleyToAllegra = - ncShelleyToAllegra dnc - , Consensus.transitionParamsAllegraToMary = - ncAllegraToMary dnc - , Consensus.transitionParamsMaryToAlonzo = - Consensus.ProtocolTransitionParamsIntraShelley - { Consensus.transitionIntraShelleyTranslationContext = alonzoGenesis - , Consensus.transitionIntraShelleyTrigger = ncMaryToAlonzo dnc - } - , Consensus.transitionParamsAlonzoToBabbage = - Consensus.ProtocolTransitionParamsIntraShelley - { Consensus.transitionIntraShelleyTranslationContext = () - , Consensus.transitionIntraShelleyTrigger = ncAlonzoToBabbage dnc - } - , Consensus.transitionParamsBabbageToConway = - Consensus.ProtocolTransitionParamsIntraShelley - { Consensus.transitionIntraShelleyTranslationContext = conwayGenesis - , Consensus.transitionIntraShelleyTrigger = ncBabbageToConway dnc - } + , Consensus.hardForkTriggers = ncHardForkTriggers dnc + , Consensus.ledgerTransitionConfig = transCfg } --- | Compute the Nonce from the ShelleyGenesis file. -shelleyPraosNonce :: ShelleyConfig -> Ledger.Nonce -shelleyPraosNonce sCfg = - Ledger.Nonce (Cardano.Crypto.Hash.Class.castHash . unGenesisHashShelley $ scGenesisHash sCfg) +-- | Compute the Nonce from the hash of the Genesis file. +shelleyPraosNonce :: GenesisHashShelley -> Ledger.Nonce +shelleyPraosNonce genesisHash = + Ledger.Nonce (Cardano.Crypto.Hash.Class.castHash $ unGenesisHashShelley genesisHash) readCardanoGenesisConfig :: NodeConfig -> ExceptT GenesisConfigError IO GenesisConfig -readCardanoGenesisConfig enc = - GenesisCardano enc - <$> readByronGenesisConfig enc - <*> readShelleyGenesisConfig enc - <*> readAlonzoGenesisConfig enc - <*> readConwayGenesisConfig enc +readCardanoGenesisConfig enc = do + byronGenesis <- readByronGenesisConfig enc + ShelleyConfig shelleyGenesis shelleyGenesisHash <- readShelleyGenesisConfig enc + alonzoGenesis <- readAlonzoGenesisConfig enc + conwayGenesis <- readConwayGenesisConfig enc + let transCfg = Ledger.mkLatestTransitionConfig shelleyGenesis alonzoGenesis conwayGenesis + pure $ GenesisCardano enc byronGenesis shelleyGenesisHash transCfg data GenesisConfigError = NEError !Text diff --git a/cardano-api/internal/Cardano/Api/Protocol.hs b/cardano-api/internal/Cardano/Api/Protocol.hs index 7aaed6e0b9..99016a1cfb 100644 --- a/cardano-api/internal/Cardano/Api/Protocol.hs +++ b/cardano-api/internal/Cardano/Api/Protocol.hs @@ -89,10 +89,11 @@ instance ( IOLike m ) => Protocol m (ShelleyBlockHFC (Consensus.TPraos StandardCrypto) StandardShelley) where data ProtocolInfoArgs (ShelleyBlockHFC (Consensus.TPraos StandardCrypto) StandardShelley) = ProtocolInfoArgsShelley - (ProtocolParamsShelleyBased StandardShelley) + (ShelleyGenesis StandardCrypto) + (ProtocolParamsShelleyBased StandardCrypto) (ProtocolParams (Consensus.ShelleyBlock (Consensus.TPraos StandardCrypto) StandardShelley)) - protocolInfo (ProtocolInfoArgsShelley paramsShelleyBased_ paramsShelley_) = - bimap inject (fmap $ map inject) $ protocolInfoShelley paramsShelleyBased_ paramsShelley_ + protocolInfo (ProtocolInfoArgsShelley genesis paramsShelleyBased_ paramsShelley_) = + bimap inject (fmap $ map inject) $ protocolInfoShelley genesis paramsShelleyBased_ paramsShelley_ instance Consensus.LedgerSupportsProtocol (Consensus.ShelleyBlock From e3f5e27e9f0fe36b69e9532da5505e6006dedd77 Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Thu, 28 Sep 2023 14:09:44 +0200 Subject: [PATCH 4/4] Undo vertical formatting --- cardano-api/internal/Cardano/Api/Orphans.hs | 298 ++++++++++---------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Orphans.hs b/cardano-api/internal/Cardano/Api/Orphans.hs index 52f7347e6d..5fff888259 100644 --- a/cardano-api/internal/Cardano/Api/Orphans.hs +++ b/cardano-api/internal/Cardano/Api/Orphans.hs @@ -146,94 +146,94 @@ instance ToJSON (PraosState StandardCrypto) where -- In this instance we take the last 'Just' value or the only 'Just' value instance Semigroup (Ledger.ShelleyPParams StrictMaybe era) where (<>) pp1 pp2 = - let fsppMinFeeA = lastMappendWith Ledger.sppMinFeeA pp1 pp2 - fsppMinFeeB = lastMappendWith Ledger.sppMinFeeB pp1 pp2 - fsppMaxBBSize = lastMappendWith Ledger.sppMaxBBSize pp1 pp2 - fsppMaxTxSize = lastMappendWith Ledger.sppMaxTxSize pp1 pp2 - fsppMaxBHSize = lastMappendWith Ledger.sppMaxBHSize pp1 pp2 - fsppKeyDeposit = lastMappendWith Ledger.sppKeyDeposit pp1 pp2 - fsppPoolDeposit = lastMappendWith Ledger.sppPoolDeposit pp1 pp2 - fsppEMax = lastMappendWith Ledger.sppEMax pp1 pp2 - fsppNOpt = lastMappendWith Ledger.sppNOpt pp1 pp2 - fsppA0 = lastMappendWith Ledger.sppA0 pp1 pp2 - fsppRho = lastMappendWith Ledger.sppRho pp1 pp2 - fsppTau = lastMappendWith Ledger.sppTau pp1 pp2 - fsppD = lastMappendWith Ledger.sppD pp1 pp2 - fsppExtraEntropy = lastMappendWith Ledger.sppExtraEntropy pp1 pp2 + let fsppMinFeeA = lastMappendWith Ledger.sppMinFeeA pp1 pp2 + fsppMinFeeB = lastMappendWith Ledger.sppMinFeeB pp1 pp2 + fsppMaxBBSize = lastMappendWith Ledger.sppMaxBBSize pp1 pp2 + fsppMaxTxSize = lastMappendWith Ledger.sppMaxTxSize pp1 pp2 + fsppMaxBHSize = lastMappendWith Ledger.sppMaxBHSize pp1 pp2 + fsppKeyDeposit = lastMappendWith Ledger.sppKeyDeposit pp1 pp2 + fsppPoolDeposit = lastMappendWith Ledger.sppPoolDeposit pp1 pp2 + fsppEMax = lastMappendWith Ledger.sppEMax pp1 pp2 + fsppNOpt = lastMappendWith Ledger.sppNOpt pp1 pp2 + fsppA0 = lastMappendWith Ledger.sppA0 pp1 pp2 + fsppRho = lastMappendWith Ledger.sppRho pp1 pp2 + fsppTau = lastMappendWith Ledger.sppTau pp1 pp2 + fsppD = lastMappendWith Ledger.sppD pp1 pp2 + fsppExtraEntropy = lastMappendWith Ledger.sppExtraEntropy pp1 pp2 fsppProtocolVersion = lastMappendWith Ledger.sppProtocolVersion pp1 pp2 - fsppMinUTxOValue = lastMappendWith Ledger.sppMinUTxOValue pp1 pp2 - fsppMinPoolCost = lastMappendWith Ledger.sppMinPoolCost pp1 pp2 + fsppMinUTxOValue = lastMappendWith Ledger.sppMinUTxOValue pp1 pp2 + fsppMinPoolCost = lastMappendWith Ledger.sppMinPoolCost pp1 pp2 in Ledger.ShelleyPParams - { Ledger.sppMinFeeA = fsppMinFeeA - , Ledger.sppMinFeeB = fsppMinFeeB - , Ledger.sppMaxBBSize = fsppMaxBBSize - , Ledger.sppMaxTxSize = fsppMaxTxSize - , Ledger.sppMaxBHSize = fsppMaxBHSize - , Ledger.sppKeyDeposit = fsppKeyDeposit - , Ledger.sppPoolDeposit = fsppPoolDeposit - , Ledger.sppEMax = fsppEMax - , Ledger.sppNOpt = fsppNOpt - , Ledger.sppA0 = fsppA0 - , Ledger.sppRho = fsppRho - , Ledger.sppTau = fsppTau - , Ledger.sppD = fsppD - , Ledger.sppExtraEntropy = fsppExtraEntropy + { Ledger.sppMinFeeA = fsppMinFeeA + , Ledger.sppMinFeeB = fsppMinFeeB + , Ledger.sppMaxBBSize = fsppMaxBBSize + , Ledger.sppMaxTxSize = fsppMaxTxSize + , Ledger.sppMaxBHSize = fsppMaxBHSize + , Ledger.sppKeyDeposit = fsppKeyDeposit + , Ledger.sppPoolDeposit = fsppPoolDeposit + , Ledger.sppEMax = fsppEMax + , Ledger.sppNOpt = fsppNOpt + , Ledger.sppA0 = fsppA0 + , Ledger.sppRho = fsppRho + , Ledger.sppTau = fsppTau + , Ledger.sppD = fsppD + , Ledger.sppExtraEntropy = fsppExtraEntropy , Ledger.sppProtocolVersion = fsppProtocolVersion - , Ledger.sppMinUTxOValue = fsppMinUTxOValue - , Ledger.sppMinPoolCost = fsppMinPoolCost + , Ledger.sppMinUTxOValue = fsppMinUTxOValue + , Ledger.sppMinPoolCost = fsppMinPoolCost } instance Semigroup (Ledger.AlonzoPParams StrictMaybe era) where (<>) p1 p2 = - let fappMinFeeA = lastMappendWith Ledger.appMinFeeA p1 p2 - fappMinFeeB = lastMappendWith Ledger.appMinFeeB p1 p2 - fappMaxBBSize = lastMappendWith Ledger.appMaxBBSize p1 p2 - fappMaxTxSize = lastMappendWith Ledger.appMaxTxSize p1 p2 - fappMaxBHSize = lastMappendWith Ledger.appMaxBHSize p1 p2 - fappKeyDeposit = lastMappendWith Ledger.appKeyDeposit p1 p2 - fappPoolDeposit = lastMappendWith Ledger.appPoolDeposit p1 p2 - fappEMax = lastMappendWith Ledger.appEMax p1 p2 - fappNOpt = lastMappendWith Ledger.appNOpt p1 p2 - fappA0 = lastMappendWith Ledger.appA0 p1 p2 - fappRho = lastMappendWith Ledger.appRho p1 p2 - fappTau = lastMappendWith Ledger.appTau p1 p2 - fappD = lastMappendWith Ledger.appD p1 p2 - fappExtraEntropy = lastMappendWith Ledger.appExtraEntropy p1 p2 - fappProtocolVersion = lastMappendWith Ledger.appProtocolVersion p1 p2 - fappMinPoolCost = lastMappendWith Ledger.appMinPoolCost p1 p2 - fappCoinsPerUTxOWord = lastMappendWith Ledger.appCoinsPerUTxOWord p1 p2 - fappCostModels = lastMappendWith Ledger.appCostModels p1 p2 - fappPrices = lastMappendWith Ledger.appPrices p1 p2 - fappMaxTxExUnits = lastMappendWith Ledger.appMaxTxExUnits p1 p2 - fappMaxBlockExUnits = lastMappendWith Ledger.appMaxBlockExUnits p1 p2 - fappMaxValSize = lastMappendWith Ledger.appMaxValSize p1 p2 + let fappMinFeeA = lastMappendWith Ledger.appMinFeeA p1 p2 + fappMinFeeB = lastMappendWith Ledger.appMinFeeB p1 p2 + fappMaxBBSize = lastMappendWith Ledger.appMaxBBSize p1 p2 + fappMaxTxSize = lastMappendWith Ledger.appMaxTxSize p1 p2 + fappMaxBHSize = lastMappendWith Ledger.appMaxBHSize p1 p2 + fappKeyDeposit = lastMappendWith Ledger.appKeyDeposit p1 p2 + fappPoolDeposit = lastMappendWith Ledger.appPoolDeposit p1 p2 + fappEMax = lastMappendWith Ledger.appEMax p1 p2 + fappNOpt = lastMappendWith Ledger.appNOpt p1 p2 + fappA0 = lastMappendWith Ledger.appA0 p1 p2 + fappRho = lastMappendWith Ledger.appRho p1 p2 + fappTau = lastMappendWith Ledger.appTau p1 p2 + fappD = lastMappendWith Ledger.appD p1 p2 + fappExtraEntropy = lastMappendWith Ledger.appExtraEntropy p1 p2 + fappProtocolVersion = lastMappendWith Ledger.appProtocolVersion p1 p2 + fappMinPoolCost = lastMappendWith Ledger.appMinPoolCost p1 p2 + fappCoinsPerUTxOWord = lastMappendWith Ledger.appCoinsPerUTxOWord p1 p2 + fappCostModels = lastMappendWith Ledger.appCostModels p1 p2 + fappPrices = lastMappendWith Ledger.appPrices p1 p2 + fappMaxTxExUnits = lastMappendWith Ledger.appMaxTxExUnits p1 p2 + fappMaxBlockExUnits = lastMappendWith Ledger.appMaxBlockExUnits p1 p2 + fappMaxValSize = lastMappendWith Ledger.appMaxValSize p1 p2 fappCollateralPercentage = lastMappendWith Ledger.appCollateralPercentage p1 p2 - fappMaxCollateralInputs = lastMappendWith Ledger.appMaxCollateralInputs p1 p2 + fappMaxCollateralInputs = lastMappendWith Ledger.appMaxCollateralInputs p1 p2 in Ledger.AlonzoPParams - { Ledger.appMinFeeA = fappMinFeeA - , Ledger.appMinFeeB = fappMinFeeB - , Ledger.appMaxBBSize = fappMaxBBSize - , Ledger.appMaxTxSize = fappMaxTxSize - , Ledger.appMaxBHSize = fappMaxBHSize - , Ledger.appKeyDeposit = fappKeyDeposit - , Ledger.appPoolDeposit = fappPoolDeposit - , Ledger.appEMax = fappEMax - , Ledger.appNOpt = fappNOpt - , Ledger.appA0 = fappA0 - , Ledger.appRho = fappRho - , Ledger.appTau = fappTau - , Ledger.appD = fappD - , Ledger.appExtraEntropy = fappExtraEntropy - , Ledger.appProtocolVersion = fappProtocolVersion - , Ledger.appMinPoolCost = fappMinPoolCost - , Ledger.appCoinsPerUTxOWord = fappCoinsPerUTxOWord - , Ledger.appCostModels = fappCostModels - , Ledger.appPrices = fappPrices - , Ledger.appMaxTxExUnits = fappMaxTxExUnits - , Ledger.appMaxBlockExUnits = fappMaxBlockExUnits - , Ledger.appMaxValSize = fappMaxValSize + { Ledger.appMinFeeA = fappMinFeeA + , Ledger.appMinFeeB = fappMinFeeB + , Ledger.appMaxBBSize = fappMaxBBSize + , Ledger.appMaxTxSize = fappMaxTxSize + , Ledger.appMaxBHSize = fappMaxBHSize + , Ledger.appKeyDeposit = fappKeyDeposit + , Ledger.appPoolDeposit = fappPoolDeposit + , Ledger.appEMax = fappEMax + , Ledger.appNOpt = fappNOpt + , Ledger.appA0 = fappA0 + , Ledger.appRho = fappRho + , Ledger.appTau = fappTau + , Ledger.appD = fappD + , Ledger.appExtraEntropy = fappExtraEntropy + , Ledger.appProtocolVersion = fappProtocolVersion + , Ledger.appMinPoolCost = fappMinPoolCost + , Ledger.appCoinsPerUTxOWord = fappCoinsPerUTxOWord + , Ledger.appCostModels = fappCostModels + , Ledger.appPrices = fappPrices + , Ledger.appMaxTxExUnits = fappMaxTxExUnits + , Ledger.appMaxBlockExUnits = fappMaxBlockExUnits + , Ledger.appMaxValSize = fappMaxValSize , Ledger.appCollateralPercentage = fappCollateralPercentage - , Ledger.appMaxCollateralInputs = fappMaxCollateralInputs + , Ledger.appMaxCollateralInputs = fappMaxCollateralInputs } -- We're not interested in trying to mappend the underlying `Maybe` types @@ -252,83 +252,83 @@ lastMappendWith l = under2 l lastMappend instance Semigroup (Ledger.BabbagePParams StrictMaybe era) where (<>) p1 p2 = - let fbppMinFeeA = lastMappendWith Ledger.bppMinFeeA p1 p2 - fbppMinFeeB = lastMappendWith Ledger.bppMinFeeB p1 p2 - fbppMaxBBSize = lastMappendWith Ledger.bppMaxBBSize p1 p2 - fbppMaxTxSize = lastMappendWith Ledger.bppMaxTxSize p1 p2 - fbppMaxBHSize = lastMappendWith Ledger.bppMaxBHSize p1 p2 - fbppKeyDeposit = lastMappendWith Ledger.bppKeyDeposit p1 p2 - fbppPoolDeposit = lastMappendWith Ledger.bppPoolDeposit p1 p2 - fbppEMax = lastMappendWith Ledger.bppEMax p1 p2 - fbppNOpt = lastMappendWith Ledger.bppNOpt p1 p2 - fbppA0 = lastMappendWith Ledger.bppA0 p1 p2 - fbppRho = lastMappendWith Ledger.bppRho p1 p2 - fbppTau = lastMappendWith Ledger.bppTau p1 p2 - fbppProtocolVersion = lastMappendWith Ledger.bppProtocolVersion p1 p2 - fbppMinPoolCost = lastMappendWith Ledger.bppMinPoolCost p1 p2 - fbppCoinsPerUTxOByte = lastMappendWith Ledger.bppCoinsPerUTxOByte p1 p2 - fbppCostModels = lastMappendWith Ledger.bppCostModels p1 p2 - fbppPrices = lastMappendWith Ledger.bppPrices p1 p2 - fbppMaxTxExUnits = lastMappendWith Ledger.bppMaxTxExUnits p1 p2 - fbppMaxBlockExUnits = lastMappendWith Ledger.bppMaxBlockExUnits p1 p2 - fbppMaxValSize = lastMappendWith Ledger.bppMaxValSize p1 p2 + let fbppMinFeeA = lastMappendWith Ledger.bppMinFeeA p1 p2 + fbppMinFeeB = lastMappendWith Ledger.bppMinFeeB p1 p2 + fbppMaxBBSize = lastMappendWith Ledger.bppMaxBBSize p1 p2 + fbppMaxTxSize = lastMappendWith Ledger.bppMaxTxSize p1 p2 + fbppMaxBHSize = lastMappendWith Ledger.bppMaxBHSize p1 p2 + fbppKeyDeposit = lastMappendWith Ledger.bppKeyDeposit p1 p2 + fbppPoolDeposit = lastMappendWith Ledger.bppPoolDeposit p1 p2 + fbppEMax = lastMappendWith Ledger.bppEMax p1 p2 + fbppNOpt = lastMappendWith Ledger.bppNOpt p1 p2 + fbppA0 = lastMappendWith Ledger.bppA0 p1 p2 + fbppRho = lastMappendWith Ledger.bppRho p1 p2 + fbppTau = lastMappendWith Ledger.bppTau p1 p2 + fbppProtocolVersion = lastMappendWith Ledger.bppProtocolVersion p1 p2 + fbppMinPoolCost = lastMappendWith Ledger.bppMinPoolCost p1 p2 + fbppCoinsPerUTxOByte = lastMappendWith Ledger.bppCoinsPerUTxOByte p1 p2 + fbppCostModels = lastMappendWith Ledger.bppCostModels p1 p2 + fbppPrices = lastMappendWith Ledger.bppPrices p1 p2 + fbppMaxTxExUnits = lastMappendWith Ledger.bppMaxTxExUnits p1 p2 + fbppMaxBlockExUnits = lastMappendWith Ledger.bppMaxBlockExUnits p1 p2 + fbppMaxValSize = lastMappendWith Ledger.bppMaxValSize p1 p2 fbppCollateralPercentage = lastMappendWith Ledger.bppCollateralPercentage p1 p2 - fbppMaxCollateralInputs = lastMappendWith Ledger.bppMaxCollateralInputs p1 p2 + fbppMaxCollateralInputs = lastMappendWith Ledger.bppMaxCollateralInputs p1 p2 in Ledger.BabbagePParams - { Ledger.bppMinFeeA = fbppMinFeeA - , Ledger.bppMinFeeB = fbppMinFeeB - , Ledger.bppMaxBBSize = fbppMaxBBSize - , Ledger.bppMaxTxSize = fbppMaxTxSize - , Ledger.bppMaxBHSize = fbppMaxBHSize - , Ledger.bppKeyDeposit = fbppKeyDeposit - , Ledger.bppPoolDeposit = fbppPoolDeposit - , Ledger.bppEMax = fbppEMax - , Ledger.bppNOpt = fbppNOpt - , Ledger.bppA0 = fbppA0 - , Ledger.bppRho = fbppRho - , Ledger.bppTau = fbppTau - , Ledger.bppProtocolVersion = fbppProtocolVersion - , Ledger.bppMinPoolCost = fbppMinPoolCost - , Ledger.bppCoinsPerUTxOByte = fbppCoinsPerUTxOByte - , Ledger.bppCostModels = fbppCostModels - , Ledger.bppPrices = fbppPrices - , Ledger.bppMaxTxExUnits = fbppMaxTxExUnits - , Ledger.bppMaxBlockExUnits = fbppMaxBlockExUnits - , Ledger.bppMaxValSize = fbppMaxValSize + { Ledger.bppMinFeeA = fbppMinFeeA + , Ledger.bppMinFeeB = fbppMinFeeB + , Ledger.bppMaxBBSize = fbppMaxBBSize + , Ledger.bppMaxTxSize = fbppMaxTxSize + , Ledger.bppMaxBHSize = fbppMaxBHSize + , Ledger.bppKeyDeposit = fbppKeyDeposit + , Ledger.bppPoolDeposit = fbppPoolDeposit + , Ledger.bppEMax = fbppEMax + , Ledger.bppNOpt = fbppNOpt + , Ledger.bppA0 = fbppA0 + , Ledger.bppRho = fbppRho + , Ledger.bppTau = fbppTau + , Ledger.bppProtocolVersion = fbppProtocolVersion + , Ledger.bppMinPoolCost = fbppMinPoolCost + , Ledger.bppCoinsPerUTxOByte = fbppCoinsPerUTxOByte + , Ledger.bppCostModels = fbppCostModels + , Ledger.bppPrices = fbppPrices + , Ledger.bppMaxTxExUnits = fbppMaxTxExUnits + , Ledger.bppMaxBlockExUnits = fbppMaxBlockExUnits + , Ledger.bppMaxValSize = fbppMaxValSize , Ledger.bppCollateralPercentage = fbppCollateralPercentage - , Ledger.bppMaxCollateralInputs = fbppMaxCollateralInputs + , Ledger.bppMaxCollateralInputs = fbppMaxCollateralInputs } instance Semigroup (Ledger.ConwayPParams StrictMaybe era) where (<>) p1 p2 = Ledger.ConwayPParams - { Ledger.cppMinFeeA = lastMappendWith Ledger.cppMinFeeA p1 p2 - , Ledger.cppMinFeeB = lastMappendWith Ledger.cppMinFeeB p1 p2 - , Ledger.cppMaxBBSize = lastMappendWith Ledger.cppMaxBBSize p1 p2 - , Ledger.cppMaxTxSize = lastMappendWith Ledger.cppMaxTxSize p1 p2 - , Ledger.cppMaxBHSize = lastMappendWith Ledger.cppMaxBHSize p1 p2 - , Ledger.cppKeyDeposit = lastMappendWith Ledger.cppKeyDeposit p1 p2 - , Ledger.cppPoolDeposit = lastMappendWith Ledger.cppPoolDeposit p1 p2 - , Ledger.cppEMax = lastMappendWith Ledger.cppEMax p1 p2 - , Ledger.cppNOpt = lastMappendWith Ledger.cppNOpt p1 p2 - , Ledger.cppA0 = lastMappendWith Ledger.cppA0 p1 p2 - , Ledger.cppRho = lastMappendWith Ledger.cppRho p1 p2 - , Ledger.cppTau = lastMappendWith Ledger.cppTau p1 p2 - , Ledger.cppProtocolVersion = lastMappendWith Ledger.cppProtocolVersion p1 p2 - , Ledger.cppMinPoolCost = lastMappendWith Ledger.cppMinPoolCost p1 p2 - , Ledger.cppCoinsPerUTxOByte = lastMappendWith Ledger.cppCoinsPerUTxOByte p1 p2 - , Ledger.cppCostModels = lastMappendWith Ledger.cppCostModels p1 p2 - , Ledger.cppPrices = lastMappendWith Ledger.cppPrices p1 p2 - , Ledger.cppMaxTxExUnits = lastMappendWith Ledger.cppMaxTxExUnits p1 p2 - , Ledger.cppMaxBlockExUnits = lastMappendWith Ledger.cppMaxBlockExUnits p1 p2 - , Ledger.cppMaxValSize = lastMappendWith Ledger.cppMaxValSize p1 p2 - , Ledger.cppCollateralPercentage = lastMappendWith Ledger.cppCollateralPercentage p1 p2 - , Ledger.cppMaxCollateralInputs = lastMappendWith Ledger.cppMaxCollateralInputs p1 p2 - , Ledger.cppPoolVotingThresholds = lastMappendWith Ledger.cppPoolVotingThresholds p1 p2 - , Ledger.cppDRepVotingThresholds = lastMappendWith Ledger.cppDRepVotingThresholds p1 p2 - , Ledger.cppCommitteeMinSize = lastMappendWith Ledger.cppCommitteeMinSize p1 p2 + { Ledger.cppMinFeeA = lastMappendWith Ledger.cppMinFeeA p1 p2 + , Ledger.cppMinFeeB = lastMappendWith Ledger.cppMinFeeB p1 p2 + , Ledger.cppMaxBBSize = lastMappendWith Ledger.cppMaxBBSize p1 p2 + , Ledger.cppMaxTxSize = lastMappendWith Ledger.cppMaxTxSize p1 p2 + , Ledger.cppMaxBHSize = lastMappendWith Ledger.cppMaxBHSize p1 p2 + , Ledger.cppKeyDeposit = lastMappendWith Ledger.cppKeyDeposit p1 p2 + , Ledger.cppPoolDeposit = lastMappendWith Ledger.cppPoolDeposit p1 p2 + , Ledger.cppEMax = lastMappendWith Ledger.cppEMax p1 p2 + , Ledger.cppNOpt = lastMappendWith Ledger.cppNOpt p1 p2 + , Ledger.cppA0 = lastMappendWith Ledger.cppA0 p1 p2 + , Ledger.cppRho = lastMappendWith Ledger.cppRho p1 p2 + , Ledger.cppTau = lastMappendWith Ledger.cppTau p1 p2 + , Ledger.cppProtocolVersion = lastMappendWith Ledger.cppProtocolVersion p1 p2 + , Ledger.cppMinPoolCost = lastMappendWith Ledger.cppMinPoolCost p1 p2 + , Ledger.cppCoinsPerUTxOByte = lastMappendWith Ledger.cppCoinsPerUTxOByte p1 p2 + , Ledger.cppCostModels = lastMappendWith Ledger.cppCostModels p1 p2 + , Ledger.cppPrices = lastMappendWith Ledger.cppPrices p1 p2 + , Ledger.cppMaxTxExUnits = lastMappendWith Ledger.cppMaxTxExUnits p1 p2 + , Ledger.cppMaxBlockExUnits = lastMappendWith Ledger.cppMaxBlockExUnits p1 p2 + , Ledger.cppMaxValSize = lastMappendWith Ledger.cppMaxValSize p1 p2 + , Ledger.cppCollateralPercentage = lastMappendWith Ledger.cppCollateralPercentage p1 p2 + , Ledger.cppMaxCollateralInputs = lastMappendWith Ledger.cppMaxCollateralInputs p1 p2 + , Ledger.cppPoolVotingThresholds = lastMappendWith Ledger.cppPoolVotingThresholds p1 p2 + , Ledger.cppDRepVotingThresholds = lastMappendWith Ledger.cppDRepVotingThresholds p1 p2 + , Ledger.cppCommitteeMinSize = lastMappendWith Ledger.cppCommitteeMinSize p1 p2 , Ledger.cppCommitteeMaxTermLength = lastMappendWith Ledger.cppCommitteeMaxTermLength p1 p2 - , Ledger.cppGovActionLifetime = lastMappendWith Ledger.cppGovActionLifetime p1 p2 - , Ledger.cppGovActionDeposit = lastMappendWith Ledger.cppGovActionDeposit p1 p2 - , Ledger.cppDRepDeposit = lastMappendWith Ledger.cppDRepDeposit p1 p2 - , Ledger.cppDRepActivity = lastMappendWith Ledger.cppDRepActivity p1 p2 + , Ledger.cppGovActionLifetime = lastMappendWith Ledger.cppGovActionLifetime p1 p2 + , Ledger.cppGovActionDeposit = lastMappendWith Ledger.cppGovActionDeposit p1 p2 + , Ledger.cppDRepDeposit = lastMappendWith Ledger.cppDRepDeposit p1 p2 + , Ledger.cppDRepActivity = lastMappendWith Ledger.cppDRepActivity p1 p2 }