From c2ac046ddb8d4ccb549741ef197b945c330bac45 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Thu, 13 Nov 2025 10:22:36 -0500 Subject: [PATCH] Introduce CCVProvider interface. --- .../pkg/constructors/committee_verifier.go | 5 ++-- integration/pkg/constructors/executor.go | 7 ++--- integration/pkg/constructors/provider.go | 28 +++++++++++++++++++ 3 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 integration/pkg/constructors/provider.go diff --git a/integration/pkg/constructors/committee_verifier.go b/integration/pkg/constructors/committee_verifier.go index e3b63d33..85ab6970 100644 --- a/integration/pkg/constructors/committee_verifier.go +++ b/integration/pkg/constructors/committee_verifier.go @@ -18,7 +18,6 @@ import ( "github.com/smartcontractkit/chainlink-ccv/verifier/pkg/monitoring" "github.com/smartcontractkit/chainlink-common/pkg/beholder" "github.com/smartcontractkit/chainlink-common/pkg/logger" - "github.com/smartcontractkit/chainlink-evm/pkg/chains/legacyevm" ) // NewVerificationCoordinator starts the Committee Verifier with evm chains. @@ -28,7 +27,7 @@ func NewVerificationCoordinator( cfg verifier.Config, signingAddress protocol.UnknownAddress, signer verifier.MessageSigner, - relayers map[protocol.ChainSelector]legacyevm.Chain, + providers map[protocol.ChainSelector]CCVProvider, ) (*verifier.Coordinator, error) { if err := cfg.Validate(); err != nil { lggr.Errorw("Invalid CCV verifier configuration.", "error", err) @@ -60,7 +59,7 @@ func NewVerificationCoordinator( sourceReaders := make(map[protocol.ChainSelector]verifier.SourceReader) sourceConfigs := make(map[protocol.ChainSelector]verifier.SourceConfig) headTrackers := make(map[protocol.ChainSelector]chainaccess.HeadTracker) - for sel, chain := range relayers { + for sel, chain := range providers { if _, ok := onRampAddrs[sel]; !ok { lggr.Warnw("No onramp address for chain, skipping.", "chainID", sel) continue diff --git a/integration/pkg/constructors/executor.go b/integration/pkg/constructors/executor.go index 8cf7a3fe..ffb88ab5 100644 --- a/integration/pkg/constructors/executor.go +++ b/integration/pkg/constructors/executor.go @@ -16,7 +16,6 @@ import ( "github.com/smartcontractkit/chainlink-ccv/protocol" "github.com/smartcontractkit/chainlink-common/pkg/beholder" "github.com/smartcontractkit/chainlink-common/pkg/logger" - "github.com/smartcontractkit/chainlink-evm/pkg/chains/legacyevm" "github.com/smartcontractkit/chainlink-evm/pkg/keys" x "github.com/smartcontractkit/chainlink-ccv/executor/pkg/executor" @@ -26,8 +25,8 @@ import ( func NewExecutorCoordinator( lggr logger.Logger, cfg executor.Configuration, - // TODO: all these are EVM specific, shouldn't be. - relayers map[protocol.ChainSelector]legacyevm.Chain, + providers map[protocol.ChainSelector]CCVProvider, + // TODO: move to CCV provider. Keys are not part of the keystore, so a container object is needed. keys map[protocol.ChainSelector]keys.RoundRobin, fromAddresses map[protocol.ChainSelector][]common.Address, ) (*executor.Coordinator, error) { @@ -39,7 +38,7 @@ func NewExecutorCoordinator( transmitters := make(map[protocol.ChainSelector]executor.ContractTransmitter) destReaders := make(map[protocol.ChainSelector]executor.DestinationReader) - for sel, chain := range relayers { + for sel, chain := range providers { if _, ok := offRampAddresses[sel]; !ok { lggr.Warnw("No offramp configured for chain, skipping.", "chainID", sel) continue diff --git a/integration/pkg/constructors/provider.go b/integration/pkg/constructors/provider.go new file mode 100644 index 00000000..38e030a6 --- /dev/null +++ b/integration/pkg/constructors/provider.go @@ -0,0 +1,28 @@ +package constructors + +import ( + "github.com/smartcontractkit/chainlink-evm/pkg/client" + "github.com/smartcontractkit/chainlink-evm/pkg/heads" + "github.com/smartcontractkit/chainlink-evm/pkg/txmgr" +) + +// CCVProvider is a work in progress! It will eventually become the chain agnostic interface implemented +// by all chain families to support the Committee Verifier and Executor services. For now it reflects +// the EVM-Centric nature of the initial implementation and is a simple downcast of the legacyevm.Chain +// object. +// +// Note: many of the chainlink-evm objects used here already have a generic interface in the +// chainlink-frameworks library. The way generics are used prevents us from using them in a polymorphic way. +// This means some sort of adapter will be required for each chain type we want to support. +// Until that adapter interface exists, we only support EVM. +// +// Next steps: +// - Identify the full set of functions required by client.Client, heads.Tracker and txmg.TxManager +// - Redefine those functions in this interface, using protocol types where possible. +// - Create an adapter layer for legacyevm.Chain that implements this interface. +// - Define a LOOPP client for this interface. +type CCVProvider interface { + Client() client.Client // verifier, executor + HeadTracker() heads.Tracker // verifier + TxManager() txmgr.TxManager // executor +}