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

feat(prover): improve guardian prover SendStartup logs #744

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading