From 391be2095ec12f27a00d9fbc9780af9f2ba80245 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 22 Apr 2024 14:31:35 +0800 Subject: [PATCH] feat(prover): improve guardian prover `SendStartup` logs (#744) --- .../guardian_prover.go | 18 ++++++++---------- .../guardian_prover_heartbeater/interface.go | 2 +- prover/prover.go | 6 ++++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/prover/guardian_prover_heartbeater/guardian_prover.go b/prover/guardian_prover_heartbeater/guardian_prover.go index eb9ca627b..45a619c1a 100644 --- a/prover/guardian_prover_heartbeater/guardian_prover.go +++ b/prover/guardian_prover_heartbeater/guardian_prover.go @@ -105,8 +105,8 @@ func (s *GuardianProverHeartBeater) SignAndSendBlock(ctx context.Context, blockI return nil } -// SendStartup sends the startup message to the health check server. -func (s *GuardianProverHeartBeater) SendStartup( +// SendStartupMessage sends the startup message to the health check server. +func (s *GuardianProverHeartBeater) SendStartupMessage( ctx context.Context, revision string, version string, @@ -114,7 +114,7 @@ func (s *GuardianProverHeartBeater) SendStartup( l2NodeVersion string, ) error { if s.healthCheckServerEndpoint == nil { - log.Info("No health check server endpoint set, returning early") + log.Warn("No health check server endpoint set, returning early") return nil } @@ -131,23 +131,21 @@ func (s *GuardianProverHeartBeater) SendStartup( return err } - req := &startupReq{ + if err := s.post(ctx, "startup", &startupReq{ Revision: revision, GuardianVersion: version, L1NodeVersion: l1NodeVersion, L2NodeVersion: l2NodeVersion, ProverAddress: s.proverAddress.Hex(), Signature: sig, - } - - if err := s.post(ctx, "startup", req); err != nil { + }); err != nil { return err } log.Info( - "Guardian prover successfully sent startup", - "revision", revision, - "version", version, + "Guardian prover successfully sent the startup message", + "l1NodeVersion", l1NodeVersion, + "l2NodeVersion", l2NodeVersion, ) return nil diff --git a/prover/guardian_prover_heartbeater/interface.go b/prover/guardian_prover_heartbeater/interface.go index 1c0939c1e..2f16670cf 100644 --- a/prover/guardian_prover_heartbeater/interface.go +++ b/prover/guardian_prover_heartbeater/interface.go @@ -8,7 +8,7 @@ import ( // BlockSigner defines an interface that communicates with a central Guardian Prover server, sending signed blocks. type BlockSigner interface { SignAndSendBlock(ctx context.Context, blockID *big.Int) error - SendStartup( + SendStartupMessage( ctx context.Context, revision string, version string, diff --git a/prover/prover.go b/prover/prover.go index 57ceed4a5..d630a115d 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -225,16 +225,18 @@ func (p *Prover) Start() error { // 3. Start the guardian prover heartbeat sender if the current prover is a guardian prover. if p.IsGuardianProver() && p.cfg.GuardianProverHealthCheckServerEndpoint != nil { - if err := p.guardianProverHeartbeater.SendStartup( + // Send the startup message to the guardian prover health check server. + if err := p.guardianProverHeartbeater.SendStartupMessage( p.ctx, version.CommitVersion(), version.CommitVersion(), p.cfg.L1NodeVersion, p.cfg.L2NodeVersion, ); err != nil { - log.Error("Failed to send guardian prover startup", "error", err) + log.Error("Failed to send guardian prover startup message", "error", err) } + // Start the guardian prover heartbeat loop. go p.guardianProverHeartbeatLoop(p.ctx) }