From 949f376bc0e3772e8bd0ad3bad9ae5263c1b57b8 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 16 Jun 2023 11:21:10 +0800 Subject: [PATCH] feat(driver): improve error messages (#289) --- 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.