From 67af5b3780fca08f6804cc86eb4635e0fff803eb Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 18 Jun 2024 12:00:33 +0200 Subject: [PATCH] Update to use consensus' PoolDistr --- cardano-api/internal/Cardano/Api/Query.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Query.hs b/cardano-api/internal/Cardano/Api/Query.hs index 4fa03c05e0..abfeb48fc7 100644 --- a/cardano-api/internal/Cardano/Api/Query.hs +++ b/cardano-api/internal/Cardano/Api/Query.hs @@ -122,6 +122,7 @@ import qualified Ouroboros.Consensus.HardFork.History.Qry as Qry import qualified Ouroboros.Consensus.Ledger.Query as Consensus import qualified Ouroboros.Consensus.Protocol.Abstract as Consensus import qualified Ouroboros.Consensus.Shelley.Ledger as Consensus +import qualified Ouroboros.Consensus.Shelley.Ledger.Query.Types as Consensus import Ouroboros.Network.Block (Serialised (..)) import Ouroboros.Network.NodeToClient.Version (NodeToClientVersion (..)) import Ouroboros.Network.Protocol.LocalStateQuery.Client (Some (..)) @@ -461,7 +462,7 @@ decodePoolState (SerialisedPoolState (Serialised ls)) = PoolState <$> decodeFull (Core.eraProtVerLow @(ShelleyLedgerEra era)) ls newtype SerialisedPoolDistribution era - = SerialisedPoolDistribution (Serialised (Shelley.PoolDistr (Core.EraCrypto (ShelleyLedgerEra era)))) + = SerialisedPoolDistribution (Serialised (Consensus.PoolDistr (Core.EraCrypto (ShelleyLedgerEra era)))) newtype PoolDistribution era = PoolDistribution { unPoolDistr :: Shelley.PoolDistr (Core.EraCrypto (ShelleyLedgerEra era)) @@ -524,15 +525,15 @@ fromLedgerUTxO sbe (Shelley.UTxO utxo) = . Map.toList $ utxo -fromShelleyPoolDistr :: Shelley.PoolDistr StandardCrypto +fromShelleyPoolDistr :: Consensus.PoolDistr StandardCrypto -> Map (Hash StakePoolKey) Rational fromShelleyPoolDistr = --TODO: write an appropriate property to show it is safe to use -- Map.fromListAsc or to use Map.mapKeysMonotonic Map.fromList - . map (bimap StakePoolKeyHash Shelley.individualPoolStake) + . map (bimap StakePoolKeyHash Consensus.individualPoolStake) . Map.toList - . Shelley.unPoolDistr + . Consensus.unPoolDistr fromShelleyDelegations :: Map (Shelley.Credential Shelley.Staking StandardCrypto) (Shelley.KeyHash Shelley.StakePool StandardCrypto)