-
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.
astrid stage: do not unwind finalized data (#11999)
relates to: #11533 but mainly fixes an issue at tip that appeared in a run of astrid stage integration: - we fetched event 2900 as soon as it appeared - this event was meant to be assigned to block 11962480 ``` DBUG[09-14|13:57:41.878] [bridge] fetched new events periodic progress count=1 lastFetchedEventID=2900 lastFetchedEventTime=2024-09-14T12:57:35Z ``` - we then had a change of forks ``` INFO[09-14|13:58:31.961] [2/6 PolygonSync] new fork - unwinding and caching fork choice unwindNumber=11962436 badHash=0x7e377810370189ece829b48172cc464672393678142cf105aad9212736893b8d cachedTipNumber=11962437 cachedTipHash=0x5076be24d339b5d75b52659dc746d3ceaa3d8dd873f3c34e5655849787d03d2b cachedNewNodes=1 DBUG[09-14|13:58:31.961] UnwindTo block=11962436 block_hash=0x7e377810370189ece829b48172cc464672393678142cf105aad9212736893b8d err=nil stack="[sync.go:171 stage_polygon_sync.go:1437 stage_polygon_sync.go:1390 stage_polygon_sync.go:1609 stage_polygon_sync.go:497 stage_polygon_sync.go:176 default_stages.go:479 sync.go:531 sync.go:410 stageloop.go:249 stageloop.go:101 asm_arm64.s:1222]" ``` - when that happened we unwound the stages and deleted event 2900 (below is from a debug print statement which says - unwind everything > prevSprintLastID) ``` UNWIND prevSprintLastID:2899 ``` - then when the bridge bridge processed block 11962480, the event was not in the DB as it was deleted due to the unwind and the bridge was not aware that it needs to re-fetch it ``` DBUG[09-14|14:00:01.052] [bridge] processing new blocks from=11962480 to=11962480 lastProcessedBlockNum=11962464 lastProcessedBlockTime=1726318767 lastProcessedEventID=2899 ``` - this led to wrong trie root error when block 11962480 was executed ``` EROR[09-14|14:00:01.073] [4/6 Execution] Wrong trie root of block 11962480: 03f9ebde441d041283b85d3cbc3f8fcf240904ae8fa3d28292dd0d6b0f0766a5, expected (from header): c9b520cb589f90323ceb99980658ea7bcc0ffefef0af8d08b74f809a297e31ac. Block hash: 603c84c5e517fd3fefab90a86d9e3acf19cc426886d3c37b4e45679a1659fd6b ``` Long term solution is to handle unwinds via the Astrid components for the Bridge (events) and Heimdall (spans,checkpoints,milestones) so that they are aware of it and need to re-fetch if needed. However, one of the observations for that is that actually events, spans,checkpoints,milestones are fully finalised data that does not need to be unwound. They come from heimdall's tendermint BFT consensus which has single block finality. All the APIs that we use to scrape the data are for finalised data. The only thing that is needed to be unwound is tables that we have that rely on bor blocks (as they can unwind due to bor forking, e.g. BorEventNums, BorEventProcessedBlocks). This PR is a step in that direction, but it also fixes the above issue at chain tip (since we would not unwind unassigned events). It introduces HeimdallUnwindCfg for the Astrid stage and the Bor Heimdall stage. In the Astrid stage we configure it to not unwind events, spans, checkpoints and milestones (only BorEventNums and BorEventProcessedBlocks tables), while in Stage Bor Heimdall we leave it as is - unwinding everything. The `integration stage_polygon_sync --unwind` cmd can override the default behaviour if needed by using the `--unwindTypes` override.
- Loading branch information
Showing
5 changed files
with
151 additions
and
35 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