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 Apr 3, 2023
1 parent bb0e9f3 commit c02b1df
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ouroboros-consensus-diffusion/src/Ouroboros/Consensus/Node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -701,17 +701,20 @@ 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: The timeout should be drawn at random everytime chainsync
-- enters the must reply state. A static per connection timeout
-- leads to selection preassure for connections with a large
-- timeout, see #4244.
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
Expand Down

0 comments on commit c02b1df

Please sign in to comment.