Skip to content

Commit

Permalink
Added SPO voting thresholds for security relevant parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Jan 18, 2024
1 parent 53a64c8 commit 0fde265
Show file tree
Hide file tree
Showing 15 changed files with 453 additions and 146 deletions.
1 change: 1 addition & 0 deletions eras/alonzo/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

### `testlib`

* Added `ShelleyEraImp` constraint to `emptyAlonzoImpNES`
* Rename `emptyAlonzoImpNES` to `initAlonzoImpNES`
* Remove `Test.Cardano.Ledger.Alonzo.CostModel` in favor of `Test.Cardano.Ledger.Plutus`
* Move `costModelParamsCount` to `Cardano.Ledger.Plutus.CostModels`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import Cardano.Crypto.Hash (Hash)
import Cardano.Ledger.Alonzo (AlonzoEra)
import Cardano.Ledger.Alonzo.PParams (AlonzoEraPParams, ppMaxValSizeL)
import Cardano.Ledger.Coin (Coin)
import Cardano.Ledger.Core (EraIndependentTxBody, EraTxOut)
import Cardano.Ledger.Core (EraIndependentTxBody)
import Cardano.Ledger.Crypto (Crypto (..))
import Cardano.Ledger.Shelley.Core (EraGov)
import Cardano.Ledger.Shelley.LedgerState (
NewEpochState,
StashedAVVMAddresses,
Expand All @@ -30,10 +29,9 @@ import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Shelley.ImpTest as ImpTest

initAlonzoImpNES ::
( EraGov era
, EraTxOut era
, AlonzoEraPParams era
( AlonzoEraPParams era
, Default (StashedAVVMAddresses era)
, ShelleyEraImp era
) =>
Coin ->
NewEpochState era
Expand Down
14 changes: 14 additions & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## 1.12.0.0

* Add `pvtPPSecurityGroup`
* Add lenses:
* `pvtCommitteeNormalL`
* `pvtCommitteeNoConfidenceL`
* `pvtPPSecurityGroupL`
* `dvtCommitteeNoConfidenceL`
* Add `PPGroups` and `StakePoolGroup`
* Add `ToStakePoolGroup` typeclass
* Add `DRepGroup` and `ToDRepGroup` typeclass
* Modify `THKD` replacing `PPGroup` with `PPGroups`
* Add `ConwayPlutusPurpose`
* Add `unGovActionIx`
* Add `foldlVotingProcedures`
Expand Down Expand Up @@ -50,6 +60,10 @@

### `testlib`

* Add `setupPoolWithStake`
* Add:
* `registerPool`
* `sendCoinTo` and `sendValueTo`
* Add `submitProposal_`
* Add `submitTreasuryWithdrawals`
* Remove `Test.Cardano.Ledger.Conway.PParamsSpec` and replace the unit test it contained
Expand Down
1 change: 1 addition & 0 deletions eras/conway/impl/cddl-files/conway.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ pool_voting_thresholds =
, unit_interval ; committee normal
, unit_interval ; committee no confidence
, unit_interval ; hard fork initiation
, unit_interval ; security relevant parameter voting threshold
]

drep_voting_thresholds =
Expand Down
17 changes: 14 additions & 3 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,11 @@ import Cardano.Ledger.Conway.Governance.Proposals (
)
import Cardano.Ledger.Conway.PParams (
ConwayEraPParams (..),
DRepGroup (..),
DRepVotingThresholds (..),
PPGroup (..),
PPGroups (..),
PoolVotingThresholds (..),
StakePoolGroup (..),
dvtPPEconomicGroupL,
dvtPPGovGroupL,
dvtPPNetworkGroupL,
Expand Down Expand Up @@ -677,7 +679,7 @@ pparamsUpdateThreshold pp ppu =
GovGroup -> dvtPPGovGroupL
TechnicalGroup -> dvtPPTechnicalGroupL
EconomicGroup -> dvtPPEconomicGroupL
lookupGroupThreshold grp =
lookupGroupThreshold (PPGroups grp _) =
pp ^. ppDRepVotingThresholdsL . thresholdLens grp
in Set.foldr' max minBound $
Set.map lookupGroupThreshold $
Expand Down Expand Up @@ -738,7 +740,16 @@ votingStakePoolThresholdInternal pp isElectedCommittee action =
{ pvtCommitteeNoConfidence
, pvtCommitteeNormal
, pvtHardForkInitiation
, pvtPPSecurityGroup
} = pp ^. ppPoolVotingThresholdsL
isSecurityRelevant (PPGroups _ s) =
case s of
SecurityGroup -> True
NoStakePoolGroup -> False
paramChangeThreshold ppu
| any isSecurityRelevant (modifiedPPGroups ppu) =
VotingThreshold pvtPPSecurityGroup
| otherwise = NoVotingAllowed
in case action of
NoConfidence {} -> VotingThreshold pvtCommitteeNoConfidence
UpdateCommittee {} ->
Expand All @@ -748,7 +759,7 @@ votingStakePoolThresholdInternal pp isElectedCommittee action =
else pvtCommitteeNoConfidence
NewConstitution {} -> NoVotingAllowed
HardForkInitiation {} -> VotingThreshold pvtHardForkInitiation
ParameterChange {} -> NoVotingAllowed
ParameterChange _ ppu _ -> paramChangeThreshold ppu
TreasuryWithdrawals {} -> NoVotingAllowed
InfoAction {} -> NoVotingThreshold

Expand Down
Loading

0 comments on commit 0fde265

Please sign in to comment.