Skip to content

Comments

RNG hadning in SRV lookups for public root peers#5307

Open
Savissy wants to merge 1 commit intoIntersectMBO:mainfrom
Savissy:main
Open

RNG hadning in SRV lookups for public root peers#5307
Savissy wants to merge 1 commit intoIntersectMBO:mainfrom
Savissy:main

Conversation

@Savissy
Copy link

@Savissy Savissy commented Feb 9, 2026

Motivation:

The public root peers provider used the same StdGen seed for all DNS lookups, causing SRV weighted-sampling to reuse the same RNG and produce correlated/identical selections across domains.
The change aims to provide independent RNGs per domain lookup so SRV selection becomes varied and correct.

Description:

Add a mutable RNG StrictTVar (rngVar) initialized from the supplied StdGen and thread it into the request path for publicRootPeersProvider by changing the local requestPublicRootPeers signature to accept the RNG var.
Generate one split RNG per domain with replicateM + stateTVar rngVar split and zip those RNGs with the domain list, then pass each domain-specific RNG into dnsLookupWithTTL so lookups (including srvRecordLookupWithTTL) use independent RNGs.
Import replicateM from Control.Monad and create rngVar via newTVarIO near the resolver resource initialization.

@Savissy Savissy requested a review from a team as a code owner February 9, 2026 10:49
@github-project-automation github-project-automation bot moved this to In Progress in Ouroboros Network Feb 9, 2026
@crocodile-dentist
Copy link
Contributor

I don't see a way this can be viably exploited or what actual risk this will mitigate.

@crocodile-dentist
Copy link
Contributor

We've discussed internally and agreed that adding this change won't hurt. Please fix the build failures first.

Comment on lines -82 to +85
requestPublicRootPeers resourceVar _numRequested = do
requestPublicRootPeers resourceVar rngVar _numRequested = do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indentation

Suggested change
requestPublicRootPeers resourceVar _numRequested = do
requestPublicRootPeers resourceVar rngVar _numRequested = do
requestPublicRootPeers resourceVar rngVar _numRequested = do

@coot coot changed the title Fix RNG reuse for SRV DNS lookups in public root peers RNG hadning in SRV lookups for public root peers Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants