Skip to content

Commit

Permalink
Merge pull request #3836 from input-output-hk/lehins/pparamsupdate-en…
Browse files Browse the repository at this point in the history
…actment-tests

PParamsUpdate enactment fix
  • Loading branch information
lehins authored Nov 3, 2023
2 parents 0533bfb + d1ed550 commit c9d2d53
Show file tree
Hide file tree
Showing 12 changed files with 541 additions and 337 deletions.
4 changes: 3 additions & 1 deletion eras/alonzo/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Version history for `cardano-ledger-alonzo`

## 1.5.1.0
## 1.6.0.0

* Swap the order of arguments for `updateCostModels`

### `testlib`

Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/cardano-ledger-alonzo.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: cardano-ledger-alonzo
version: 1.5.1.0
version: 1.6.0.0
license: Apache-2.0
maintainer: operations@iohk.io
author: IOHK
Expand Down
8 changes: 4 additions & 4 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Scripts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,13 @@ data CostModels = CostModels
emptyCostModels :: CostModels
emptyCostModels = CostModels mempty mempty mempty

-- | Updates the first @CostModels@ with the second one so that only the
-- cost models that are present in the second one get updated while all the
-- | Updates the second @CostModels@ with the first one so that only the
-- cost models that are present in the first one get updated while all the
-- others stay unchanged
updateCostModels :: CostModels -> CostModels -> CostModels
updateCostModels
(CostModels oldValid oldErrors oldUnk)
(CostModels newValid newErrors newUnk) =
(CostModels newValid newErrors newUnk)
(CostModels oldValid oldErrors oldUnk) =
CostModels
(Map.union newValid oldValid)
(Map.union newErrors oldErrors)
Expand Down
7 changes: 6 additions & 1 deletion eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Version history for `cardano-ledger-conway`

## 1.10.1.0
## 1.11.0.0

* Switch to using `OMap` for `ProposalsSnapshot` #3791
* Add `VotingOnExpiredGovAction` predicate failure in `GOV` #3825
* Rename `modifiedGroups` -> `modifiedPPGroups` and move into `ConwayEraPParams`
* Expose `pparamsUpdateThreshold`
* Fix [#3835](https://github.com/input-output-hk/cardano-ledger/issues/3835)
* Rename `PParamGroup` to `PPGroup` and `GovernanceGroup` to `GovGroup`
* Introduce `THKD` and use it for `ConwayPParams`

### `testlib`

Expand Down
2 changes: 1 addition & 1 deletion eras/conway/impl/cardano-ledger-conway.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ library
cardano-data >=1.1.2.0,
cardano-ledger-binary >=1.2,
cardano-ledger-allegra >=1.1,
cardano-ledger-alonzo ^>=1.5,
cardano-ledger-alonzo ^>=1.6,
cardano-ledger-babbage >=1.4.1,
cardano-ledger-core ^>=1.8,
cardano-ledger-mary >=1.1,
Expand Down
12 changes: 7 additions & 5 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ module Cardano.Ledger.Conway.Governance (
psDRepDistrL,
psDRepStateL,
RunConwayRatify (..),

-- * Exported for testing
pparamsUpdateThreshold,
) where

import Cardano.Ledger.BaseTypes (
Expand Down Expand Up @@ -186,11 +189,10 @@ import Cardano.Ledger.Conway.Governance.Snapshots (
snapshotRemoveIds,
)
import Cardano.Ledger.Conway.PParams (
ConwayEraPParams,
ConwayEraPParams (..),
DRepVotingThresholds (..),
PParamGroup (..),
PPGroup (..),
PoolVotingThresholds (..),
modifiedGroups,
ppCommitteeMinSizeL,
ppDRepVotingThresholdsL,
ppPoolVotingThresholdsL,
Expand Down Expand Up @@ -688,14 +690,14 @@ pparamsUpdateThreshold ::
pparamsUpdateThreshold pp ppu =
let thresholdLens = \case
NetworkGroup -> dvtPPNetworkGroupL
GovernanceGroup -> dvtPPGovGroupL
GovGroup -> dvtPPGovGroupL
TechnicalGroup -> dvtPPTechnicalGroupL
EconomicGroup -> dvtPPEconomicGroupL
lookupGroupThreshold grp =
pp ^. ppDRepVotingThresholdsL . thresholdLens grp
in Set.foldr' max minBound $
Set.map lookupGroupThreshold $
modifiedGroups @era ppu
modifiedPPGroups @era ppu

data VotingThreshold
= -- | This is the actual threshold. It is lazy, because upon proposal we only care if
Expand Down
Loading

0 comments on commit c9d2d53

Please sign in to comment.