This repository has been archived by the owner on Nov 26, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a race condition where each node (attached to a miner) advances its clock once all miners are done mining but only after that same node is done syncing, not all nodes are done syncing. The result was a temporary disruption in the synchronization where some nodes advanced their clock to the next epoch before others (while blocks were still being relayed and validated). This was manifested in the
Received block with large delay
logs reported by non-client roles (the client roles were running one epoch ahead so the error was expected in that case).With this patch the clock is advanced once all nodes are synced to the mined blocks in the epoch. This hopefully also illustrates my apprehension regarding the local/global distinction. In this version the
case <-localEpochAdvanceCh
is reduced to just an empty relay to the "global"ClockSyncTopic
(handled in thecase
after it in theselect
). It seems simpler to me (at least for a first iteration) to have a single time ("global") reflected in all clocks, all the time, to avoid these misalignments. The resulting algorithm then is just:The motivation here is not to improve #143 or strain that PR to achieve more than it can at the moment, I agree with the iterative approach charted. The motivation is to gain confidence in our understanding of the current implementation (whatever its state of completeness) before moving forward. The logs we were seeing in non-clients that we couldn't explain were just a symptom that we were having trouble grappling with parts of the code (or at least I was, especially with the channels dynamic). I'm fine with going with a different approach than this one as long as we can understand and justify the results we see.