Skip to content
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

Node API capabilities registry #12046

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/pelletier/go-toml/v2 v2.1.1
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1
Expand Down
2 changes: 2 additions & 0 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4 h1:Yk0RK9WV59ISOZZMsdtxZBAKaBfdgb05oXyca/qSqcw=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4/go.mod h1:pRlQrvcizMmuHAUV4N96oO2e3XbA99JCQELLc6ES160=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb h1:Yl/vWE/Et8jJl4zUExSRv3oWty7oUahRjW3GcmlsBYM=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb/go.mod h1:buCjOKljsPFtEqJtK9AwCR7SaWJxUMo1rrayiD0bkMc=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8 h1:I326nw5GwHQHsLKHwtu5Sb9EBLylC8CfUd7BFAS0jtg=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8/go.mod h1:a65NtrK4xZb01mf0dDNghPkN2wXgcqFQ55ADthVBgMc=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240214203158-47dae5de1336 h1:j00D0/EqE9HRu+63v7KwUOe4ZxLc4AN5SOJFiinkkH0=
Expand Down
1 change: 1 addition & 0 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
keyStore.Eth(),
opts.RelayerChainInteroperators,
mailMon,
registry,
)
delegates[job.Bootstrap] = ocrbootstrap.NewDelegateBootstrap(
db,
Expand Down
3 changes: 2 additions & 1 deletion core/services/job/spawner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
"github.com/smartcontractkit/chainlink-common/pkg/utils"
"github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox/mailboxtest"
"github.com/smartcontractkit/chainlink/v2/core/capabilities"

"github.com/smartcontractkit/chainlink/v2/core/bridges"
mocklp "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks"
Expand Down Expand Up @@ -304,7 +305,7 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) {
ocr2DelegateConfig := ocr2.NewDelegateConfig(config.OCR2(), config.Mercury(), config.Threshold(), config.Insecure(), config.JobPipeline(), config.Database(), processConfig)

d := ocr2.NewDelegate(nil, orm, nil, nil, nil, nil, monitoringEndpoint, legacyChains, lggr, ocr2DelegateConfig,
keyStore.OCR2(), keyStore.DKGSign(), keyStore.DKGEncrypt(), ethKeyStore, testRelayGetter, mailMon)
keyStore.OCR2(), keyStore.DKGSign(), keyStore.DKGEncrypt(), ethKeyStore, testRelayGetter, mailMon, capabilities.NewRegistry())
delegateOCR2 := &delegate{jobOCR2VRF.Type, []job.ServiceCtx{}, 0, nil, d}

spawner := job.NewSpawner(orm, config.Database(), noopChecker{}, map[job.Type]job.Delegate{
Expand Down
10 changes: 7 additions & 3 deletions core/services/ocr2/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ type Delegate struct {
isNewlyCreatedJob bool // Set to true if this is a new job freshly added, false if job was present already on node boot.
mailMon *mailbox.Monitor

legacyChains legacyevm.LegacyChainContainer // legacy: use relayers instead
legacyChains legacyevm.LegacyChainContainer // legacy: use relayers instead
capabilitiesRegistry types.CapabilitiesRegistry
}

type DelegateConfig interface {
Expand Down Expand Up @@ -229,6 +230,7 @@ func NewDelegate(
ethKs keystore.Eth,
relayers RelayGetter,
mailMon *mailbox.Monitor,
capabilitiesRegistry types.CapabilitiesRegistry,
) *Delegate {
return &Delegate{
db: db,
Expand All @@ -248,6 +250,7 @@ func NewDelegate(
RelayGetter: relayers,
isNewlyCreatedJob: false,
mailMon: mailMon,
capabilitiesRegistry: capabilitiesRegistry,
}
}

Expand Down Expand Up @@ -455,7 +458,7 @@ func (d *Delegate) ServicesForSpec(jb job.Job) ([]job.ServiceCtx, error) {
return d.newServicesOCR2Functions(lggr, jb, bootstrapPeers, kb, ocrDB, thresholdPluginDB, s4PluginDB, lc, ocrLogger)

case types.GenericPlugin:
return d.newServicesGenericPlugin(ctx, lggr, jb, bootstrapPeers, kb, ocrDB, lc, ocrLogger)
return d.newServicesGenericPlugin(ctx, lggr, jb, bootstrapPeers, kb, ocrDB, lc, ocrLogger, d.capabilitiesRegistry)

default:
return nil, errors.Errorf("plugin type %s not supported", spec.PluginType)
Expand Down Expand Up @@ -514,6 +517,7 @@ func (d *Delegate) newServicesGenericPlugin(
ocrDB *db,
lc ocrtypes.LocalConfig,
ocrLogger commontypes.Logger,
capabilitiesRegistry types.CapabilitiesRegistry,
) (srvs []job.ServiceCtx, err error) {
spec := jb.OCR2OracleSpec

Expand Down Expand Up @@ -656,7 +660,7 @@ func (d *Delegate) newServicesGenericPlugin(

case 3:
//OCR3 with OCR2 OnchainKeyring and ContractTransmitter
plugin := ocr3.NewLOOPPService(pluginLggr, grpcOpts, cmdFn, pluginConfig, providerClientConn, pr, ta, errorLog)
plugin := ocr3.NewLOOPPService(pluginLggr, grpcOpts, cmdFn, pluginConfig, providerClientConn, pr, ta, errorLog, capabilitiesRegistry)
contractTransmitter := ocrcommon.NewOCR3ContractTransmitterAdapter(provider.ContractTransmitter())
oracleArgs := libocr2.OCR3OracleArgs[any]{
BinaryNetworkEndpointFactory: d.peerWrapper.Peer2,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ require (
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240214203158-47dae5de1336
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4 h1:Yk0RK9WV59ISOZZMsdtxZBAKaBfdgb05oXyca/qSqcw=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4/go.mod h1:pRlQrvcizMmuHAUV4N96oO2e3XbA99JCQELLc6ES160=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb h1:Yl/vWE/Et8jJl4zUExSRv3oWty7oUahRjW3GcmlsBYM=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb/go.mod h1:buCjOKljsPFtEqJtK9AwCR7SaWJxUMo1rrayiD0bkMc=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8 h1:I326nw5GwHQHsLKHwtu5Sb9EBLylC8CfUd7BFAS0jtg=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8/go.mod h1:a65NtrK4xZb01mf0dDNghPkN2wXgcqFQ55ADthVBgMc=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240214203158-47dae5de1336 h1:j00D0/EqE9HRu+63v7KwUOe4ZxLc4AN5SOJFiinkkH0=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/segmentio/ksuid v1.0.4
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb
github.com/smartcontractkit/chainlink-testing-framework v1.23.2
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4 h1:Yk0RK9WV59ISOZZMsdtxZBAKaBfdgb05oXyca/qSqcw=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240213113935-001c2f4befd4/go.mod h1:pRlQrvcizMmuHAUV4N96oO2e3XbA99JCQELLc6ES160=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb h1:Yl/vWE/Et8jJl4zUExSRv3oWty7oUahRjW3GcmlsBYM=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240215170521-c15431f23acb/go.mod h1:buCjOKljsPFtEqJtK9AwCR7SaWJxUMo1rrayiD0bkMc=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8 h1:I326nw5GwHQHsLKHwtu5Sb9EBLylC8CfUd7BFAS0jtg=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8/go.mod h1:a65NtrK4xZb01mf0dDNghPkN2wXgcqFQ55ADthVBgMc=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240214203158-47dae5de1336 h1:j00D0/EqE9HRu+63v7KwUOe4ZxLc4AN5SOJFiinkkH0=
Expand Down
Loading