-
Notifications
You must be signed in to change notification settings - Fork 144
fix(l1): retry head fetch during sync #5604
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
base: main
Are you sure you want to change the base?
Conversation
Lines of code reportTotal lines added: Detailed view |
crates/networking/p2p/sync.rs
Outdated
| return Ok(()); | ||
| } | ||
| attempts += 1; | ||
| tokio::time::sleep(Duration::from_millis(200)).await; |
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 is a lot of time to sleep. Maybe you should try an exponential backoff?
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.
Added in 2d7e667
crates/networking/p2p/sync.rs
Outdated
| return Ok(()); | ||
| } | ||
| attempts += 1; | ||
| tokio::time::sleep(Duration::from_millis(200)).await; |
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.
Ditto.
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.
Added in 2d7e667
Motivation
Currently one of the hive tests is failing, with the log
Sync failed to find target block header, aborting.This is because currently we only retry 5 times and (for low-latency scenarios like a testnet) without delay between the attempts. If the header isn't immediately available, we abort.
Description
This solves the problem by introducing a retry-with-delay logic.
The currently existing logic in
request_block_headers_from_hashis removed since it now becomes redundant.Checklist
STORE_SCHEMA_VERSION(crates/storage/lib.rs) if the PR includes breaking changes to theStorerequiring a re-sync.