Skip to content

Merge token main function files.#942

Merged
winder merged 1 commit intomainfrom
will/workaround-docker-stuff
Mar 17, 2026
Merged

Merge token main function files.#942
winder merged 1 commit intomainfrom
will/workaround-docker-stuff

Conversation

@winder
Copy link
Collaborator

@winder winder commented Mar 17, 2026

There were some external dependencies which prevented #937 from working as expected. This should workaround the issue by putting all dependencies in a single file.

@github-actions
Copy link

Code coverage report:

Package main will/workaround-docker-stuff diff
github.com/smartcontractkit/chainlink-ccv/aggregator 48.04% 48.04% +0.00%
github.com/smartcontractkit/chainlink-ccv/bootstrap 42.35% 42.35% +0.00%
github.com/smartcontractkit/chainlink-ccv/cmd 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/committee 0.00% 100.00% +100.00%
github.com/smartcontractkit/chainlink-ccv/common 0.00% 52.89% +52.89%
github.com/smartcontractkit/chainlink-ccv/executor 0.00% 49.11% +49.11%
github.com/smartcontractkit/chainlink-ccv/indexer 0.00% 39.06% +39.06%
github.com/smartcontractkit/chainlink-ccv/integration 0.00% 45.57% +45.57%
github.com/smartcontractkit/chainlink-ccv/pkg 0.00% 100.00% +100.00%
github.com/smartcontractkit/chainlink-ccv/pricer 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/protocol 0.00% 67.76% +67.76%
github.com/smartcontractkit/chainlink-ccv/verifier 0.00% 36.30% +36.30%

WARNING: go tool cover failed for coverage_target.out
cover: open /home/runner/_work/chainlink-ccv/chainlink-ccv/cmd/verifier/token/servicefactory.go: no such file or directory

@winder winder marked this pull request as ready for review March 17, 2026 18:29
@winder winder requested review from a team and skudasov as code owners March 17, 2026 18:29
Copilot AI review requested due to automatic review settings March 17, 2026 18:29
@winder winder enabled auto-merge March 17, 2026 18:29
@winder winder added this pull request to the merge queue Mar 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates the token verifier bootstrap/service wiring by removing the standalone servicefactory.go and inlining the tokenVerifierFactory implementation and helper coordinator builders into cmd/verifier/token/main.go.

Changes:

  • Removed cmd/verifier/token/servicefactory.go.
  • Moved the token verifier service factory (Start/Stop), coordinator creation, and source config building into cmd/verifier/token/main.go.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
cmd/verifier/token/servicefactory.go Deleted; its service factory/coordinator wiring is moved into main.go.
cmd/verifier/token/main.go Now contains the token verifier service factory implementation and helper functions for coordinator/source config setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +58 to +75
// Graceful shutdown
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 30*time.Second)
defer shutdownCancel()

var errs []error
if err := tvf.httpServer.Shutdown(shutdownCtx); err != nil {
tvf.lggr.Errorw("HTTP server shutdown error", "error", err)
errs = append(errs, fmt.Errorf("HTTP server shutdown error: %w", err))
}

for _, coordinator := range tvf.coordinators {
if err := coordinator.Close(); err != nil {
tvf.lggr.Errorw("Coordinator shutdown error", "error", err)
errs = append(errs, fmt.Errorf("coordinator shutdown error: %w", err))
}
}

tvf.lggr.Infow("Token verifier service stopped gracefully")
Comment on lines +129 to +137
db, err := cmd.ConnectToPostgresDB(tvf.lggr)
if err != nil {
tvf.lggr.Errorw("Failed to connect to Postgres database", "error", err)
os.Exit(1)
}

postgresStorage := storage.NewPostgres(db, tvf.lggr)
// Wrap storage with monitoring decorator to track query durations
monitoredStorage := storage.NewMonitoredStorage(postgresStorage, verifierMonitoring.Metrics())
Comment on lines +105 to +109
_, err = cmd.StartPyroscope(tvf.lggr, config.PyroscopeURL, "tokenVerifier")
if err != nil {
tvf.lggr.Errorw("Failed to start pyroscope", "error", err)
os.Exit(1)
}
Comment on lines +81 to +100
func (tvf *tokenVerifierFactory) Start(ctx context.Context, appConfig token.ConfigWithBlockchainInfos, deps bootstrap.ServiceDeps) error {
logLevelStr := os.Getenv("LOG_LEVEL")
if logLevelStr == "" {
logLevelStr = "info"
}
var zapLevel zapcore.Level
if err := zapLevel.UnmarshalText([]byte(logLevelStr)); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Invalid LOG_LEVEL '%s', defaulting to 'info'\n", logLevelStr)
zapLevel = zapcore.InfoLevel
}
var err error
tvf.lggr, err = logger.NewWith(logging.DevelopmentConfig(zapLevel))
if err != nil {
return fmt.Errorf("failed to create logger: %v", err)
}
tvf.lggr = logger.Named(tvf.lggr, "verifier")

// Use SugaredLogger for better API
tvf.lggr = logger.Sugared(tvf.lggr)

Comment on lines +48 to +54
type tokenVerifierFactory struct {
bootstrap.ServiceFactory[token.Config]

coordinators []*coordinator.Coordinator
httpServer *http.Server
lggr logger.Logger
}
Merged via the queue into main with commit 3bb1f19 Mar 17, 2026
28 checks passed
@winder winder deleted the will/workaround-docker-stuff branch March 17, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants