Skip to content

Fix VLC double-increment on event receive - #23

Open
ABresting wants to merge 1 commit into
mainfrom
fix/vlc-double-increment
Open

Fix VLC double-increment on event receive#23
ABresting wants to merge 1 commit into
mainfrom
fix/vlc-double-increment

Conversation

@ABresting

Copy link
Copy Markdown
Collaborator

Summary

  • Remove redundant vlc.tick() after vlc.merge() in add_event() and receive_event_from_network()
  • VLC::merge() internally calls VLCSnapshot::receive() which already performs merge + increment — the extra tick doubled the clock advancement per receive

Problem

Every received event advanced the local vector clock entry by 2 instead of 1. This inflated logical_time at 2x the correct rate, causing should_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

  • All 89 consensus crate tests pass
  • Full workspace build succeeds

Fixes #22

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
@ABresting ABresting self-assigned this Mar 11, 2026
@ABresting ABresting added bug Something isn't working consensus high-priority labels Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working consensus high-priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VLC double-increment on event receive inflates vector clock

1 participant