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

Prevent unnecessary lib<->head catchup transition changes #1619

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

linh2931
Copy link
Member

Resolved #1546

Replace #1617 to base on main instead.

Instant finality or private chains make it likely peers think their lib and head are not in sync but in reality they are only within small difference. To avoid unnecessary catchups, a minimal distance between lib and head is introduced. min_blocks_distance must be reached before catchup starts.

min_blocks_distance is defined as the number of blocks produced during the half keep alive interval (how long a node waits before contacting its peer).

Copy link
Member

@heifner heifner left a comment

Choose a reason for hiding this comment

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

Hold up. I want to take a look at the test failure.

@heifner
Copy link
Member

heifner commented Sep 11, 2023

The test is failing because the node that is producing believes the other node is syncing from it so it does not send it the block it produced.

I think we need to revert this change (chain_info.head_num + min_blocks_distance < msg.last_irreversible_block_num) while keeping the rest. That likely means that more handshake messages will be sent. That handshake should be seen from the peer as having the same head and drop out of syncing.

One thing we can look at doing in the future is using the hotstuff messages as a way to know if we are insync. They include the current block_id, so if we have that block then we know we are insync. We can therefore know we are insync without the extra handshake message.

@linh2931
Copy link
Member Author

@heifner Thank you so much for your help!

@linh2931 linh2931 merged commit fc604dc into main Sep 12, 2023
85 checks passed
@linh2931 linh2931 deleted the smarter_lib_head_catchup_on_main branch September 12, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IF: net_plugin lib<->head catchup transistion change
3 participants