-
Notifications
You must be signed in to change notification settings - Fork 3
feat(devenv/tcapi): bound persistent-network event scans, add delivery-only Run mode #1221
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a701bbc
fix: event poller with persistent network
jadepark-dev 01741ff
feat: OnchainAssertionOnly in tcapi
jadepark-dev a4f5075
Merge branch 'main' into jade/tcapi-persistent-env-support
jadepark-dev 74e6c1a
chore: testing
jadepark-dev 5ed0842
chore: extract nested setup code
jadepark-dev 19623eb
fix: mirror
jadepark-dev a274a65
bootstrap: push raw pubkey, enforce one family
makramkd b632cc2
fix compilation error
makramkd aaf393c
temp: bump chainlink-ccip
makramkd 89205f5
Merge branch 'main' into jade/tcapi-persistent-env-support
jadepark-dev e5bd254
feat: skip offchain assertions without flag
jadepark-dev ff9f359
chore: lint
jadepark-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package ccv | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/rs/zerolog" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func newTestLibFromCCV(cfg *Cfg) *libFromCCV { | ||
| return &libFromCCV{ | ||
| envOutFile: "test.toml", | ||
| cfg: cfg, | ||
| l: zerolog.Nop(), | ||
| } | ||
| } | ||
|
|
||
| // TestLib_OffchainGetters covers the absence contract for both backends: the plural | ||
| // getters return an empty result with a nil error when nothing is configured, the | ||
| // singular getters return an error, and a real construction failure surfaces as an | ||
| // error from the plural getter too. | ||
| func TestLib_OffchainGetters(t *testing.T) { | ||
| ccvUnconfigured := newTestLibFromCCV(&Cfg{}) | ||
| ccvBadAggregatorCert := newTestLibFromCCV(&Cfg{ | ||
| AggregatorEndpoints: map[string]string{"default": "127.0.0.1:1"}, | ||
| AggregatorCACertFiles: map[string]string{"default": "/nonexistent/ca.pem"}, | ||
| }) | ||
| cldf := &libFromCLDF{l: zerolog.Nop()} | ||
|
|
||
| tests := []struct { | ||
| name string | ||
| call func() (any, error) | ||
| wantErr bool // false: expect an empty result with a nil error | ||
| }{ | ||
| {"ccv unconfigured: AllAggregators", func() (any, error) { return ccvUnconfigured.AllAggregators() }, false}, | ||
| {"ccv unconfigured: AllIndexers", func() (any, error) { return ccvUnconfigured.AllIndexers() }, false}, | ||
| {"ccv unconfigured: Indexer", func() (any, error) { return ccvUnconfigured.Indexer() }, true}, | ||
| {"ccv unconfigured: IndexerMonitor", func() (any, error) { return ccvUnconfigured.IndexerMonitor() }, true}, | ||
| {"ccv bad aggregator cert: AllAggregators", func() (any, error) { return ccvBadAggregatorCert.AllAggregators() }, true}, | ||
| {"cldf: AllAggregators", func() (any, error) { return cldf.AllAggregators() }, false}, | ||
| {"cldf: AllIndexers", func() (any, error) { return cldf.AllIndexers() }, false}, | ||
| {"cldf: Indexer", func() (any, error) { return cldf.Indexer() }, true}, | ||
| {"cldf: IndexerMonitor", func() (any, error) { return cldf.IndexerMonitor() }, true}, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| got, err := tt.call() | ||
| if tt.wantErr { | ||
| require.Error(t, err) | ||
| return | ||
| } | ||
| require.NoError(t, err) | ||
| assert.Empty(t, got) | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package tcapi | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| ccv "github.com/smartcontractkit/chainlink-ccv/build/devenv" | ||
| "github.com/smartcontractkit/chainlink-ccv/build/devenv/common" | ||
| ) | ||
|
|
||
| // SetupOffchainClients resolves the aggregator and indexer clients from the | ||
| // environment. When no offchain endpoints are configured it returns nil clients and | ||
| // a nil error; NewTestingContext skips assertion stages for nil clients. A non-nil | ||
| // error means a configured client failed to construct. | ||
| func SetupOffchainClients(lib ccv.Lib, aggregatorQualifier string) (*ccv.AggregatorClient, *ccv.IndexerMonitor, error) { | ||
| aggregatorClients, err := lib.AllAggregators() | ||
| if err != nil { | ||
| return nil, nil, fmt.Errorf("failed to get aggregator clients: %w", err) | ||
| } | ||
| var aggregatorClient *ccv.AggregatorClient | ||
| if len(aggregatorClients) > 0 { | ||
| aggregatorClient = aggregatorClients[common.DefaultCommitteeVerifierQualifier] | ||
| if aggregatorQualifier != "" && aggregatorQualifier != common.DefaultCommitteeVerifierQualifier { | ||
| if client, ok := aggregatorClients[aggregatorQualifier]; ok { | ||
| aggregatorClient = client | ||
| } | ||
| } | ||
| } | ||
|
|
||
| indexers, err := lib.AllIndexers() | ||
| if err != nil { | ||
| return nil, nil, fmt.Errorf("failed to get indexer clients: %w", err) | ||
| } | ||
| var indexerMonitor *ccv.IndexerMonitor | ||
| if len(indexers) > 0 { | ||
| indexerMonitor, err = lib.IndexerMonitor() | ||
| if err != nil { | ||
| return nil, nil, fmt.Errorf("failed to get indexer monitor: %w", err) | ||
| } | ||
| } | ||
| return aggregatorClient, indexerMonitor, nil | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Kept as an independent constant rather than importing
sourcereader.DefaultMaxBlockRangeto avoid a devenv>verifier package dependency