Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diffusion improvements #5070

Merged
merged 7 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1270,12 +1270,6 @@ diffusionSimulation
Cardano.cardanoPublicRootPeersAPI
(Cardano.cardanoPeerSelectionGovernorArgs
(Cardano.cardanoExtraArgsToPeerSelectionActions cardanoExtraArgs)
readUseLedgerPeers
peerSharing
( Cardano.updateOutboundConnectionsState
$ lpExtraAPI
$ Node.iLedgerPeersConsensusInterface
$ interfaces)
)
Cardano.cardanoPeerSelectionStatetoCounters
(flip Cardano.ExtraPeers Set.empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4015,9 +4015,6 @@ _governorFindingPublicRoots targetNumberOfRootPeers readDomains readUseBootstrap
genesisPeerTargets = targets,
readUseBootstrapPeers = readUseBootstrapPeers
}
(return DontUseLedgerPeers)
peerSharing
(Cardano.updateOutboundConnectionsState (lpExtraAPI (getLedgerStateCtx actions)))


publicRootPeersProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,6 @@ governorAction mockEnv@GovernorMockEnvironment {
Cardano.genesisPeerTargets = snd initialPeerTargets,
Cardano.readUseBootstrapPeers = readUseBootstrapPeers
}
(readTVar lpVar)
(peerSharing actions)
(Cardano.updateOutboundConnectionsState (lpExtraAPI (getLedgerStateCtx actions)))


exploreRaces -- explore races within the governor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ import Ouroboros.Cardano.Network.PublicRootPeers qualified as Cardano
import Ouroboros.Network.PeerSelection.Governor (readAssociationMode)
import Ouroboros.Network.PeerSelection.Governor.Types (AssociationMode (..),
BootstrapPeersCriticalTimeoutError (..), ExtraGuardedDecisions (..),
PeerSelectionGovernorArgs (..), PeerSelectionSetsWithSizes,
PeerSelectionActions (..), PeerSelectionGovernorArgs (..),
PeerSelectionInterfaces (..), PeerSelectionSetsWithSizes,
PeerSelectionState (..), PeerSelectionView (..))
import Ouroboros.Network.PeerSelection.LedgerPeers.Type (UseLedgerPeers)
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing)
import Ouroboros.Network.PeerSelection.LedgerPeers
(LedgerPeersConsensusInterface (lpExtraAPI))
import Ouroboros.Network.PeerSelection.PublicRootPeers qualified as PublicRootPeers
import Ouroboros.Network.PeerSelection.State.EstablishedPeers qualified as EstablishedPeers
import Ouroboros.Network.PeerSelection.State.LocalRootPeers qualified as LocalRootPeers
Expand Down Expand Up @@ -187,9 +188,6 @@ cardanoPeerSelectionGovernorArgs
, Ord peeraddr
)
=> Cardano.ExtraPeerSelectionActions m
-> STM m UseLedgerPeers
-> PeerSharing
-> (OutboundConnectionsState -> STM m ())
-> PeerSelectionGovernorArgs
Cardano.ExtraState
extraDebugState
Expand All @@ -201,7 +199,7 @@ cardanoPeerSelectionGovernorArgs
peerconn
BootstrapPeersCriticalTimeoutError
m
cardanoPeerSelectionGovernorArgs extraActions readUseLedgerPeers peerSharing updateOutboundConnectionsState =
cardanoPeerSelectionGovernorArgs extraActions =
PeerSelectionGovernorArgs {
-- If by any chance the node takes more than 15 minutes to converge to a
-- clean state, we crash the node. This could happen in very rare
Expand All @@ -214,11 +212,15 @@ cardanoPeerSelectionGovernorArgs extraActions readUseLedgerPeers peerSharing upd
Just t
| blockedAt >= t -> Just BootstrapPeersCriticalTimeoutError
| otherwise -> Nothing
, updateWithState = \psv st -> do
, updateWithState = \PeerSelectionInterfaces { readUseLedgerPeers }
PeerSelectionActions { getLedgerStateCtx,
peerSharing }
psv st -> do
associationMode <- readAssociationMode readUseLedgerPeers
peerSharing
(Cardano.bootstrapPeersFlag (extraState st))
updateOutboundConnectionsState
Cardano.updateOutboundConnectionsState
(lpExtraAPI getLedgerStateCtx)
Comment on lines +215 to +223
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

(outboundConnectionsState associationMode psv st)
, extraDecisions =
ExtraGuardedDecisions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ peerSelectionGovernorLoop tracer
}

policy
PeerSelectionInterfaces {
interfaces@PeerSelectionInterfaces {
countersVar,
publicStateVar,
debugStateVar
Expand Down Expand Up @@ -613,7 +613,7 @@ peerSelectionGovernorLoop tracer
peerSelectionStateToView extraPeersToSet extraStateToExtraCounters st''

-- Custom STM actions
updateWithState peerSelectionView st''
updateWithState interfaces actions peerSelectionView st''

-- Update counters
counters <- readTVar countersVar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,9 @@ data PeerSelectionGovernorArgs extraState extraDebugState extraFlags
-> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn
-> Maybe exception
, updateWithState
:: PeerSelectionSetsWithSizes extraCounters peeraddr
:: PeerSelectionInterfaces extraState extraFlags extraPeers extraCounters peeraddr peerconn m
-> PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m
-> PeerSelectionSetsWithSizes extraCounters peeraddr
-> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn
-> STM m ()
, extraDecisions
Expand Down