Skip to content
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

Fix vote_spacing logic #4840

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

gr0vity-dev
Copy link
Contributor

The votable() method had incorrect logic that allowed voting on recently
voted blocks when it should have prevented them. Fix inverts the logic to:

  • Prevent repeated votes on the same root/hash pairs within spacing window
  • Allow immediate voting on different blocks with same root (competing forks)

Additional changes:

  • Remove vote spacing check from vote_generator reply()
  • Update vote_spacing to track latest fork votes per root
  • Fix tests to reflect correct spacing behavior

…ing immediate votes

for competing forks.

Key changes:
- Remove vote spacing check from reply() in vote_generator.cpp
- Update vote_spacing implementation to track most recent fork votes
- Fix tests to reflect new vote spacing behavior
@gr0vity-dev-bot
Copy link

gr0vity-dev-bot commented Feb 5, 2025

Test Results for Commit d7db86d

Pull Request 4840: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 109s)
  • 5n4pr_conf_10k_change: PASS (Duration: 153s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 122s)
  • 5n4pr_conf_change_independant: PASS (Duration: 112s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 115s)
  • 5n4pr_conf_send_independant: PASS (Duration: 127s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 109s)
  • 5n4pr_rocks_10k_change: PASS (Duration: 144s)

Last updated: 2025-02-05 21:36:48 UTC

{
stats.inc (nano::stat::type::vote_generator, nano::stat::detail::generator_spacing);
}
roots.push_back (root);
Copy link
Contributor

@pwojcikdev pwojcikdev Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a comment here explaining that we don't want to use spacing for on-demand vote replies. I think it's a good modification but evidently it wasn't that obvious since we are only changing it now.

@qwahzi qwahzi added this to the V28 milestone Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress / V28.0
Development

Successfully merging this pull request may close these issues.

4 participants