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 Nov 3, 2023
1 parent e53b091 commit 2b93450
Show file tree
Hide file tree
Showing 31 changed files with 951 additions and 488 deletions.
2 changes: 1 addition & 1 deletion ouroboros-network-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* Restructured `decodeTerm` to prevent an impossible case and eliminate the
associated `error`.


## 0.5.1.1 -- 2023-10-26

### Non-breaking changes
Expand All @@ -43,6 +42,7 @@

* Added `IsBigLedgerPeer` type to
`Ouroboros.Network.PeerSelection.LedgerPeers.Type`.

## 0.5.0.0 -- 2023-05-15

* Swapped `NodeToClientV_15` with `NodeToClientV_16`, e.g. handshake query
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 @@ -46,6 +46,7 @@ library
Ouroboros.Network.PeerSelection.PeerAdvertise
Ouroboros.Network.PeerSelection.PeerSharing
Ouroboros.Network.PeerSelection.PeerSharing.Codec
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,11 @@
{-# LANGUAGE DeriveGeneric #-}

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

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 @@ -53,6 +53,19 @@
eliminate the associated error.

* 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 @@ -221,6 +222,7 @@ library sim-tests-lib
Test.Ouroboros.Network.PeerSelection.PeerGraph
Test.Ouroboros.Network.PeerSelection.PeerMetric
Test.Ouroboros.Network.PeerSelection.RootPeersDNS
Test.Ouroboros.Network.PeerSelection.PublicRootPeers
Test.Ouroboros.Network.PeerState
Test.Ouroboros.Network.Testnet
Test.Ouroboros.Network.Testnet.Simulation.Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module Test.Ouroboros.Network.Diffusion.Node
-- * extra types used by the node
, AcceptedConnectionsLimit (..)
, DiffusionMode (..)
, LedgerPeersConsensusInterface (..)
, PeerAdvertise (..)
, PeerSelectionTargets (..)
, RelayAccessPoint (..)
Expand Down Expand Up @@ -79,8 +78,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 @@ -106,7 +103,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 2b93450

Please sign in to comment.