Skip to content

Commit

Permalink
Adds PublicRootPeers and BootstrapPeers
Browse files Browse the repository at this point in the history
Adds `readLedgerStateJudgement` to `PeerSelectionActions`
Adds `currentLedgerStateJudgement` to `PeerSelectionState`

Fix PeerSelectionState miss-merge with #4575

Adjusts `PeerSelectionActions` `requestPublicRootPeers` function to
provide either only ledger peers or bootstrap peers according to the
current ledger state. The same for `requestBigLedgerPeers`.

Adds LedgerStateJudgement to tests

Moves BigLedgerPeers to PublicRootPeers

Refactor `PeerSelectionActions` `requestPublicRootPeers` function
  • Loading branch information
bolt12 committed Oct 26, 2023
1 parent 58c2c26 commit c888430
Show file tree
Hide file tree
Showing 31 changed files with 955 additions and 488 deletions.
2 changes: 2 additions & 0 deletions ouroboros-network-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

### Non-breaking changes

- Added `IsBootstrapPeer` type

## 0.5.1.0 -- 2023-08-09

### Breaking changes
Expand Down
1 change: 1 addition & 0 deletions ouroboros-network-api/ouroboros-network-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ library
Ouroboros.Network.PeerSelection.PeerMetric.Type
Ouroboros.Network.PeerSelection.PeerAdvertise
Ouroboros.Network.PeerSelection.PeerSharing
Ouroboros.Network.PeerSelection.Bootstrap
Ouroboros.Network.PeerSelection.RelayAccessPoint
default-language: Haskell2010
build-depends: base >=4.14 && <4.19,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{-# LANGUAGE DeriveGeneric #-}

module Ouroboros.Network.PeerSelection.Bootstrap (IsBootstrapPeer (..)) where

import Data.Aeson
import Data.Bool (bool)
import GHC.Generics (Generic)

-- | Is Bootstrap peer flag distinguishes different kinds of public root peers
--
data IsBootstrapPeer = IsNotBootstrapPeer
| IsBootstrapPeer
deriving (Eq, Show, Ord, Generic)
4 changes: 3 additions & 1 deletion ouroboros-network-testing/ouroboros-network-testing.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ library
cborg >=0.2.1 && <0.3,
serialise >=0.2 && <0.3,
network-mux,
QuickCheck
QuickCheck,

ouroboros-network-api

ghc-options: -Wall
-Wno-unticked-promoted-constructors
Expand Down
13 changes: 13 additions & 0 deletions ouroboros-network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
* Preserve `PeerAdvertise` information when connecting to peers.

* Increase keyed timeout on a testnet test that was failing.
- Creates `PublicRootPeers` and adds `BootstrapPeers` to
`PublicRootPeers` abstraction.

- Fix `PeerSelectionState` miss-merge with #4575

- Adds `readLedgerStateJudgement` to `PeerSelectionActions`
- Adds `currentLedgerStateJudgement` to `PeerSelectionState`

- Adjusts `PeerSelectionActions` `requestPublicRootPeers` function to
provide either only ledger peers or bootstrap peers according to the
current ledger state. The same for `requestBigLedgerPeers`.

- Move Big Ledger Peers to `PublicRootPeers`

## 0.9.1.0 -- 2023-08-22

Expand Down
2 changes: 2 additions & 0 deletions ouroboros-network/ouroboros-network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ library
Ouroboros.Network.Tracers
Ouroboros.Network.PeerSelection.Types
Ouroboros.Network.PeerSelection.LedgerPeers
Ouroboros.Network.PeerSelection.PublicRootPeers
Ouroboros.Network.PeerSelection.PeerMetric
Ouroboros.Network.PeerSelection.PeerSelectionActions
Ouroboros.Network.PeerSelection.PeerStateActions
Expand Down Expand Up @@ -170,6 +171,7 @@ test-suite sim-tests
Test.Ouroboros.Network.PeerSelection.Instances
Test.Ouroboros.Network.PeerSelection.KnownPeers
Test.Ouroboros.Network.PeerSelection.LocalRootPeers
Test.Ouroboros.Network.PeerSelection.PublicRootPeers
Test.Ouroboros.Network.PeerSelection.RootPeersDNS
Test.Ouroboros.Network.PeerSelection.Json
Test.Ouroboros.Network.PeerSelection.MockEnvironment
Expand Down
2 changes: 2 additions & 0 deletions ouroboros-network/sim-tests/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import qualified Test.Ouroboros.Network.PeerSelection.KnownPeers
import qualified Test.Ouroboros.Network.PeerSelection.LocalRootPeers
import qualified Test.Ouroboros.Network.PeerSelection.MockEnvironment
import qualified Test.Ouroboros.Network.PeerSelection.PeerMetric
import qualified Test.Ouroboros.Network.PeerSelection.PublicRootPeers
import qualified Test.Ouroboros.Network.PeerSelection.RootPeersDNS
import qualified Test.Ouroboros.Network.PeerState (tests)
import qualified Test.Ouroboros.Network.Testnet (tests)
Expand All @@ -40,6 +41,7 @@ tests =
, Test.Ouroboros.Network.PeerSelection.Json.tests
, Test.Ouroboros.Network.PeerSelection.KnownPeers.tests
, Test.Ouroboros.Network.PeerSelection.LocalRootPeers.tests
, Test.Ouroboros.Network.PeerSelection.PublicRootPeers.tests
, Test.Ouroboros.Network.PeerSelection.MockEnvironment.tests
, Test.Ouroboros.Network.PeerSelection.PeerMetric.tests
, Test.Ouroboros.Network.PeerSelection.RootPeersDNS.tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module Test.Ouroboros.Network.Diffusion.Node
-- * extra types used by the node
, AcceptedConnectionsLimit (..)
, DiffusionMode (..)
, LedgerPeersConsensusInterface (..)
, PeerAdvertise (..)
, PeerSelectionTargets (..)
, RelayAccessPoint (..)
Expand Down Expand Up @@ -77,8 +76,6 @@ import Ouroboros.Network.ExitPolicy (ReconnectDelay (..))
import Ouroboros.Network.NodeToNode.Version (DiffusionMode (..))
import Ouroboros.Network.PeerSelection.Governor
(PeerSelectionTargets (..))
import Ouroboros.Network.PeerSelection.LedgerPeers
(LedgerPeersConsensusInterface (..))
import Ouroboros.Network.PeerSelection.PeerMetric
(PeerMetricsConfiguration (..), newPeerMetric)
import Ouroboros.Network.PeerSelection.RootPeersDNS
Expand All @@ -104,7 +101,7 @@ import Ouroboros.Network.Testing.Data.Script (Script (..))
import Simulation.Network.Snocket (AddressType (..), FD)

import Ouroboros.Network.PeerSelection.LedgerPeers.Type
(UseLedgerPeers)
(LedgerPeersConsensusInterface, UseLedgerPeers)
import Ouroboros.Network.PeerSelection.PeerAdvertise
(PeerAdvertise (..))
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ import qualified Ouroboros.Network.Mock.Chain as Chain
import Ouroboros.Network.Mock.ProducerState
import Ouroboros.Network.Mux
import Ouroboros.Network.NodeToNode.Version (DiffusionMode (..))
import Ouroboros.Network.PeerSelection.LedgerPeers
(LedgerPeersConsensusInterface)
import Ouroboros.Network.Util.ShowProxy

import Ouroboros.Network.Mock.ConcreteBlock
Expand All @@ -90,6 +88,8 @@ import qualified Pipes
import Ouroboros.Network.NodeToNode (blockFetchMiniProtocolNum,
chainSyncMiniProtocolNum, keepAliveMiniProtocolNum,
peerSharingMiniProtocolNum)
import Ouroboros.Network.PeerSelection.LedgerPeers.Type
(LedgerPeersConsensusInterface)
import qualified Ouroboros.Network.PeerSelection.PeerSharing as PSTypes
import Ouroboros.Network.PeerSharing (bracketPeerSharingClient,
peerSharingClient, peerSharingServer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ import Ouroboros.Network.PeerSelection.LedgerPeers
import Cardano.Slotting.Slot (SlotNo)
import Control.Concurrent.Class.MonadSTM
import Ouroboros.Network.PeerSelection.LedgerPeers.Type
(UseLedgerAfter (..), UseLedgerPeers (..))
(LedgerPeersConsensusInterface (..),
LedgerStateJudgement (..), UseLedgerAfter (..),
UseLedgerPeers (..))
import Test.QuickCheck
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck (testProperty)
Expand Down
Loading

0 comments on commit c888430

Please sign in to comment.