Skip to content
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

integrate bridge with polygon sync stage #11195

Closed
taratorio opened this issue Jul 16, 2024 · 0 comments · Fixed by #11606
Closed

integrate bridge with polygon sync stage #11195

taratorio opened this issue Jul 16, 2024 · 0 comments · Fixed by #11606
Assignees
Labels

Comments

@taratorio
Copy link
Member

taratorio commented Jul 16, 2024

  • initialise bridge with "polygon sync stage bridge store" - need to do it outside of "NewPolygonSyncStageCfg" and in backend.go where we initialise the bridge
  • remove "if bridge != nil" checks in "polygonSyncStageService"
  • remove "polygonSyncStageSyncStore" and simply use "polygonsync.NewStore()" with the sync stage bridge and execution engine
  • remove "bridge.ProcessNewBlocks" in polygon sync stage execution engine - not needed since it is handled by the polygonsync.NewStore()
@taratorio taratorio added imp1 High importance astrid labels Jul 16, 2024
@taratorio taratorio self-assigned this Jul 16, 2024
@taratorio taratorio added the complexity:low Issue will take up to several days to fix label Jul 19, 2024
shohamc1 pushed a commit that referenced this issue Jul 31, 2024
Fix for below nil ptr in the new polygon sync stage using Astrid.

Gist of fix: move call of `downloadStateSyncEvents(header)` to the
stage's `updateForkChoice` handler instead of the `insertBlocks`
handler. The reason for this is because `downloadStateSyncEvents` uses
`blockReader.HeaderByNumber` before `Indore` fork and that requires the
canonical hash at each block height to be set before calling it. This is
done by `fixCanonicalChain` and we only call that in the
`updateForkChoice` handler so `downloadStateSyncEvents` needs to be
called after it.

Note: `downloadStateSyncEvents` will be removed and replaced by
integrating the bridge in the new polygon sync stage as part of
#11195 but for now would
prefer to do this fix to unblock myself.

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x1d8 pc=0x106a01e9c]

goroutine 116 [running]:
github.com/erigontech/erigon/eth/stagedsync.fetchAndWriteHeimdallStateSyncEvents({_, _}, _, _, {_, _}, _, {_, _}, {_, ...}, ...)
        /Users/taratorio/erigon3-run/eth/stagedsync/bor_heimdall_shared.go:435 +0x15c
github.com/erigontech/erigon/eth/stagedsync.fetchRequiredHeimdallStateSyncEventsIfNeeded({_, _}, _, {_, _}, _, {_, _}, {_, _}, ...)
        /Users/taratorio/erigon3-run/eth/stagedsync/bor_heimdall_shared.go:390 +0x130
github.com/erigontech/erigon/eth/stagedsync.(*polygonSyncStageExecutionEngine).downloadStateSyncEvents(0x14001a32b08, {0x107b60a00, 0x14001747db0}, {0x107b92b30, 0x140017b0600}, 0x140010982c8, 0x14001757900)
        /Users/taratorio/erigon3-run/eth/stagedsync/stage_polygon_sync.go:904 +0x1cc
github.com/erigontech/erigon/eth/stagedsync.(*polygonSyncStageExecutionEngine).insertBlocks(0x14001a32b08, {0x107b60a00, 0x14001747db0}, {0x140013d0000, 0x1072, 0x140021e1a38?}, {0x107b92b30, 0x140017b0600})
        /Users/taratorio/erigon3-run/eth/stagedsync/stage_polygon_sync.go:771 +0x344
github.com/erigontech/erigon/eth/stagedsync.(*polygonSyncStageExecutionEngine).InsertBlocks.func1({0x107b92b30?, 0x140017b0600?}, 0x14001b8c420)
        /Users/taratorio/erigon3-run/eth/stagedsync/stage_polygon_sync.go:719 +0x54
github.com/erigontech/erigon/eth/stagedsync.awaitTxAction[...].func1()
        /Users/taratorio/erigon3-run/eth/stagedsync/stage_polygon_sync.go:949 +0x30
github.com/erigontech/erigon/eth/stagedsync.(*polygonSyncStageService).Run(0x14000bfecb0, {0x107b60a00, 0x14001747450}, {0x107b92b30, 0x140017b0600}, 0x14000faaa20, {0x107b5b010, 0x14001a6e580})
        /Users/taratorio/erigon3-run/eth/stagedsync/stage_polygon_sync.go:240 +0x330
github.com/erigontech/erigon/eth/stagedsync.SpawnPolygonSyncStage({0x107b60a00?, 0x14001747450?}, {0x0, 0x0?}, 0x14000faaa20?, {0x107b5b010?, 0x14001a6e580?}, {{0x107b77250?, 0x14001a92048?}, 0x14000bfecb0?})
        /Users/taratorio/erigon3-run/eth/stagedsync/stage_polygon_sync.go:160 +0x108
github.com/erigontech/erigon/eth/stagedsync.PolygonSyncStages.func4(0x80?, 0x106c50a6f?, {0x107b5b010?, 0x14001a6e580?}, {{0x0, 0x0}, {0x0, 0x0}, 0x0}, {0x107b75f48?, ...})
        /Users/taratorio/erigon3-run/eth/stagedsync/default_stages.go:479 +0x6c
github.com/erigontech/erigon/eth/stagedsync.(*Sync).runStage(0x14001a6e580, 0x14001a24a50, {0x107b77250, 0x14001a92048}, {{0x0, 0x0}, {0x0, 0x0}, 0x0}, 0x1, ...)
        /Users/taratorio/erigon3-run/eth/stagedsync/sync.go:529 +0x118
github.com/erigontech/erigon/eth/stagedsync.(*Sync).Run(0x14001a6e580, {0x107b77250, 0x14001a92048}, {{0x0, 0x0}, {0x0, 0x0}, 0x0}, 0x0?, 0x1)
        /Users/taratorio/erigon3-run/eth/stagedsync/sync.go:413 +0x21c
github.com/erigontech/erigon/turbo/stages.ProcessFrozenBlocks({0x107b60a00, 0x14001747450}, {0x107b77250, 0x14001a92048}, {0x107b96960, 0x14001a9a020}, 0x14001a6e580)
        /Users/taratorio/erigon3-run/turbo/stages/stageloop.go:141 +0x84
github.com/erigontech/erigon/turbo/stages.StageLoop({0x107b60a00, 0x14001747450}, {0x107b77250, 0x14001a92048}, 0x14001a6e580, 0x14000dc2200, 0x0?, 0x0, {0x107b75f48, 0x14000d7ab00}, ...)
        /Users/taratorio/erigon3-run/turbo/stages/stageloop.go:76 +0x8c
created by github.com/erigontech/erigon/eth.(*Ethereum).Start in goroutine 1
        /Users/taratorio/erigon3-run/eth/backend.go:1556 +0x53c

Process finished with the exit code 2
```
@mh0lt mh0lt added imp2 Medium importance and removed imp1 High importance labels Aug 9, 2024
@taratorio taratorio removed imp2 Medium importance complexity:low Issue will take up to several days to fix labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants