-
Notifications
You must be signed in to change notification settings - Fork 31
Remove chain selectors params from agg/indexer cs #1893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| package changesets | ||
|
|
||
| import ( | ||
| "errors" | ||
| "fmt" | ||
| "slices" | ||
| "sort" | ||
|
|
||
| "github.com/smartcontractkit/chainlink-deployments-framework/datastore" | ||
|
|
@@ -17,7 +17,6 @@ type GenerateIndexerConfigInput struct { | |
| CommitteeVerifierNameToQualifier map[string]string | ||
| CCTPVerifierNameToQualifier map[string]string | ||
| LombardVerifierNameToQualifier map[string]string | ||
| ChainSelectors []uint64 | ||
| } | ||
|
|
||
| func GenerateIndexerConfig(registry *adapters.IndexerConfigRegistry) deployment.ChangeSetV2[GenerateIndexerConfigInput] { | ||
|
|
@@ -30,22 +29,11 @@ func GenerateIndexerConfig(registry *adapters.IndexerConfigRegistry) deployment. | |
| len(cfg.LombardVerifierNameToQualifier) == 0 { | ||
| return fmt.Errorf("at least one verifier name to qualifier mapping is required") | ||
| } | ||
| envSelectors := e.BlockChains.ListChainSelectors() | ||
| for _, s := range cfg.ChainSelectors { | ||
| if !slices.Contains(envSelectors, s) { | ||
| return fmt.Errorf("selector %d is not available in environment", s) | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| apply := func(e deployment.Environment, cfg GenerateIndexerConfigInput) (deployment.ChangesetOutput, error) { | ||
| selectors := cfg.ChainSelectors | ||
| if len(selectors) == 0 { | ||
| selectors = e.BlockChains.ListChainSelectors() | ||
| } | ||
|
|
||
| verifierMap, err := buildIndexerVerifierMap(e.DataStore, registry, selectors, cfg) | ||
| verifierMap, err := buildIndexerVerifierMap(e.DataStore, registry, e.BlockChains.ListChainSelectors(), cfg) | ||
| if err != nil { | ||
| return deployment.ChangesetOutput{}, err | ||
| } | ||
|
|
@@ -108,6 +96,10 @@ func collectVerifierAddresses( | |
| qualifier string, | ||
| kind adapters.VerifierKind, | ||
| ) ([]string, error) { | ||
| if !registry.HasAdapters() { | ||
| return nil, fmt.Errorf("no indexer config adapter registered") | ||
| } | ||
|
|
||
| seen := make(map[string]bool) | ||
| var addresses []string | ||
|
|
||
|
|
@@ -119,6 +111,10 @@ func collectVerifierAddresses( | |
|
|
||
| addrs, err := adapter.ResolveVerifierAddresses(ds, sel, qualifier, kind) | ||
| if err != nil { | ||
| var missingErr *adapters.MissingIndexerVerifierAddressesError | ||
| if errors.As(err, &missingErr) { | ||
| continue | ||
| } | ||
|
Comment on lines
112
to
+117
|
||
| return nil, fmt.Errorf("chain %d: %w", sel, err) | ||
| } | ||
|
|
||
|
|
@@ -130,6 +126,10 @@ func collectVerifierAddresses( | |
| } | ||
| } | ||
|
|
||
| if len(addresses) == 0 { | ||
| return nil, fmt.Errorf("no deployed %s verifier addresses found for qualifier %q", kind, qualifier) | ||
| } | ||
|
|
||
| return addresses, nil | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because GenerateIndexerConfig now always uses env.BlockChains.ListChainSelectors(), environments containing chain families without a registered IndexerConfigAdapter will fail hard at registry.GetByChain(sel). This is a regression from being able to restrict selectors via input. Consider treating “no adapter registered for chain family” as a non-fatal condition (skip that selector), ideally via a typed error from GetByChain / a HasAdapterForChain helper, so mixed-family environments can still generate indexer config for supported chains.