From c8fb01ca6edef1f1afbbb171c593a44df5ccf07b Mon Sep 17 00:00:00 2001 From: Thomas Winant Date: Mon, 24 Aug 2020 15:23:30 +0200 Subject: [PATCH] LedgerSupportsPeerSelection: return peers registered in ledger state Fixes #2535. --- .../Consensus/Byron/Ledger/Ledger.hs | 4 + .../Ouroboros/Consensus/Mock/Ledger/Block.hs | 4 + .../ouroboros-consensus-shelley.cabal | 1 + .../src/Ouroboros/Consensus/Shelley/Ledger.hs | 1 + .../Consensus/Shelley/Ledger/PeerSelection.hs | 80 +++++++++++++++++++ .../Test/Consensus/HardFork/Combinator/A.hs | 4 + .../Test/Consensus/HardFork/Combinator/B.hs | 4 + ouroboros-consensus/ouroboros-consensus.cabal | 2 + .../Consensus/HardFork/Combinator.hs | 4 + .../Combinator/Abstract/SingleEraBlock.hs | 2 + .../Combinator/Ledger/PeerSelection.hs | 18 +++++ .../Consensus/HardFork/Combinator/Node.hs | 1 + .../src/Ouroboros/Consensus/Ledger/Dual.hs | 10 +++ .../Consensus/Ledger/SupportsPeerSelection.hs | 27 +++++++ .../src/Ouroboros/Consensus/Node/Run.hs | 2 + .../src/Ouroboros/Consensus/NodeKernel.hs | 19 +++++ .../Network/PeerSelection/RootPeersDNS.hs | 3 + 17 files changed, 186 insertions(+) create mode 100644 ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/PeerSelection.hs create mode 100644 ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Ledger/PeerSelection.hs create mode 100644 ouroboros-consensus/src/Ouroboros/Consensus/Ledger/SupportsPeerSelection.hs diff --git a/ouroboros-consensus-byron/src/Ouroboros/Consensus/Byron/Ledger/Ledger.hs b/ouroboros-consensus-byron/src/Ouroboros/Consensus/Byron/Ledger/Ledger.hs index fa9735f0151..e453b50e812 100644 --- a/ouroboros-consensus-byron/src/Ouroboros/Consensus/Byron/Ledger/Ledger.hs +++ b/ouroboros-consensus-byron/src/Ouroboros/Consensus/Byron/Ledger/Ledger.hs @@ -75,6 +75,7 @@ import Ouroboros.Consensus.Ledger.Abstract import Ouroboros.Consensus.Ledger.CommonProtocolParams import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.Query +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Protocol.PBFT import Ouroboros.Consensus.Util (ShowProxy (..)) @@ -212,6 +213,9 @@ instance ShowQuery (Query ByronBlock) where instance ShowProxy (Query ByronBlock) where +instance LedgerSupportsPeerSelection ByronBlock where + getPeers = const [] + instance CommonProtocolParams ByronBlock where maxHeaderSize = fromIntegral . Update.ppMaxHeaderSize . getProtocolParameters maxTxSize = fromIntegral . Update.ppMaxTxSize . getProtocolParameters diff --git a/ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs b/ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs index 9acbe45f518..5aba94cc97d 100644 --- a/ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs +++ b/ouroboros-consensus-mock/src/Ouroboros/Consensus/Mock/Ledger/Block.hs @@ -91,6 +91,7 @@ import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.Inspect import Ouroboros.Consensus.Ledger.Query import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Mock.Ledger.Address import Ouroboros.Consensus.Mock.Ledger.State import qualified Ouroboros.Consensus.Mock.Ledger.UTxO as Mock @@ -403,6 +404,9 @@ instance MockProtocolSpecific c ext => CommonProtocolParams (SimpleBlock c ext) maxHeaderSize = const 2000000 maxTxSize = const 2000000 +instance LedgerSupportsPeerSelection (SimpleBlock c ext) where + getPeers = const [] + {------------------------------------------------------------------------------- Support for the mempool -------------------------------------------------------------------------------} diff --git a/ouroboros-consensus-shelley/ouroboros-consensus-shelley.cabal b/ouroboros-consensus-shelley/ouroboros-consensus-shelley.cabal index c0d7bc262b1..510387e6462 100644 --- a/ouroboros-consensus-shelley/ouroboros-consensus-shelley.cabal +++ b/ouroboros-consensus-shelley/ouroboros-consensus-shelley.cabal @@ -37,6 +37,7 @@ library Ouroboros.Consensus.Shelley.Ledger.Mempool Ouroboros.Consensus.Shelley.Ledger.NetworkProtocolVersion Ouroboros.Consensus.Shelley.Ledger.Query + Ouroboros.Consensus.Shelley.Ledger.PeerSelection Ouroboros.Consensus.Shelley.Ledger.TPraos Ouroboros.Consensus.Shelley.Node Ouroboros.Consensus.Shelley.Node.Serialisation diff --git a/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger.hs b/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger.hs index 0b0bc75a45f..4677ed31b55 100644 --- a/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger.hs +++ b/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger.hs @@ -9,4 +9,5 @@ import Ouroboros.Consensus.Shelley.Ledger.Integrity as X import Ouroboros.Consensus.Shelley.Ledger.Ledger as X import Ouroboros.Consensus.Shelley.Ledger.Mempool as X import Ouroboros.Consensus.Shelley.Ledger.NetworkProtocolVersion as X +import Ouroboros.Consensus.Shelley.Ledger.PeerSelection as X () import Ouroboros.Consensus.Shelley.Ledger.Query as X diff --git a/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/PeerSelection.hs b/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/PeerSelection.hs new file mode 100644 index 00000000000..f58969eefbd --- /dev/null +++ b/ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/PeerSelection.hs @@ -0,0 +1,80 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} + +{-# OPTIONS_GHC -Wno-orphans #-} +module Ouroboros.Consensus.Shelley.Ledger.PeerSelection () where + +import Data.Bifunctor (second) +import Data.Foldable (toList) +import Data.List (sortOn) +import Data.List.NonEmpty (NonEmpty) +import qualified Data.List.NonEmpty as NE +import Data.Map.Strict (Map) +import qualified Data.Map.Strict as Map +import Data.Maybe (catMaybes) +import Data.Ord (Down (..)) + +import Ouroboros.Consensus.Ledger.SupportsPeerSelection + +import qualified Shelley.Spec.Ledger.Delegation.Certificates as SL +import qualified Shelley.Spec.Ledger.Keys as SL +import qualified Shelley.Spec.Ledger.LedgerState as SL +import qualified Shelley.Spec.Ledger.TxBody as SL + +import Ouroboros.Consensus.Shelley.Eras (EraCrypto) +import Ouroboros.Consensus.Shelley.Ledger.Block +import Ouroboros.Consensus.Shelley.Ledger.Ledger + +instance LedgerSupportsPeerSelection (ShelleyBlock era) where + getPeers ShelleyLedgerState { shelleyLedgerState } = catMaybes + [ (poolStake,) <$> Map.lookup stakePool poolDomainAddresses + | (stakePool, poolStake) <- orderByStake poolDistr + ] + where + poolDistr :: SL.PoolDistr (EraCrypto era) + poolDistr = SL.nesPd shelleyLedgerState + + -- | Sort stake pools by descending stake + orderByStake :: + SL.PoolDistr (EraCrypto era) + -> [(SL.KeyHash 'SL.StakePool (EraCrypto era), PoolStake)] + orderByStake = + sortOn (Down . snd) + . map (second SL.individualPoolStake) + . Map.toList + . SL.unPoolDistr + + futurePoolParams, poolParams :: + Map (SL.KeyHash 'SL.StakePool (EraCrypto era)) (SL.PoolParams era) + (futurePoolParams, poolParams) = + (SL._fPParams pstate, SL._pParams pstate) + where + pstate :: SL.PState era + pstate = + SL._pstate + . SL._delegationState + . SL.esLState + . SL.nesEs + $ shelleyLedgerState + + relayToDomainAddress :: SL.StakePoolRelay -> DomainAddress + relayToDomainAddress = undefined + + -- | Note that a stake pool can have multiple registered relays + pparamsDomainAddresses :: + SL.PoolParams era + -> Maybe (NonEmpty DomainAddress) + pparamsDomainAddresses = + NE.nonEmpty . map relayToDomainAddress . toList . SL._poolRelays + + -- | Combine the stake pools registered in the future and the current pool + -- parameters, and remove duplicates. + poolDomainAddresses :: + Map (SL.KeyHash 'SL.StakePool (EraCrypto era)) (NonEmpty DomainAddress) + poolDomainAddresses = + Map.unionWith + (\futureRelays currentRelays -> NE.nub (futureRelays <> currentRelays)) + (Map.mapMaybe pparamsDomainAddresses futurePoolParams) + (Map.mapMaybe pparamsDomainAddresses poolParams) diff --git a/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/A.hs b/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/A.hs index fe0709e9e10..1bf99d8ebb2 100644 --- a/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/A.hs +++ b/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/A.hs @@ -78,6 +78,7 @@ import Ouroboros.Consensus.Ledger.CommonProtocolParams import Ouroboros.Consensus.Ledger.Inspect import Ouroboros.Consensus.Ledger.Query import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Node.InitStorage import Ouroboros.Consensus.Node.NetworkProtocolVersion @@ -373,6 +374,9 @@ instance HasNestedContent Header BlockA where instance ReconstructNestedCtxt Header BlockA -- Use defaults +instance LedgerSupportsPeerSelection BlockA where + getPeers = const [] + data UpdateA = ProposalSubmitted | ProposalStable diff --git a/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/B.hs b/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/B.hs index d216d8c2b54..7ed3b883810 100644 --- a/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/B.hs +++ b/ouroboros-consensus-test/test-consensus/Test/Consensus/HardFork/Combinator/B.hs @@ -66,6 +66,7 @@ import Ouroboros.Consensus.Ledger.CommonProtocolParams import Ouroboros.Consensus.Ledger.Inspect import Ouroboros.Consensus.Ledger.Query import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Node.InitStorage import Ouroboros.Consensus.Node.NetworkProtocolVersion @@ -320,6 +321,9 @@ instance ReconstructNestedCtxt Header BlockB instance InspectLedger BlockB where -- Use defaults +instance LedgerSupportsPeerSelection BlockB where + getPeers = const [] + instance NodeInitStorage BlockB where nodeCheckIntegrity _ _ = True diff --git a/ouroboros-consensus/ouroboros-consensus.cabal b/ouroboros-consensus/ouroboros-consensus.cabal index 2735990e516..69cf4adbfe0 100644 --- a/ouroboros-consensus/ouroboros-consensus.cabal +++ b/ouroboros-consensus/ouroboros-consensus.cabal @@ -70,6 +70,7 @@ library Ouroboros.Consensus.HardFork.Combinator.InjectTxs Ouroboros.Consensus.HardFork.Combinator.Ledger Ouroboros.Consensus.HardFork.Combinator.Ledger.CommonProtocolParams + Ouroboros.Consensus.HardFork.Combinator.Ledger.PeerSelection Ouroboros.Consensus.HardFork.Combinator.Ledger.Query Ouroboros.Consensus.HardFork.Combinator.Mempool Ouroboros.Consensus.HardFork.Combinator.Nary @@ -113,6 +114,7 @@ library Ouroboros.Consensus.Ledger.Inspect Ouroboros.Consensus.Ledger.Query Ouroboros.Consensus.Ledger.SupportsMempool + Ouroboros.Consensus.Ledger.SupportsPeerSelection Ouroboros.Consensus.Ledger.SupportsProtocol Ouroboros.Consensus.Mempool Ouroboros.Consensus.Mempool.API diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator.hs b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator.hs index 3ffdd0ff2d7..8eb821f5a04 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator.hs @@ -36,6 +36,10 @@ import Ouroboros.Consensus.HardFork.Combinator.Protocol as X import Ouroboros.Consensus.HardFork.Combinator.Ledger.CommonProtocolParams as X () +-- Instance for 'LedgerSupportsPeerSelection' +import Ouroboros.Consensus.HardFork.Combinator.Ledger.PeerSelection as X + () + -- Instances for 'ShowQuery' and 'QueryLedger' -- Definition of 'Query', required for serialisation code import Ouroboros.Consensus.HardFork.Combinator.Ledger.Query as X diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Abstract/SingleEraBlock.hs b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Abstract/SingleEraBlock.hs index 8973be9d251..7b9b763ad5d 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Abstract/SingleEraBlock.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Abstract/SingleEraBlock.hs @@ -35,6 +35,7 @@ import Ouroboros.Consensus.Ledger.CommonProtocolParams import Ouroboros.Consensus.Ledger.Inspect import Ouroboros.Consensus.Ledger.Query import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Node.InitStorage import Ouroboros.Consensus.Storage.Serialisation @@ -60,6 +61,7 @@ class ( LedgerSupportsProtocol blk , ConvertRawHash blk , ReconstructNestedCtxt Header blk , CommonProtocolParams blk + , LedgerSupportsPeerSelection blk , ConfigSupportsNode blk , NodeInitStorage blk -- Instances required to support testing diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Ledger/PeerSelection.hs b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Ledger/PeerSelection.hs new file mode 100644 index 00000000000..d95591f384a --- /dev/null +++ b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Ledger/PeerSelection.hs @@ -0,0 +1,18 @@ +{-# OPTIONS_GHC -Wno-orphans #-} +module Ouroboros.Consensus.HardFork.Combinator.Ledger.PeerSelection () where + +import Data.SOP.Strict + +import Ouroboros.Consensus.Ledger.SupportsPeerSelection + +import Ouroboros.Consensus.HardFork.Combinator.Abstract +import Ouroboros.Consensus.HardFork.Combinator.Basics +import Ouroboros.Consensus.HardFork.Combinator.Ledger () +import qualified Ouroboros.Consensus.HardFork.Combinator.State as State + +instance CanHardFork xs => LedgerSupportsPeerSelection (HardForkBlock xs) where + getPeers = + hcollapse + . hcmap proxySingle (K . getPeers) + . State.tip + . hardForkLedgerStatePerEra diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Node.hs b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Node.hs index 6f96f1148a4..6ab428b856e 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Node.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Node.hs @@ -21,6 +21,7 @@ import Ouroboros.Consensus.HardFork.Combinator.Basics import Ouroboros.Consensus.HardFork.Combinator.Forging () import Ouroboros.Consensus.HardFork.Combinator.Ledger.CommonProtocolParams () +import Ouroboros.Consensus.HardFork.Combinator.Ledger.PeerSelection () import Ouroboros.Consensus.HardFork.Combinator.Node.InitStorage () import Ouroboros.Consensus.HardFork.Combinator.Serialisation diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/Dual.hs b/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/Dual.hs index ccb2cea4ed9..356f7cb9b49 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/Dual.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/Dual.hs @@ -82,6 +82,7 @@ import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.Inspect import Ouroboros.Consensus.Ledger.Query import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Util (ShowProxy (..)) import Ouroboros.Consensus.Util.Condense @@ -694,6 +695,15 @@ instance InspectLedger m => InspectLedger (DualBlock m a) where (dualLedgerStateMain before) (dualLedgerStateMain after) + +{------------------------------------------------------------------------------- + PeerSelection +-------------------------------------------------------------------------------} + +instance LedgerSupportsPeerSelection m + => LedgerSupportsPeerSelection (DualBlock m a) where + getPeers = getPeers . dualLedgerStateMain + {------------------------------------------------------------------------------- Forging -------------------------------------------------------------------------------} diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/SupportsPeerSelection.hs b/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/SupportsPeerSelection.hs new file mode 100644 index 00000000000..0fd31f55d81 --- /dev/null +++ b/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/SupportsPeerSelection.hs @@ -0,0 +1,27 @@ +module Ouroboros.Consensus.Ledger.SupportsPeerSelection ( + LedgerSupportsPeerSelection (..) + , PoolStake + -- * Re-exports for convenience + , DomainAddress (..) + , Domain + , PortNumber + ) where + +import Data.List.NonEmpty (NonEmpty) + +import Ouroboros.Network.PeerSelection.RootPeersDNS (Domain, + DomainAddress (..), PortNumber) + +import Ouroboros.Consensus.Ledger.Abstract (LedgerState) + +-- | The relative stake of the stakepool. A value in the [0, 1] range. +type PoolStake = Rational + +class LedgerSupportsPeerSelection blk where + -- | Return peers registered in the ledger ordered by descending 'PoolStake'. + -- + -- For example, for Shelley, the relays that have been registered in the + -- ledger for the respective stake pools will be returned. + -- + -- Ledgers/blocks that don't support staking can return an empty list. + getPeers :: LedgerState blk -> [(PoolStake, NonEmpty DomainAddress)] diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/Node/Run.hs b/ouroboros-consensus/src/Ouroboros/Consensus/Node/Run.hs index f92a7761132..9b306eb6093 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/Node/Run.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/Node/Run.hs @@ -26,6 +26,7 @@ import Ouroboros.Consensus.Ledger.CommonProtocolParams import Ouroboros.Consensus.Ledger.Inspect import Ouroboros.Consensus.Ledger.Query import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Node.InitStorage import Ouroboros.Consensus.Node.NetworkProtocolVersion @@ -86,6 +87,7 @@ class ( LedgerSupportsProtocol blk , SerialiseDiskConstraints blk , SerialiseNodeToNodeConstraints blk , SerialiseNodeToClientConstraints blk + , LedgerSupportsPeerSelection blk , NodeInitStorage blk , Show (CannotForge blk) , Show (ForgeStateInfo blk) diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/NodeKernel.hs b/ouroboros-consensus/src/Ouroboros/Consensus/NodeKernel.hs index 85c601540d2..6862f7c99ff 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/NodeKernel.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/NodeKernel.hs @@ -20,11 +20,13 @@ module Ouroboros.Consensus.NodeKernel ( , initNodeKernel , getMempoolReader , getMempoolWriter + , getPeersFromCurrentLedger ) where import Control.Monad import Control.Monad.Except import Data.Hashable (Hashable) +import Data.List.NonEmpty (NonEmpty) import Data.Map.Strict (Map) import Data.Maybe (isJust) import Data.Proxy @@ -56,6 +58,7 @@ import Ouroboros.Consensus.HeaderValidation import Ouroboros.Consensus.Ledger.Abstract import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Ledger.SupportsPeerSelection import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Mempool import Ouroboros.Consensus.Node.Run @@ -652,3 +655,19 @@ getMempoolWriter mempool = Inbound.TxSubmissionMempoolWriter map (txId . fst) . filter (isMempoolTxAdded . snd) <$> addTxs mempool txs } + +{------------------------------------------------------------------------------- + PeerSelection integration +-------------------------------------------------------------------------------} + +-- | Retrieve the peers registered in the current chain/ledger state by +-- descending stake. +-- +-- For example, for Shelley, this will return the stake pool relays ordered by +-- descending stake. +getPeersFromCurrentLedger :: + (IOLike m, LedgerSupportsPeerSelection blk) + => NodeKernel m remotePeer localPeer blk + -> STM m [(PoolStake, NonEmpty DomainAddress)] +getPeersFromCurrentLedger kernel = + getPeers . ledgerState <$> ChainDB.getCurrentLedger (getChainDB kernel) diff --git a/ouroboros-network/src/Ouroboros/Network/PeerSelection/RootPeersDNS.hs b/ouroboros-network/src/Ouroboros/Network/PeerSelection/RootPeersDNS.hs index ae418ce58cb..4195c60a930 100644 --- a/ouroboros-network/src/Ouroboros/Network/PeerSelection/RootPeersDNS.hs +++ b/ouroboros-network/src/Ouroboros/Network/PeerSelection/RootPeersDNS.hs @@ -24,6 +24,9 @@ module Ouroboros.Network.PeerSelection.RootPeersDNS ( DNS.Domain, DNS.TTL, IPv4, + + -- * Socket type re-exports + Socket.PortNumber, ) where import Data.Word (Word32)