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: added MAXIMUM_GOSSIP_CLOCK_DISPARITY into account to distinguish future slots #1316

Merged
merged 6 commits into from
Oct 7, 2024

Conversation

rodrigo-o
Copy link
Collaborator

@rodrigo-o rodrigo-o commented Oct 2, 2024

Motivation

This PR fixes an issue where some blocks where ignored (6000656 started at 21.11.12 for us)
WARNING 21:11:11.831 [Gossip] Block ignored, reason: "Block is from the future: block.slot=6000656. Current slot: 6000655.".

Description
In fact, the blocks where being received in time, just a couple of milliseconds before we made the transition, having into account MAXIMUM_GOSSIP_CLOCK_DISPARITY in the calculation, allow us to process the block at the time.

I also moved the current_slot function from Store to ForkChoice, to have both depending on the same calculation. There is an outstanding function that previously used the old Clock.get_current_time/0 that is using the system time since then, I added a comment where it is used for future reference, the function is: get_current_chain_slot/0.

Resolves #1315

@rodrigo-o
Copy link
Collaborator Author

After various tests, I've spotted no more warnings related to blocks being received a couple of milliseconds before. while still seeing them in the main branch, specially at different times of the day.

@rodrigo-o rodrigo-o marked this pull request as ready for review October 2, 2024 15:02
@rodrigo-o rodrigo-o requested a review from a team as a code owner October 2, 2024 15:02
Copy link
Collaborator

@Arkenan Arkenan left a comment

Choose a reason for hiding this comment

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

LGTM. I think we should simplify the current_slot logic. There's at least three different ways to calculate it and it's not clear when to use which. Out of scope of this PR though.

@doc """
Get the current chain slot based on the system time.

TODO: There are just 2 uses of this function outside this module:
Copy link
Collaborator

Choose a reason for hiding this comment

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

If there's a TODO, please add an issue and refer to it inside the todo. If not, remove the TODO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The TODO was old, you are right, I didn't saw this comment immediately. Removing it in the other PR now that I need to merge main again!

@rodrigo-o
Copy link
Collaborator Author

LGTM. I think we should simplify the current_slot logic. There's at least three different ways to calculate it and it's not clear when to use which. Out of scope of this PR though.

Completely agree, now at least the 2 more used functions are in the same module but we still need to unify them, I'll add an issue!

@rodrigo-o rodrigo-o merged commit 1ea343b into main Oct 7, 2024
14 checks passed
@rodrigo-o rodrigo-o deleted the current-slot-with-maximum-disparity branch October 7, 2024 14:35
@rodrigo-o
Copy link
Collaborator Author

LGTM. I think we should simplify the current_slot logic. There's at least three different ways to calculate it and it's not clear when to use which. Out of scope of this PR though.

Completely agree, now at least the 2 more used functions are in the same module but we still need to unify them, I'll add an issue!

#1322 was created!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
2 participants