Skip to content

Commit

Permalink
chore(cre): refactor startup (#16287)
Browse files Browse the repository at this point in the history
* chore(cre): refactor startup

* cleanup
  • Loading branch information
krehermann authored Feb 13, 2025
1 parent 399a3cd commit 073eac4
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 162 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-schools-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal refactor app startup using cre services
6 changes: 5 additions & 1 deletion core/cmd/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,12 @@ func (n ChainlinkAppFactory) NewApplication(ctx context.Context, cfg chainlink.G

restrictedClient := clhttp.NewRestrictedHTTPClient(cfg.Database(), appLggr)
externalInitiatorManager := webhook.NewExternalInitiatorManager(ds, unrestrictedClient)
creOpts := chainlink.CREOpts{
CapabilitiesRegistry: capabilitiesRegistry,
}
return chainlink.NewApplication(chainlink.ApplicationOpts{
CREOpts: creOpts,

Config: cfg,
DS: ds,
KeyStore: keyStore,
Expand All @@ -323,7 +328,6 @@ func (n ChainlinkAppFactory) NewApplication(ctx context.Context, cfg chainlink.G
MercuryPool: mercuryPool,
RetirementReportCache: retirementReportCache,
LLOTransmissionReaper: lloReaper,
CapabilitiesRegistry: capabilitiesRegistry,
})
}

Expand Down
13 changes: 8 additions & 5 deletions core/internal/cltest/cltest.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,15 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn
if err != nil {
t.Fatal(err)
}
creOpts := chainlink.CREOpts{
CapabilitiesRegistry: capabilitiesRegistry,
CapabilitiesDispatcher: dispatcher,
CapabilitiesPeerWrapper: peerWrapper,
FetcherFunc: syncerFetcherFunc,
FetcherFactoryFn: computeFetcherFactory,
}
appInstance, err := chainlink.NewApplication(chainlink.ApplicationOpts{
CREOpts: creOpts,
Config: cfg,
MailMon: mailMon,
DS: ds,
Expand All @@ -503,12 +511,7 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn
SecretGenerator: MockSecretGenerator{},
LoopRegistry: plugins.NewTestLoopRegistry(lggr),
MercuryPool: mercuryPool,
CapabilitiesRegistry: capabilitiesRegistry,
CapabilitiesDispatcher: dispatcher,
CapabilitiesPeerWrapper: peerWrapper,
NewOracleFactoryFn: newOracleFactoryFn,
FetcherFunc: syncerFetcherFunc,
FetcherFactoryFn: computeFetcherFactory,
RetirementReportCache: retirementReportCache,
LLOTransmissionReaper: llo.NewTransmissionReaper(ds, lggr, cfg.Mercury().Transmitter().ReaperFrequency().Duration(), cfg.Mercury().Transmitter().ReaperMaxAge().Duration()),
})
Expand Down
Loading

0 comments on commit 073eac4

Please sign in to comment.