From cc2bd8e771441aa0c1dd98ec20b8e300cba578f6 Mon Sep 17 00:00:00 2001 From: giuliorebuffo Date: Fri, 16 Sep 2022 17:39:02 +0200 Subject: [PATCH 1/3] maybe fix --- eth/stagedsync/stage_headers.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index 34547752448..1dda010bd23 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -306,11 +306,8 @@ func startHandlingForkChoice( if header == nil { log.Info(fmt.Sprintf("[%s] Fork choice: need to download header with hash %x", s.LogPrefix(), headerHash)) - if test { - cfg.hd.BeaconRequestList.Remove(requestId) - } else { - schedulePoSDownload(requestId, headerHash, 0 /* header height is unknown, setting to 0 */, headerHash, s, cfg) - } + cfg.hd.BeaconRequestList.Remove(requestId) + schedulePoSDownload(requestId, headerHash, 0 /* header height is unknown, setting to 0 */, headerHash, s, cfg) return &engineapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil } @@ -436,8 +433,8 @@ func handleNewPayload( } if parent == nil { log.Info(fmt.Sprintf("[%s] New payload: need to download parent", s.LogPrefix()), "height", headerNumber, "hash", headerHash, "parentHash", header.ParentHash) + cfg.hd.BeaconRequestList.Remove(requestId) if test { - cfg.hd.BeaconRequestList.Remove(requestId) return &engineapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil } if !schedulePoSDownload(requestId, header.ParentHash, headerNumber-1, headerHash /* downloaderTip */, s, cfg) { From 2e0244fa3cd54c7d7c604477ebb3e340da101206 Mon Sep 17 00:00:00 2001 From: giuliorebuffo Date: Fri, 16 Sep 2022 17:40:24 +0200 Subject: [PATCH 2/3] maybe fix --- eth/stagedsync/stage_headers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index 1dda010bd23..bde0c1a0ba6 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -307,7 +307,9 @@ func startHandlingForkChoice( if header == nil { log.Info(fmt.Sprintf("[%s] Fork choice: need to download header with hash %x", s.LogPrefix(), headerHash)) cfg.hd.BeaconRequestList.Remove(requestId) - schedulePoSDownload(requestId, headerHash, 0 /* header height is unknown, setting to 0 */, headerHash, s, cfg) + if !test { + schedulePoSDownload(requestId, headerHash, 0 /* header height is unknown, setting to 0 */, headerHash, s, cfg) + } return &engineapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil } From c6123ed1ed432a9d5e69e2d6499a28f67a99b6e5 Mon Sep 17 00:00:00 2001 From: Igor Mandrigin Date: Sat, 17 Sep 2022 11:26:36 +0200 Subject: [PATCH 3/3] fix test sentry_mock --- turbo/stages/sentry_mock_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/turbo/stages/sentry_mock_test.go b/turbo/stages/sentry_mock_test.go index 9f01dd904e5..2ac5763525c 100644 --- a/turbo/stages/sentry_mock_test.go +++ b/turbo/stages/sentry_mock_test.go @@ -601,11 +601,17 @@ func TestPoSDownloader(t *testing.T) { require.NoError(t, err) stages.SendPayloadStatus(m.HeaderDownload(), headBlockHash, err) + // Since we are removing the current request to avoid the deadlock, we need to send the new payload (or fcu) request again. + m.SendPayloadRequest(chain.TopBlock) // Second cycle: process the previous beacon request headBlockHash, err = stages.StageLoopStep(m.Ctx, m.DB, m.Sync, 0, m.Notifications, initialCycle, m.UpdateHead, nil) require.NoError(t, err) stages.SendPayloadStatus(m.HeaderDownload(), headBlockHash, err) assert.Equal(t, chain.TopBlock.Hash(), headBlockHash) + // Second cycle: checking the response + payloadStatus = m.ReceivePayloadStatus() + assert.Equal(t, remote.EngineStatus_VALID, payloadStatus.Status) + assert.Equal(t, chain.TopBlock.Hash(), headBlockHash) // Point forkChoice to the head forkChoiceMessage := engineapi.ForkChoiceMessage{