fix(eth/downloader): avoid blocking completed state sync spindown#2278
fix(eth/downloader): avoid blocking completed state sync spindown#2278gzliudan wants to merge 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
Stop waiting for timeout or delivery events after a state sync has already completed. Add a regression test to ensure completed spindown returns promptly and resets peer idleness.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a state-sync shutdown (spindown) hang in the downloader by short-circuiting the spindown path when the state sync has already completed, preventing tests (and potentially sync) from blocking until timeouts or late deliveries occur.
Changes:
- Extend
spindownStateSyncto accept acompletedflag and return immediately after marking peers idle when the state sync is already done. - Update the
runStateSynclifecycle handling to invoke spindown withcompleted=trueons.done. - Add a regression test ensuring completed spindown returns promptly and resets peer idleness.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
eth/downloader/statesync.go |
Avoids blocking spindown after completion by stopping timers, marking peers idle, and returning early. |
eth/downloader/downloader_test.go |
Adds a regression test to ensure completed spindown does not block and clears stateIdle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed changes
Stop waiting for timeout or delivery events after a state sync has already completed. Add a regression test to ensure completed spindown returns promptly and resets peer idleness.
error messages:
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that