Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ if impl(ghc >= 9.12.0)

-- rejecting: cardano-crypto-class-2.3.1.0 (conflict: cardano-crypto-tests => cardano-crypto-class>=2.2.2 && <2.2.4)
-- allow-newer: cardano-crypto-tests:cardano-crypto-class

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-network
tag: f2d88695147d9f236669caa214e11dba6b75eadc
--sha256: sha256-mRP9WxZ4xPOus/nFzSOMXCYopBGZcERDk+QqOD1LmQc=
subdir: ouroboros-network

allow-newer: ouroboros-network:trace-dispatcher
6 changes: 3 additions & 3 deletions dmq-node/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ import DMQ.Configuration.CLIOptions (parseCLIOptions)
import DMQ.Configuration.Topology (readTopologyFile)
import DMQ.Diffusion.Applications (diffusionApplications)
import DMQ.Diffusion.Arguments
import DMQ.Diffusion.NodeKernel
import DMQ.Diffusion.PeerSelection (policy)
import DMQ.Diffusion.NodeKernel as NodeKernel
import DMQ.Diffusion.PeerSelectionPolicy (policy)
import DMQ.Handlers.TopLevel (toplevelExceptionHandler)
import DMQ.NodeToClient qualified as NtC
import DMQ.NodeToClient.LocalStateQueryClient
Expand Down Expand Up @@ -247,7 +247,7 @@ runDMQ commandLineConfig = do
dmqLimitsAndTimeouts
dmqNtNApps
dmqNtCApps
(policy policyRngVar)
(policy policyRngVar nodeKernel.peerMetric)

Diffusion.run dmqDiffusionArguments
dmqDiffusionTracers
Expand Down
26 changes: 26 additions & 0 deletions dmq-node/changelog.d/20260512_150257_coot_sig_metric.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

<!--
### Breaking

- A bullet item for the Breaking category.

-->
### Non-Breaking

- Added `DMQ.Diffusion.PeerSelection.PeerMetric`: peer-scoring metric that
tracks how promptly each peer announces signatures, used by peer selection
to prefer well-performing peers.
- Wired the metric into the sig-submission inbound client.

<!--
### Patch

- A bullet item for the Patch category.

-->
6 changes: 5 additions & 1 deletion dmq-node/dmq-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ library
DMQ.Diffusion.Arguments
DMQ.Diffusion.NodeKernel
DMQ.Diffusion.NodeKernel.Types
DMQ.Diffusion.PeerSelection
DMQ.Diffusion.PeerSelection.PeerMetric
DMQ.Diffusion.PeerSelectionPolicy
DMQ.Handlers.TopLevel
DMQ.NodeToClient
DMQ.NodeToClient.LocalMsgNotification
Expand Down Expand Up @@ -131,6 +132,7 @@ library
optparse-applicative >=0.18 && <0.20,
ouroboros-consensus:{ouroboros-consensus, cardano, diffusion},
ouroboros-network:{ouroboros-network, api, framework, framework-tracing, orphan-instances, protocols, tracing} ^>=1.1.0.0,
psqueues,
quiet,
random ^>=1.3,
singletons,
Expand Down Expand Up @@ -192,6 +194,7 @@ test-suite dmq-tests
DMQ.Protocol.SigSubmissionV2.Test
Test.DMQ.NodeToClient
Test.DMQ.NodeToNode
Test.DMQ.PeerSelection.PeerMetric
Test.DMQ.SigSubmission.App
Test.DMQ.SigSubmission.Types

Expand All @@ -215,6 +218,7 @@ test-suite dmq-tests
io-sim,
kes-agent-crypto,
ouroboros-network:{ouroboros-network, api, framework, ouroboros-network-tests-lib, protocols, protocols-tests-lib, tests-lib},
psqueues,
quickcheck-instances,
random,
serialise,
Expand Down
4 changes: 4 additions & 0 deletions dmq-node/src/DMQ/Diffusion/NodeKernel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Ouroboros.Network.TxSubmission.Mempool.Simple qualified as Mempool

import DMQ.Configuration
import DMQ.Diffusion.NodeKernel.Types
import DMQ.Diffusion.PeerSelection.PeerMetric (mkPeerMetric)
import DMQ.Policy qualified as Policy
import DMQ.Protocol.SigSubmission.Type (Sig (sigExpiresAt, sigId), SigId)
import DMQ.Tracer
Expand Down Expand Up @@ -94,6 +95,8 @@ newNodeKernel rng = do
ps_POLICY_PEER_SHARE_STICKY_TIME
ps_POLICY_PEER_SHARE_MAX_PEERS

peerMetric <- mkPeerMetric

pure NodeKernel { fetchClientRegistry
, peerSharingRegistry
, peerSharingAPI
Expand All @@ -103,6 +106,7 @@ newNodeKernel rng = do
, sigSharedTxStateVar
, nextEpochVar
, stakePools
, peerMetric
}


Expand Down
2 changes: 2 additions & 0 deletions dmq-node/src/DMQ/Diffusion/NodeKernel/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Ouroboros.Network.PeerSharing (PeerSharingAPI, PeerSharingRegistry)
import Ouroboros.Network.TxSubmission.Inbound.V2
import Ouroboros.Network.TxSubmission.Mempool.Simple (Mempool (..))

import DMQ.Diffusion.PeerSelection.PeerMetric (PeerMetric)
import DMQ.Protocol.SigSubmission.Type (Sig, SigId)


Expand All @@ -44,6 +45,7 @@ data NodeKernel crypto ntnAddr m =
, sigSharedTxStateVar :: !(SharedTxStateVar m ntnAddr SigId (Sig crypto))
, stakePools :: !(StakePools m)
, nextEpochVar :: !(StrictTVar m (Maybe UTCTime))
, peerMetric :: !(PeerMetric m SigId ntnAddr)
}


Expand Down
Loading
Loading