-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
polygon/sync: initialise canonical chain builder correctly (#12246)
This PR captures several todos on my list of improving things related to Milestone hash mismatches that I noticed while testing Astrid on the tip: - after restarts, when we initialise the canonical chain builder, we need to set the root to the last finalised waypoint header and connect the latest known tip to it. Previously, we set the root to the latest known tip which may not be the finalised one. This caused unnecessary unwinds on startup (with potentially incorrect unwind num for the bridge.Unwind) and although we auto recover from it it is still better to fix it properly as it may cause unexpected behaviour further down the line - harden the milestone verifier to check for correct header connectivity via ParentHash and Number and also that the number of headers match with the number of headers in the Milestone because the Milestone is simply just the last header hash so a malicious peer may trick us easily - revert #11929 which, after taking a deeper look, seems to be an inaccurate interpretation of the error (prune of TD happens only for the blocks T-150_000). I believe this error may have been caused by something else, which may have been fixed by now (after numerous fixes to Astrid related to the parent td errors) - but if not it will be better to troubleshoot more thoroughly if the error ever arises again. In addition, this change is dangerous as it means we may falsely think we have all blocks for a given waypoint inserted in the DB, however that may not be true on restarts in the middle of waypoints, because the blocks inserted before the start may not be the right ones that are part of the waypoint (due to the tip not yet being finalised)
- Loading branch information
Showing
8 changed files
with
206 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.