Skip to content

feat: refactor token verifier factory - #1365

Open
huangzhen1997 wants to merge 3 commits into
mainfrom
NONEVM-5852/export-token-verifier-factory
Open

feat: refactor token verifier factory#1365
huangzhen1997 wants to merge 3 commits into
mainfrom
NONEVM-5852/export-token-verifier-factory

Conversation

@huangzhen1997

@huangzhen1997 huangzhen1997 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Export the token verifier factory to support standalone mode token verifier in chain family repo.

Copilot AI lite review requested due to automatic review settings August 20, 2026 02:42
@huangzhen1997
huangzhen1997 requested a review from a team as a code owner August 20, 2026 02:42
@github-actions

Copy link
Copy Markdown

👋 huangzhen1997, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@huangzhen1997
huangzhen1997 force-pushed the NONEVM-5852/export-token-verifier-factory branch from 4b35ed7 to c9940de Compare August 20, 2026 02:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces configurable resilience policies for indexer “resilient readers” (rate limiting / bulkhead / circuit breaker / timeouts) via top-level indexer config, and refactors the token verifier binary to use a shared service-factory implementation in cmd/verifier.

Changes:

  • Add [Resilience] to indexer config and plumb the resulting settings through indexer reader construction (REST + Aggregator).
  • Introduce readers.NewResilienceConfig(config.ResilienceConfig) plus unit tests to default/override resilience settings.
  • Refactor cmd/verifier/token to use a new cmd/verifier/tokenfactory.go service factory (moving the previous in-main implementation).

Reviewed changes

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

Show a summary per file
File Description
indexer/pkg/readers/rest_reader.go Accept resilience policies via RestReaderConfig and pass through to resilient wrapper
indexer/pkg/readers/rest_reader_test.go Update REST reader tests to pass resilience config explicitly
indexer/pkg/readers/resilient_reader.go Add config-to-reader resilience translation helper (NewResilienceConfig)
indexer/pkg/readers/resilient_reader_test.go New unit tests for resilience translation/defaulting behavior
indexer/pkg/readers/aggregator_reader.go Extend aggregator reader factory to accept resilience config and set discovery handlers
indexer/pkg/config/config.go Add Config.Resilience and define TOML-backed ResilienceConfig
indexer/config.example.toml Document example [Resilience] values
indexer/cmd/replay/main.go Thread resilience config into verifier/discovery reader creation
indexer/cmd/main.go Thread resilience config into verifier/discovery reader creation
cmd/verifier/tokenfactory.go New shared token-verifier ServiceFactory implementation
cmd/verifier/token/main.go Switch token verifier binary to use the new shared ServiceFactory

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/verifier/tokenfactory.go Outdated
Comment thread cmd/verifier/tokenfactory.go Outdated
Comment thread cmd/verifier/tokenfactory.go
Comment thread cmd/verifier/tokenfactory.go Outdated
@huangzhen1997
huangzhen1997 requested a review from a team August 20, 2026 03:15
@github-actions

Copy link
Copy Markdown

Code coverage report:

Package main NONEVM-5852/export-token-verifier-factory Diff
github.com/smartcontractkit/chainlink-ccv/aggregator 50.82% 50.86% +0.04%
github.com/smartcontractkit/chainlink-ccv/bootstrap 70.72% 70.72% +0.00%
github.com/smartcontractkit/chainlink-ccv/cli 59.12% 59.12% +0.00%
github.com/smartcontractkit/chainlink-ccv/cmd 47.00% 35.65% -11.35% ⚠️
github.com/smartcontractkit/chainlink-ccv/common 46.51% 46.51% +0.00%
github.com/smartcontractkit/chainlink-ccv/executor 42.80% 42.80% +0.00%
github.com/smartcontractkit/chainlink-ccv/indexer 35.55% 35.55% +0.00%
github.com/smartcontractkit/chainlink-ccv/integration 56.56% 56.56% +0.00%
github.com/smartcontractkit/chainlink-ccv/internal 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/migration 77.66% 77.66% +0.00%
github.com/smartcontractkit/chainlink-ccv/pkg 100.00% 100.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/pricer 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/protocol 63.06% 63.06% +0.00%
github.com/smartcontractkit/chainlink-ccv/tools 43.61% 43.61% +0.00%
github.com/smartcontractkit/chainlink-ccv/verifier 34.37% 34.36% -0.01%
Total 49.30% 49.00% -0.30%

Files added (in NONEVM-5852/export-token-verifier-factory):

  • github.com/smartcontractkit/chainlink-ccv/cmd/verifier/tokenfactory.go

Comment on lines +31 to +47
type tokenFactory struct {
bootstrap.ServiceFactory

coordinators []*verifier.Coordinator
httpServer *http.Server
lggr logger.Logger
}

// NewTokenVerifierServiceFactory creates a new ServiceFactory for the token verifier service.
// The factory loads the verifier secrets file itself in Start, so each chain-family binary's
// main.go stays free of secrets-loading boilerplate.
func NewTokenVerifierServiceFactory() bootstrap.ServiceFactory {
return &tokenFactory{}
}

// Stop tries to stop all services gracefully.
func (tvf *tokenFactory) Stop(_ context.Context) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tiny nit: tvf let's sync naming convention :) looks like it used to be tokenVerifierFactory and renamed to tokenFactory

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.

4 participants