-
Notifications
You must be signed in to change notification settings - Fork 992
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
header_sync during reorg in excess of 512 headers (problematic behavior) #3615
Comments
Hmm - thinking a bit more about this and our current approach and proposed "fix" are still broken at a fundamental level. We cannot track a single We could have 3 peers all advertising different cumulative difficulty, each on an independent chain fork.
Build a locator from 1100C locally and ask peer A for headers then we will receive -
We can then update our Build a locator from 1512A locally and ask peer B for headers then we will receive -
The locator provides enough information to peer B to start sending headers from the common header. But we cannot progress along either fork unless we somehow track the "head" of each fork. The above example uses two forks in parallel competing with a single local chain. but the same issue is also present with a single fork, just a bit more subtle. |
Maybe less of an issue than I was thinking though as we do choose a "most work peer" to sync headers from, so this logic should pick the "correct" chain given what we know about connected peers at a given point in time. We do get into problems if we have competing chains with similar cumulative diff (total work). |
Related #3605
We need to investigate how header_sync behaves in the presence of a large reorg.
It appears we do not sync to the good chain correctly and peers are banned due to "fraud height".
Interestingly/coincidentally - the "sync MMR" was cleaned up on
master
in #3556.Note: sync head and sync MMR are both in use on
5.0.x
branch (so cleaning this up was not to blame...)The
sync_head
vs.header_head
concept never worked 100% reliably and the cleanup was done to simplify this code.There is a legitimate reason to keep track of
sync_head
though during header_sync of a large reorg.I don't think this warrants maintaining a full MMR structure (see PR above for cleanup) but we can simply "rewind and reapply" based on a sync_head in the db.
During header sync we want to request headers based on our local
sync_head
which may be both different and lower in cumulative difficulty relative to the best knownheader_head
.So we actually request the wrong headers due to how we construct the "locator" relative to our local
header_head
.And then we ban the peer because they don't send us useful headers.
The text was updated successfully, but these errors were encountered: