Fix VLC double-increment on event receive - #23
Open
ABresting wants to merge 1 commit into
Open
Conversation
VLC::merge() calls VLCSnapshot::receive() which already performs merge + increment. The extra vlc.tick() in add_event() and receive_event_from_network() caused the local vector clock entry and logical_time to advance by 2 per receive instead of 1. Fixes #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
vlc.tick()aftervlc.merge()inadd_event()andreceive_event_from_network()VLC::merge()internally callsVLCSnapshot::receive()which already performs merge + increment — the extra tick doubled the clock advancement per receiveProblem
Every received event advanced the local vector clock entry by 2 instead of 1. This inflated
logical_timeat 2x the correct rate, causingshould_fold()(VLC delta threshold) to trigger earlier than intended.The VLC update rule per Chrono (arXiv:2405.13349):
UPDATE(id, c, [c_received])performs a single merge + increment. The receive path was incorrectly performing two increments.What changed
consensus/src/engine.rs— removed one line (vlc.tick()) from each of the two receive paths. Local event creation (create_event,tick_and_get_vlc) is unchanged.Test plan
Fixes #22