-
Notifications
You must be signed in to change notification settings - Fork 107
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
Create a SyncStatus
helper type
#2685
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
I think @upbqdn might be waiting to fill in is_close_to_tip
for #2592, so let's try to get it merged within the next day or two.
All I think it needs is some temporary #[allow(dead_code)]
to resolve the clippy errors.
(Feel free to admin merge or get anyone to approve after that's done.)
Keeps track if the synchronizer is close to the chain tip or not.
Change the constructor API so that it returns a higher level construct.
Test if waiting for the chain tip to be reached correctly finishes when the chain tip is reached. This is done by sending recent sync lengths to the `SyncStatus` instance, and checking that every time a separate `SyncStatus` instance determines it has reached the tip the original instance wakes up.
b0b0f75
to
7217936
Compare
I added a proptest to check if the I limited the number of proptest cases so that it runs in around 10 seconds locally. We could reduce this number further or reduce the |
The code added isn't used yet, so we'll add a temporary waiver until another PR is merged to use them.
/// The maximum time to wait for an event to be received. | ||
/// | ||
/// If an event is not received in this time, it is considered that it will never be received. | ||
const EVENT_TIMEOUT: Duration = Duration::from_millis(5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5ms might be too short for heavily loaded VMs, but let's see how it goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let's see how these tests go in CI.
Motivation
For some mempool tasks and to decide if new block commit advertisements should be sent, it is necessary to know if the synchronizer has finished and is at (or close to) the chain tip.
Solution
A helper type to determine if the synchronizer is close to the chain tip or not was created, and it has methods to check if it has likely reached the chain tip and to wait until it reaches the chain tip.
Review
@teor2345 was already following the development of this as part of the mempool crawler PR.
Reviewer Checklist
Follow Up Work