Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Delay beefy worker initialization while network is on major sync #10705

Closed

Conversation

Wizdave97
Copy link
Contributor

@Wizdave97 Wizdave97 commented Jan 20, 2022

@Wizdave97 Wizdave97 force-pushed the david/delay-beefy-on-major-sync branch from bb31f47 to b7e28d4 Compare January 20, 2022 10:56
@acatangiu acatangiu added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Jan 24, 2022
@@ -400,6 +409,11 @@ where
));

loop {
if self.sync_oracle.is_major_syncing() {
debug!(target: "beefy", "Skipping initialization due to sync.");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not necessarily initialization, it is the main loop of the worker. I would rephrase to smth like:

Suggested change
debug!(target: "beefy", "Skipping initialization due to sync.");
debug!(target: "beefy", "Waiting for major sync to complete.");

Comment on lines 116 to 117
N: GossipNetwork<B> + Clone + Send + 'static,
SO: SyncOracle + Send + Sync + Clone + 'static,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would these two ever be provided by different objects? If not, I think it would make sense to simply squash them together, they're both mandatory anyway...

Comment on lines 453 to 458
if sync_oracle.is_major_syncing() {
Poll::Pending
} else {
Poll::Ready(())
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

this function has no way of knowing when the sync is over, i suggest adding it to the sync_oracle itself

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if it's rescheduled for polling with cx.waker().wake_by_ref() before returning pending, Would that be fine?

) -> impl future::Future<Output = ()> {
return future::poll_fn(move |cx| {
if sync_oracle.is_major_syncing() {
cx.waker().wake_by_ref();
Copy link
Contributor

Choose a reason for hiding this comment

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

this is equivalent to a busy-wait loop, right? Like @seunlanlege said, this future needs to be tied to the sync_oracle waker.

@acatangiu acatangiu removed B0-silent Changes should not be mentioned in any release notes D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Jan 28, 2022
@stale
Copy link

stale bot commented Feb 27, 2022

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Feb 27, 2022
@seunlanlege
Copy link
Contributor

Bump

@stale stale bot removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Feb 27, 2022
@acatangiu
Copy link
Contributor

Alternative PR #10882 merged

@acatangiu acatangiu closed this Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initialize BeefyWorker validator set id for out-of-sync BEEFY gadget/client
3 participants