Skip to content

Commit

Permalink
Update chainsync timeout
Browse files Browse the repository at this point in the history
Increase the minimum timeout from 90s to 135s and switch from picking
from an array of 5 values to a range of timeouts.
This change reduces the risk of synchronosation among nodes in the
network.
  • Loading branch information
karknu committed Mar 28, 2023
1 parent 9e2e06c commit 05a573d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ouroboros-consensus-diffusion/src/Ouroboros/Consensus/Node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -678,17 +678,17 @@ stdChainSyncTimeout = do
-- f = 0.05
-- The timeout is randomly picked per bearer to avoid all bearers
-- going down at the same time in case of a long streak of empty
-- slots. TODO: workaround until peer selection governor.
mustReplyTimeout <- Just <$> randomElem [90, 135, 180, 224, 269]
-- slots.
-- To avoid global synchronosation the timeout is picked uniformly
-- from the interval 135 - 269, corresponds to the a 99.9% to
-- 99.9999% thresholds.
-- TODO: workaround until peer selection governor.
mustReplyTimeout <- Just <$> realToFrac <$> randomRIO (135,269 :: Double)
return NTN.ChainSyncTimeout
{ canAwaitTimeout = shortWait
, intersectTimeout = shortWait
, mustReplyTimeout
}
where
randomElem xs = do
ix <- randomRIO (0, length xs - 1)
return $ xs !! ix

stdVersionDataNTN :: NetworkMagic -> DiffusionMode -> NodeToNodeVersionData
stdVersionDataNTN networkMagic diffusionMode = NodeToNodeVersionData
Expand Down

0 comments on commit 05a573d

Please sign in to comment.