Skip to content
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
4 changes: 4 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ linters:
- gocyclo
- gosec
- revive
- path: build/devenv
linters:
- staticcheck
text: "testcontainers.BindMount is deprecated"
- path: 'pkg/handlers/validations\.go'
linters:
- gci
Expand Down
47 changes: 12 additions & 35 deletions aggregator/pkg/model/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (
"time"

"github.com/smartcontractkit/chainlink-ccv/aggregator/pkg/auth"
"github.com/smartcontractkit/chainlink-ccv/pkg/monitoring"
"github.com/smartcontractkit/chainlink-ccv/protocol"
hmacutil "github.com/smartcontractkit/chainlink-ccv/protocol/common/hmac"
)

// Signer represents a participant in the commit verification process.
type Signer struct {
Address string `toml:"address"`
Address string `json:"address" toml:"address"`
}

// SignerIdentifier holds the chain-native signer identifier.
Expand All @@ -44,9 +45,9 @@ type Committee struct {
// The aggregator uses this to verify signatures from each chain's
// commit verifier set.
// Map structure: source selector -> QuorumConfig
QuorumConfigs map[SourceSelector]*QuorumConfig `toml:"quorumConfigs"`
QuorumConfigs map[SourceSelector]*QuorumConfig `json:"quorumConfigs" toml:"quorumConfigs"`
// DestinationVerifiers maps destination chain selectors to their verifier contract addresses.
DestinationVerifiers map[DestinationSelector]string `toml:"destinationVerifiers"`
DestinationVerifiers map[DestinationSelector]string `json:"destinationVerifiers" toml:"destinationVerifiers"`
// destinationVerifiersParsed holds the parsed addresses, populated during validation.
destinationVerifiersParsed map[DestinationSelector]protocol.UnknownAddress
}
Expand Down Expand Up @@ -87,9 +88,9 @@ func (c *Committee) SetQuorumConfig(sourceSelector SourceSelector, quorumConfig

// QuorumConfig represents the configuration for a quorum of signers.
type QuorumConfig struct {
SourceVerifierAddress string `toml:"sourceVerifierAddress"`
Signers []Signer `toml:"signers"`
Threshold uint8 `toml:"threshold"`
SourceVerifierAddress string `json:"sourceVerifierAddress" toml:"sourceVerifierAddress"`
Signers []Signer `json:"signers" toml:"signers"`
Threshold uint8 `json:"threshold" toml:"threshold"`
// sourceVerifierAddressParsed holds the parsed address, populated during validation.
sourceVerifierAddressParsed protocol.UnknownAddress
}
Expand Down Expand Up @@ -361,35 +362,11 @@ func (c *RateLimitingConfig) getMostRestrictiveGroupLimit(client auth.ClientConf
return mostRestrictive
}

// MonitoringConfig provides monitoring configuration for aggregator.
type MonitoringConfig struct {
// Enabled enables the monitoring system.
Enabled bool `toml:"Enabled"`
// Type is the type of monitoring system to use (beholder, noop).
Type string `toml:"Type"`
// Beholder is the configuration for the beholder client (Not required if type is noop).
Beholder BeholderConfig `toml:"Beholder"`
}

// BeholderConfig wraps OpenTelemetry configuration for the beholder client.
type BeholderConfig struct {
// InsecureConnection disables TLS for the beholder client.
InsecureConnection bool `toml:"InsecureConnection"`
// CACertFile is the path to the CA certificate file for the beholder client.
CACertFile string `toml:"CACertFile"`
// OtelExporterGRPCEndpoint is the endpoint for the beholder client to export to the collector.
OtelExporterGRPCEndpoint string `toml:"OtelExporterGRPCEndpoint"`
// OtelExporterHTTPEndpoint is the endpoint for the beholder client to export to the collector.
OtelExporterHTTPEndpoint string `toml:"OtelExporterHTTPEndpoint"`
// LogStreamingEnabled enables log streaming to the collector.
LogStreamingEnabled bool `toml:"LogStreamingEnabled"`
// MetricReaderInterval is the interval to scrape metrics (in seconds).
MetricReaderInterval int64 `toml:"MetricReaderInterval"`
// TraceSampleRatio is the ratio of traces to sample.
TraceSampleRatio float64 `toml:"TraceSampleRatio"`
// TraceBatchTimeout is the timeout for a batch of traces.
TraceBatchTimeout int64 `toml:"TraceBatchTimeout"`
}
// Type aliases — canonical definitions live in pkg/monitoring.
type (
MonitoringConfig = monitoring.Config
BeholderConfig = monitoring.BeholderConfig
)

// AggregatorConfig is the root configuration for the pb.
type AggregatorConfig struct {
Expand Down
10 changes: 5 additions & 5 deletions build/devenv/cciptestinterfaces/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
tokensapi "github.com/smartcontractkit/chainlink-ccip/deployment/tokens"
"github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/adapters"
ccipChangesets "github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/changesets"
"github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/offchain"
devenvcommon "github.com/smartcontractkit/chainlink-ccv/build/devenv/common"
ccvdeployment "github.com/smartcontractkit/chainlink-ccv/deployment"
"github.com/smartcontractkit/chainlink-ccv/protocol"
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
Expand Down Expand Up @@ -295,7 +295,7 @@ type TokenConfigProvider interface {
env *deployment.Environment,
selector uint64,
remoteSelectors []uint64,
topology *offchain.EnvironmentTopology,
topology *ccvdeployment.EnvironmentTopology,
) ([]tokensapi.TokenTransferConfig, error)
}

Expand All @@ -312,15 +312,15 @@ type OnChainConfigurable interface {
// DeployChainContracts call (e.g. deploying CREATE2 factory on EVM).
// The returned DataStore is merged into env.DataStore before
// GetDeployChainContractsCfg is called.
PreDeployContractsForSelector(ctx context.Context, env *deployment.Environment, selector uint64, topology *offchain.EnvironmentTopology) (datastore.DataStore, error)
PreDeployContractsForSelector(ctx context.Context, env *deployment.Environment, selector uint64, topology *ccvdeployment.EnvironmentTopology) (datastore.DataStore, error)
// GetDeployChainContractsCfg returns the per-chain configuration for the
// common DeployChainContracts changeset. Called after Pre, so env.DataStore
// includes pre-deployed addresses (e.g. CREATE2 factory).
GetDeployChainContractsCfg(env *deployment.Environment, selector uint64, topology *offchain.EnvironmentTopology) (ccipChangesets.DeployChainContractsPerChainCfg, error)
GetDeployChainContractsCfg(env *deployment.Environment, selector uint64, topology *ccvdeployment.EnvironmentTopology) (ccipChangesets.DeployChainContractsPerChainCfg, error)
// PostDeployContractsForSelector runs chain-specific setup after the common
// DeployChainContracts call (e.g. deploying USDC/Lombard token pools on EVM).
// The returned DataStore is merged into the final result.
PostDeployContractsForSelector(ctx context.Context, env *deployment.Environment, selector uint64, topology *offchain.EnvironmentTopology) (datastore.DataStore, error)
PostDeployContractsForSelector(ctx context.Context, env *deployment.Environment, selector uint64, topology *ccvdeployment.EnvironmentTopology) (datastore.DataStore, error)
// GetConnectionProfile returns a ChainDefinition describing this chain as a
// lane destination, plus the default committee verifier config to apply for
// each remote chain. The environment uses profiles from all chains to
Expand Down
11 changes: 5 additions & 6 deletions build/devenv/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (

"github.com/smartcontractkit/chainlink-deployments-framework/datastore"

"github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/offchain"

ccvdeployment "github.com/smartcontractkit/chainlink-ccv/deployment"
"github.com/smartcontractkit/chainlink-ccv/protocol"
)

Expand Down Expand Up @@ -237,7 +236,7 @@ func All17TokenCombinations() []TokenCombination {
// - LockRelease pairs with BurnMint (in both directions)
func ComputeTokenCombinations(
capabilities map[uint64][]PoolCapability,
topology *offchain.EnvironmentTopology,
topology *ccvdeployment.EnvironmentTopology,
) []TokenCombination {
// Collect the set of distinct pool capabilities across all chains.
type capKey struct {
Expand Down Expand Up @@ -357,7 +356,7 @@ func newTokenCombination(localType, localVersion string, localCCVs []string, rem
// ccvQualifierPermutations returns the set of CCV qualifier slices to exercise,
// derived from the topology's available committees. It always includes the
// empty-qualifier case (no explicit CCVs) for pools that support it.
func ccvQualifierPermutations(topology *offchain.EnvironmentTopology) [][]string {
func ccvQualifierPermutations(topology *ccvdeployment.EnvironmentTopology) [][]string {
result := [][]string{
{}, // no explicit CCVs
}
Expand All @@ -384,7 +383,7 @@ func ccvQualifierPermutations(topology *offchain.EnvironmentTopology) [][]string
}

// qualifiersAvailable returns true if all qualifiers exist as committees in the topology.
func qualifiersAvailable(qualifiers []string, topology *offchain.EnvironmentTopology) bool {
func qualifiersAvailable(qualifiers []string, topology *ccvdeployment.EnvironmentTopology) bool {
if topology == nil || topology.NOPTopology == nil {
return len(qualifiers) == 0
}
Expand All @@ -401,7 +400,7 @@ func qualifiersAvailable(qualifiers []string, topology *offchain.EnvironmentTopo
// as the local chain and selectors[1:] as candidate remotes, and the filter keeps only
// combinations whose declared local->remote orientation exists in the datastore.
// Pass ds nil to skip the datastore check.
func FilterTokenCombinations(combos []TokenCombination, topology *offchain.EnvironmentTopology, ds datastore.DataStore, selectors []uint64) []TokenCombination {
func FilterTokenCombinations(combos []TokenCombination, topology *ccvdeployment.EnvironmentTopology, ds datastore.DataStore, selectors []uint64) []TokenCombination {
filtered := make([]TokenCombination, 0, len(combos))
for _, combo := range combos {
if !qualifiersAvailable(combo.LocalPoolCCVQualifiers(), topology) ||
Expand Down
9 changes: 4 additions & 5 deletions build/devenv/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/smartcontractkit/chainlink-ccv/build/devenv/cciptestinterfaces"
devenvcommon "github.com/smartcontractkit/chainlink-ccv/build/devenv/common"
"github.com/smartcontractkit/chainlink-ccv/build/devenv/jobs"
"github.com/smartcontractkit/chainlink-ccv/build/devenv/offchainloader"
"github.com/smartcontractkit/chainlink-ccv/build/devenv/services"
"github.com/smartcontractkit/chainlink-ccv/build/devenv/services/chainconfig"
"github.com/smartcontractkit/chainlink-ccv/build/devenv/services/committeeverifier"
Expand Down Expand Up @@ -1109,7 +1108,7 @@ func NewEnvironment() (in *Cfg, err error) {
capsBySelector[networkInfo.ChainSelector] = nil
}
}
combos := devenvcommon.ComputeTokenCombinations(capsBySelector, convertTopologyToCCIP(topology))
combos := devenvcommon.ComputeTokenCombinations(capsBySelector, topology)

ds := datastore.NewMemoryDataStore()
for i, impl := range impls {
Expand Down Expand Up @@ -1256,7 +1255,7 @@ func NewEnvironment() (in *Cfg, err error) {
}

// Get generated config from output datastore
aggCfg, err := offchainloader.GetAggregatorConfig(output.DataStore.Seal(), instanceName+"-aggregator")
aggCfg, err := ccvdeployment.GetAggregatorConfig(output.DataStore.Seal(), instanceName+"-aggregator")
if err != nil {
return nil, fmt.Errorf("failed to get aggregator config from output: %w", err)
}
Expand Down Expand Up @@ -1297,7 +1296,7 @@ func NewEnvironment() (in *Cfg, err error) {
return nil, fmt.Errorf("failed to generate indexer config: %w", err)
}

idxCfg, err := offchainloader.GetIndexerConfig(output.DataStore.Seal(), "indexer")
idxCfg, err := ccvdeployment.GetIndexerConfig(output.DataStore.Seal(), "indexer")
if err != nil {
return nil, fmt.Errorf("failed to get indexer config from output: %w", err)
}
Expand Down Expand Up @@ -1537,7 +1536,7 @@ func NewEnvironment() (in *Cfg, err error) {
}

// Get generated config from output datastore
tokenVerifierCfg, err := offchainloader.GetTokenVerifierConfig(
tokenVerifierCfg, err := ccvdeployment.GetTokenVerifierConfig(
output.DataStore.Seal(), "TokenVerifier",
)
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions build/devenv/evm/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ import (
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_6_0/operations/rmn_remote"
"github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/adapters"
ccipChangesets "github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/changesets"
ccipOffchain "github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/offchain"
"github.com/smartcontractkit/chainlink-ccv/build/devenv/cciptestinterfaces"
devenvcommon "github.com/smartcontractkit/chainlink-ccv/build/devenv/common"
ccvdeployment "github.com/smartcontractkit/chainlink-ccv/deployment"
"github.com/smartcontractkit/chainlink-ccv/protocol"
"github.com/smartcontractkit/chainlink-ccv/verifier/pkg/token/lombard"
"github.com/smartcontractkit/chainlink-deployments-framework/chain/evm"
Expand Down Expand Up @@ -951,7 +951,7 @@ func (m *CCIP17EVMConfig) ConfigureNodes(ctx context.Context, bc *blockchain.Inp
// For each committee qualifier in the topology, a receiver requiring that committee's
// verifier is created. Multi-committee receivers (requiring one committee with optional
// verifiers from others) are only created when all referenced committees exist.
func buildMockReceivers(topology *ccipOffchain.EnvironmentTopology, selector uint64) []adapters.MockReceiverDeployParams {
func buildMockReceivers(topology *ccvdeployment.EnvironmentTopology, selector uint64) []adapters.MockReceiverDeployParams {
has := func(q string) bool {
_, ok := topology.NOPTopology.Committees[q]
return ok
Expand Down Expand Up @@ -1015,7 +1015,7 @@ func buildMockReceivers(topology *ccipOffchain.EnvironmentTopology, selector uin
return receivers
}

func (m *CCIP17EVMConfig) PreDeployContractsForSelector(_ context.Context, env *deployment.Environment, selector uint64, _ *ccipOffchain.EnvironmentTopology) (datastore.DataStore, error) {
func (m *CCIP17EVMConfig) PreDeployContractsForSelector(_ context.Context, env *deployment.Environment, selector uint64, _ *ccvdeployment.EnvironmentTopology) (datastore.DataStore, error) {
m.logger.Info().Uint64("Selector", selector).Msg("EVM pre-deploy: deploying CREATE2 factory")

create2FactoryRep, err := operations.ExecuteOperation(env.OperationsBundle, create2_factory.Deploy, env.BlockChains.EVMChains()[selector],
Expand All @@ -1037,7 +1037,7 @@ func (m *CCIP17EVMConfig) PreDeployContractsForSelector(_ context.Context, env *
return ds.Seal(), nil
}

func (m *CCIP17EVMConfig) GetDeployChainContractsCfg(env *deployment.Environment, selector uint64, topology *ccipOffchain.EnvironmentTopology) (ccipChangesets.DeployChainContractsPerChainCfg, error) {
func (m *CCIP17EVMConfig) GetDeployChainContractsCfg(env *deployment.Environment, selector uint64, topology *ccvdeployment.EnvironmentTopology) (ccipChangesets.DeployChainContractsPerChainCfg, error) {
create2Ref, err := env.DataStore.Addresses().Get(
datastore.NewAddressRefKey(selector, datastore.ContractType(create2_factory.ContractType), create2_factory.Version, ""),
)
Expand Down Expand Up @@ -1104,7 +1104,7 @@ func (m *CCIP17EVMConfig) GetDeployChainContractsCfg(env *deployment.Environment
}, nil
}

func (m *CCIP17EVMConfig) PostDeployContractsForSelector(_ context.Context, env *deployment.Environment, selector uint64, _ *ccipOffchain.EnvironmentTopology) (datastore.DataStore, error) {
func (m *CCIP17EVMConfig) PostDeployContractsForSelector(_ context.Context, env *deployment.Environment, selector uint64, _ *ccvdeployment.EnvironmentTopology) (datastore.DataStore, error) {
m.logger.Info().Uint64("Selector", selector).Msg("EVM post-deploy: deploying USDC and Lombard token pools")

create2Ref, err := env.DataStore.Addresses().Get(
Expand Down Expand Up @@ -1255,7 +1255,7 @@ func (m *CCIP17EVMConfig) GetTokenTransferConfigs(
env *deployment.Environment,
selector uint64,
remoteSelectors []uint64,
topology *ccipOffchain.EnvironmentTopology,
topology *ccvdeployment.EnvironmentTopology,
) ([]tokenscore.TokenTransferConfig, error) {
applicableCombos := devenvcommon.FilterTokenCombinations(
devenvcommon.AllTokenCombinations(), topology, env.DataStore, append([]uint64{selector}, remoteSelectors...),
Expand Down
11 changes: 5 additions & 6 deletions build/devenv/implcommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ func DeployContractsForSelector(
operations.NewMemoryReporter(),
)

ccipTopology := convertTopologyToCCIP(topology)

// 1. Pre-hook (e.g. EVM deploys CREATE2 factory here).
preDS, err := impl.PreDeployContractsForSelector(ctx, env, selector, ccipTopology)
preDS, err := impl.PreDeployContractsForSelector(ctx, env, selector, topology)
if err != nil {
return nil, fmt.Errorf("pre-deploy for selector %d: %w", selector, err)
}
Expand All @@ -79,12 +77,13 @@ func DeployContractsForSelector(
}

// 2. Get chain-specific config (reads pre-deployed addresses from env.DataStore).
cfg, err := impl.GetDeployChainContractsCfg(env, selector, ccipTopology)
cfg, err := impl.GetDeployChainContractsCfg(env, selector, topology)
if err != nil {
return nil, fmt.Errorf("get deploy config for selector %d: %w", selector, err)
}

// 3. Call the tooling API changeset.
ccipTopology := convertTopologyToCCIP(topology)
registry := ccipAdapters.GetDeployChainContractsRegistry()
out, err := ccipChangesets.DeployChainContracts(registry).Apply(*env, changesetscore.WithMCMS[ccipChangesets.DeployChainContractsCfg]{
Cfg: ccipChangesets.DeployChainContractsCfg{
Expand All @@ -107,7 +106,7 @@ func DeployContractsForSelector(
env.DataStore = merged

// 4. Post-hook (e.g. EVM deploys USDC/Lombard pools here).
postDS, err := impl.PostDeployContractsForSelector(ctx, env, selector, ccipTopology)
postDS, err := impl.PostDeployContractsForSelector(ctx, env, selector, topology)
if err != nil {
return nil, fmt.Errorf("post-deploy for selector %d: %w", selector, err)
}
Expand Down Expand Up @@ -557,7 +556,7 @@ func ConfigureAllTokenTransfers(
}
}

cfgs, err := tcp.GetTokenTransferConfigs(env, selectors[i], remoteSelectors, convertTopologyToCCIP(topology))
cfgs, err := tcp.GetTokenTransferConfigs(env, selectors[i], remoteSelectors, topology)
if err != nil {
return fmt.Errorf("get token transfer configs for selector %d: %w", selectors[i], err)
}
Expand Down
Loading
Loading