Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(prover): improve guardian prover SendStartup logs (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Apr 22, 2024
1 parent d9b6c7c commit 391be20
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
18 changes: 8 additions & 10 deletions prover/guardian_prover_heartbeater/guardian_prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ 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,
l1NodeVersion string,
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
}

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion prover/guardian_prover_heartbeater/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 391be20

Please sign in to comment.