-
Notifications
You must be signed in to change notification settings - Fork 23
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
Do not even propagate future headers #525
Conversation
916e825
to
330452e
Compare
{-# LANGUAGE StandaloneDeriving #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
|
||
module Ouroboros.Consensus.MiniProtocol.ChainSync.Client.InFutureCheck ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njd42 Please confirm this logic matches what you and I chatted about a few weeks ago. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njd42 It's being merged now, but I'd still appreciate your thoughts on this module. Thanks.
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
FYI, the PR is draft because I've so far only propagated the ChainSync client interface change to its test. I'll tackle the rest tomorrow. Edit: No longer Draft. |
330452e
to
ee73914
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, mostly minor comments and a few suggestions. Will review again after the chores (formatting, compilation failures, changelog entries, etc.).
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Fragment/InFuture.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to other reviewers: The diff here is much smaller when using sth like difftastic.
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
...s/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ChainSync/Client/InFutureCheck.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
aab0db0
to
142a011
Compare
...sensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToNode.hs
Outdated
Show resolved
Hide resolved
...oros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
...boros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Show resolved
Hide resolved
cb6ba32
to
754ab23
Compare
Just FYI, I just now rebased onto |
19b9720
to
fa31155
Compare
CI is green 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (after squashing), only very minor comments left
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/consensus-test/Test/Consensus/MiniProtocol/ChainSync/Client.hs
Outdated
Show resolved
Hide resolved
137f887
to
db094ad
Compare
db094ad
to
dcefa64
Compare
FYI: I based a second time to sign the commits. |
Main change: remove the LogicalClock, since it's quite a bit of indirection with no real gain. Also, remove -XRecordWildCards.
This an aggressively-simple interpretation of the easy part of Ouroboros Chronos in the presence of The Header-Body Split. (The hard part is the _synchronization beacons_---which need to be propagated promptly, and will be implemented much later.) Other less-aggressive interpretations would propagate future headers/blocks but set them aside. But this seems much simpler and within an RTT or two, assuming eg the NTP clients are well-configured.
This now exercises the real ChainSync InFutureCheck.
dcefa64
to
8bb0efc
Compare
now <- systemTimeCurrent systemTime | ||
let ageNow = now `diffRelTime` onset | ||
syntheticDelay = negate ageNow | ||
threadDelay $ nominalDelay syntheticDelay -- TODO leap seconds? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can resolve the leap second argument now. Worst case is a 0.9s jump (see https://en.wikipedia.org/wiki/DUT1). So the two extrema are:
- local clock adjustment is +ve by 0.9s : the delay here would be (up to) 0.9s 'too much' - this is not an operational issue, delays of that magnitude occur during usual operation
- local clock adjustment is -ve by 0.9s: this could be perceived by other nodes as a (minor) future arrival and therefore delayed there by a small amounr.
The handling of leap seconds is (and will likely forever be) a bit of mess (see https://en.wikipedia.org/wiki/Leap_second#Issues_created_by_insertion_(or_removal)_of_leap_seconds).
As we only ever take the slotToWallClock
time direction we would be safe as this is always (to UTC) unambiguously defined. The mapping in the other direction is (around leap seconds) ambiguous depending on the operating system's handling of leap seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It all looks good to me - I've added some comments as to why I believe that you have already effectively dealt with the leap second issue (as best as can be done)
After #525, the `cdbFutureBlocks` field became unnecessary, as we now delay headers until they are no longer from the (near) future.
After #525, the `cdbFutureBlocks` field became unnecessary, as we now delay headers until they are no longer from the (near) future.
After #525, the `cdbFutureBlocks` field became unnecessary, as we now delay headers until they are no longer from the (near) future.
@njd42 and I came up with this idea a couple weeks ago, during a chat about the vagaries of NTP/clocks/etc.
See the commit message of the 'consensus: do not even propagate future headers' commit.
The main concrete benefits: