From 0111cf55d4d518eb3984232461c7c542d4c7d428 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 16 Jun 2023 10:14:23 +0800 Subject: [PATCH] feat(driver): improve error messages --- driver/chain_syncer/beaconsync/syncer.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/driver/chain_syncer/beaconsync/syncer.go b/driver/chain_syncer/beaconsync/syncer.go index bffbb0957..f955e54f6 100644 --- a/driver/chain_syncer/beaconsync/syncer.go +++ b/driver/chain_syncer/beaconsync/syncer.go @@ -52,6 +52,19 @@ func (s *Syncer) TriggerBeaconSync() error { ) } + // Keep the heartbeat with L2 execution engine. + fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(s.ctx, &engine.ForkchoiceStateV1{ + HeadBlockHash: s.progressTracker.LastSyncedVerifiedBlockHash(), + SafeBlockHash: s.progressTracker.LastSyncedVerifiedBlockHash(), + FinalizedBlockHash: s.progressTracker.LastSyncedVerifiedBlockHash(), + }, nil) + if err != nil { + return err + } + if fcRes.PayloadStatus.Status != engine.SYNCING { + return fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) + } + return nil } @@ -76,7 +89,7 @@ func (s *Syncer) TriggerBeaconSync() error { return err } if fcRes.PayloadStatus.Status != engine.SYNCING { - return fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", status.Status) + return fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) } // Update sync status.