Skip to content

Commit

Permalink
IntersectMBO/cardano-cli#288 Add support for conway era protocol para…
Browse files Browse the repository at this point in the history
…meters
  • Loading branch information
carbolymer committed Sep 20, 2023
1 parent 14d8475 commit d577266
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 207 deletions.
8 changes: 4 additions & 4 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ library internal
, 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.13
, prettyprinter
, prettyprinter-configurable ^>= 1.9
, prettyprinter-configurable ^>= 1.13
, random
, scientific
, serialise
Expand Down Expand Up @@ -342,8 +342,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.13
, plutus-ledger-api ^>= 1.13
, tasty
, tasty-hedgehog
, time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 Ouroboros.Consensus.Protocol.Abstract as Consensus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,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]
Expand Down Expand Up @@ -122,16 +118,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

Expand Down
Loading

0 comments on commit d577266

Please sign in to comment.