-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
eth/downloader: fix error aggregator #27217
Conversation
To clarify.. if the sequence of errors is The outer handling looks like this: // If the downloader fails, report an error as in beacon chain mode there
// should be no errors as long as the chain we're syncing to is valid.
if err := b.downloader.synchronise("", common.Hash{}, nil, nil, mode, true, b.started); err != nil {
log.Error("Beacon backfilling failed", "err", err)
return
}
// Synchronization succeeded. Since this happens async, notify the outer
// context to disable snap syncing and enable transaction propagation.
if b.success != nil {
b.success()
} So the original code would flag this as succeeded, whereas this PR would (correctly) mark it as backfilling failed. |
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.
LGTM
@karalabe ptal |
The original code was somewhat the same as the one being corrected to now: 7641bbe#diff-80cc409bf7f1e4a3d19174ed878e4dcb3d40b19b6e0580bd3816a174c57e0fb2L558 |
Is there a reason to have this special case of checking for cancel and doing a break if not, or could we just break out even in case of a cancel (i.e. the original code). Feels a bit convoluted why cancel is special cased. |
Because whenever error occurs, all components will be aborted with errCancel returned. We special handle the errCancel in order to dig out the real error message. |
Yep |
SGTM? |
This reverts commit 79a57d4.
This reverts commit 0b42d42.
This reverts commit 0b42d42.
This PR fixes an incorrect error aggregation in downloader.
Downloader has a few components used to sync up chain. Whenever an error occurs in any of
these components, the sync procedure needs to be aborted and the error is expected to be
bubbled up. This error is an important marker, one use case is as an indicator if transactions
from network should be accepted or not.
However this error aggregation is wrong. Previously the aggregated error is always overwritten
by the returned value from components, but the fact is some components(e.g. processFullSyncContent)
won't return error in some cases.
This PR fixes this error, and I believe it can prevent accepting transactions when syncing.