Skip to content

Commit

Permalink
stylish
Browse files Browse the repository at this point in the history
  • Loading branch information
bolt12 committed Sep 18, 2023
1 parent 2c88c86 commit c7e9e85
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import Ouroboros.Network.Handshake.Acceptable (Accept (..),
Acceptable (..))
import Ouroboros.Network.Handshake.Queryable (Queryable (..))
import Ouroboros.Network.Magic
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..), combinePeerSharing)
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..),
combinePeerSharing)


-- | Enumeration of node to node protocol versions.
Expand Down Expand Up @@ -114,10 +115,10 @@ data DiffusionMode
-- | Version data for NodeToNode protocol
--
data NodeToNodeVersionData = NodeToNodeVersionData
{ networkMagic :: !NetworkMagic
, diffusionMode :: !DiffusionMode
, peerSharing :: !PeerSharing
, query :: !Bool
{ networkMagic :: !NetworkMagic
, diffusionMode :: !DiffusionMode
, peerSharing :: !PeerSharing
, query :: !Bool
}
deriving (Show, Typeable, Eq)
-- 'Eq' instance is not provided, it is not what we need in version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ import qualified Ouroboros.Network.ConnectionManager.Types as CM
import Ouroboros.Network.InboundGovernor.Event
(NewConnectionInfo (..))
import Ouroboros.Network.MuxMode
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)
import Ouroboros.Network.Server.RateLimiting
(AcceptedConnectionsLimit (..))
import Ouroboros.Network.Snocket
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)


-- | Arguments for a 'ConnectionManager' which are independent of 'MuxMode'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import Network.TypedProtocol.Codec

import Ouroboros.Network.CodecCBORTerm
import Ouroboros.Network.ConnectionManager.Types (DataFlow (..))
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..), combinePeerSharing)
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..),
combinePeerSharing)
import Ouroboros.Network.Protocol.Handshake.Codec
import Ouroboros.Network.Protocol.Handshake.Type
import Ouroboros.Network.Protocol.Handshake.Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ instance Arbitrary ArbitraryNodeToNodeVersionData where
shrinkMode InitiatorAndResponderDiffusionMode = [InitiatorOnlyDiffusionMode]

shrinkPeerSharing PeerSharingDisabled = []
shrinkPeerSharing PeerSharingEnabled = [PeerSharingDisabled]
shrinkPeerSharing PeerSharingEnabled = [PeerSharingDisabled]

newtype ArbitraryNodeToNodeVersions =
ArbitraryNodeToNodeVersions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import qualified Codec.CBOR.Decoding as CBOR
import qualified Codec.CBOR.Encoding as CBOR
import Ouroboros.Network.Mock.Chain (Chain (..))
import Ouroboros.Network.NodeToNode ()
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)
import Ouroboros.Network.PeerSelection.RelayAccessPoint
(RelayAccessPoint (..))
import Ouroboros.Network.PeerSharing (PeerSharingRegistry (..),
Expand All @@ -88,7 +89,6 @@ import qualified Test.Ouroboros.Network.Diffusion.Node.ChainDB as ChainDB
import Test.Ouroboros.Network.Diffusion.Node.ChainDB (ChainDB (..))
import Test.QuickCheck (Arbitrary (..), choose, chooseInt, frequency,
oneof)
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)


-- | Node-to-node address type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ import Test.Ouroboros.Network.ShrinkCarefully
import Ouroboros.Network.PeerSelection.LedgerPeers (IsBigLedgerPeer,
IsLedgerPeer)
import Ouroboros.Network.PeerSelection.PeerAdvertise (PeerAdvertise)
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing,
combinePeerSharing)
import Ouroboros.Network.PeerSelection.Types (PeerStatus (..))
import Ouroboros.Network.Protocol.PeerSharing.Type (PeerSharingAmount,
PeerSharingResult (..))
import Test.QuickCheck
import Test.Tasty (TestTree, localOption, testGroup)
import Test.Tasty.QuickCheck (QuickCheckMaxSize (..), testProperty)
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing, combinePeerSharing)


tests :: TestTree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ import Ouroboros.Network.BlockFetch (TraceFetchClientState,
TraceLabelPeer (..))
import Ouroboros.Network.PeerSelection.PeerAdvertise
(PeerAdvertise (..))
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)
import Ouroboros.Network.PeerSelection.State.LocalRootPeers
(HotValency (..), WarmValency (..))
import Ouroboros.Network.Protocol.PeerSharing.Codec
(byteLimitsPeerSharing, timeLimitsPeerSharing)
import Test.Ouroboros.Network.PeerSelection.LocalRootPeers ()
import Test.QuickCheck
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)

-- | Diffusion Simulator Arguments
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ import Ouroboros.Network.PeerSelection.Governor.Types
import Ouroboros.Network.PeerSelection.LedgerPeers
import Ouroboros.Network.PeerSelection.PeerAdvertise
(PeerAdvertise (..))
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)
import Ouroboros.Network.PeerSelection.RootPeersDNS
import Ouroboros.Network.PeerSelection.State.LocalRootPeers
(HotValency, WarmValency)
import Ouroboros.Network.PeerSharing (PeerSharingController (..))
import Ouroboros.Network.Protocol.PeerSharing.Type
(PeerSharingAmount (..))
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)


withPeerSelectionActions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ import Ouroboros.Network.Protocol.Handshake (HandshakeException)
import Ouroboros.Network.ConnectionHandler (Handle (..),
HandleError (..), MuxConnectionManager)
import Ouroboros.Network.ConnectionManager.Types
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)
import Ouroboros.Network.PeerSelection.Types (PeerStatus (..))
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)

-- $doc
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ import Data.Maybe (fromMaybe)
import Ouroboros.Network.PeerSelection.LedgerPeers (IsLedgerPeer (..))
import Ouroboros.Network.PeerSelection.PeerAdvertise
(PeerAdvertise (..))
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..), combinePeerSharing)
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..),
combinePeerSharing)


-------------------------------
Expand Down Expand Up @@ -383,7 +384,7 @@ setConnectTimes times
canPeerShareRequest :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> Bool
canPeerShareRequest pa KnownPeers { allPeers } =
case Map.lookup pa allPeers of
Just (KnownPeerInfo _ _ PeerSharingEnabled _ _) -> True
Just (KnownPeerInfo _ _ PeerSharingEnabled _ _) -> True
_ -> False

-- Filter available for Peer Sharing peers according to their PeerSharing
Expand Down

0 comments on commit c7e9e85

Please sign in to comment.