From 8547ac4a4d49fdb131e94ae7c462e45c6dfe3eda Mon Sep 17 00:00:00 2001 From: DeividasK Date: Fri, 30 Aug 2024 13:37:12 +0300 Subject: [PATCH 01/30] --wip-- [skip CI] --- core/scripts/go.mod | 15 +-- core/scripts/go.sum | 26 ++--- core/services/ocr2/delegate.go | 1 + .../ocr2/plugins/generic/oraclefactory.go | 53 ++++++++++ .../services/standardcapabilities/delegate.go | 7 +- .../standard_capabilities.go | 99 ++++++++++++++++++- go.mod | 15 ++- go.sum | 26 ++--- integration-tests/go.mod | 15 +-- integration-tests/go.sum | 26 ++--- integration-tests/load/go.mod | 15 +-- integration-tests/load/go.sum | 26 ++--- 12 files changed, 243 insertions(+), 81 deletions(-) create mode 100644 core/services/ocr2/plugins/generic/oraclefactory.go diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 765accddc09..704236aa187 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.17.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.0 @@ -150,6 +150,7 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.15.5 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/go-webauthn/webauthn v0.9.4 // indirect github.com/go-webauthn/x v0.1.5 // indirect github.com/goccy/go-json v0.10.2 // indirect @@ -178,7 +179,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect @@ -187,7 +188,7 @@ require ( github.com/hashicorp/go-envparse v0.1.0 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/golang-lru v0.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -334,17 +335,17 @@ require ( golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.24.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect google.golang.org/grpc v1.65.0 // indirect gopkg.in/guregu/null.v4 v4.0.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index ba0c66277b8..8e614926338 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -516,6 +516,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-webauthn/webauthn v0.9.4 h1:YxvHSqgUyc5AK2pZbqkWWR55qKeDPhP8zLDr6lpIc2g= github.com/go-webauthn/webauthn v0.9.4/go.mod h1:LqupCtzSef38FcxzaklmOn7AykGKhAhr9xlRbdbgnTw= github.com/go-webauthn/x v0.1.5 h1:V2TCzDU2TGLd0kSZOXdrqDVV5JB9ILnKxA9S53CSBw0= @@ -684,8 +686,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -1186,8 +1188,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 h1:W8jK09xMKjhnduR4FsyM2aQKe+4/K1EsAhfJQgv2DEk= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84/go.mod h1:5rmU5YKBkIOwWkuNZi26sMXlBUBm6weBFXh+8BEEp2s= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 h1:lpSTJZZ81qabxenBcqyYTucBUF1Ky4aLfPnnjSHL3X4= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8/go.mod h1:c2iZi7NC7cfQY/aKo2V9AAMyFOU+6/odYzASvNhupko= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1584,8 +1586,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1686,8 +1688,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1869,10 +1871,10 @@ google.golang.org/genproto v0.0.0-20210401141331-865547bb08e2/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d h1:/hmn0Ku5kWij/kjGsrcJeC1T/MrJi2iNWwgAqrihFwc= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index 52dbbf87b53..ac7c36a1ac7 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -792,6 +792,7 @@ func (d *Delegate) newServicesGenericPlugin( OnchainKeyring: onchainKeyringAdapter, MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": jb.Name.ValueOrZero()}, prometheus.DefaultRegisterer), } + // This would be newReportingPluginFactory that returns the service oracleArgs.ReportingPluginFactory = plugin srvs = append(srvs, plugin) oracle, err := libocr2.NewOracle(oracleArgs) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go new file mode 100644 index 00000000000..97cbd27616f --- /dev/null +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -0,0 +1,53 @@ +package generic + +import ( + "context" + "fmt" + + ocr "github.com/smartcontractkit/libocr/offchainreporting2plus" + + "github.com/smartcontractkit/chainlink-common/pkg/types/core" +) + +type oracleFactory struct{} + +type adaptedOracle struct { + oracle ocr.Oracle +} + +func (a *adaptedOracle) Start(ctx context.Context) error { + return a.oracle.Start() +} + +func (a *adaptedOracle) Close(ctx context.Context) error { + return a.oracle.Close() +} + +func NewOracleFactory() (core.OracleFactory, error) { + return &oracleFactory{}, nil +} + +func (o *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (core.Oracle, error) { + // create the oracle from config values + oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ + LocalConfig: args.LocalConfig, + ContractConfigTracker: args.ContractConfigTracker, + ContractTransmitter: args.ContractTransmitter, + OffchainConfigDigester: args.OffchainConfigDigester, + ReportingPluginFactory: args.ReportingPluginFactoryService, + // BinaryNetworkEndpointFactory: d.cfg.BinaryNetworkEndpointFactory, + // V2Bootstrappers: d.cfg.V2Bootstrappers, + // Database: d.cfg.Database, + // Logger: d.cfg.OCRLogger, + // MonitoringEndpoint: d.cfg.MonitoringEndpoint, + // OffchainKeyring: d.cfg.OffchainKeyring, + // OnchainKeyring: d.cfg.OnchainKeyring, + // MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": d.cfg.JobName.ValueOrZero()}, prometheus.DefaultRegisterer), + }) + + if err != nil { + return nil, fmt.Errorf("%w: failed to create new OCR oracle", err) + } + + return &adaptedOracle{oracle: oracle}, nil +} diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index d072c948469..72f4d62cad0 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -67,8 +67,13 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser return nil, fmt.Errorf("failed to create relayer set: %w", err) } + oracleFactory, err := generic.NewOracleFactory() + if err != nil { + return nil, fmt.Errorf("failed to create oracle factory: %w", err) + } + standardCapability := newStandardCapabilities(log, spec.StandardCapabilitiesSpec, d.cfg, telemetryService, kvStore, d.registry, errorLog, - pr, relayerSet) + pr, relayerSet, oracleFactory) return []job.ServiceCtx{standardCapability}, nil } diff --git a/core/services/standardcapabilities/standard_capabilities.go b/core/services/standardcapabilities/standard_capabilities.go index a8d007d5df8..82316fcf9a1 100644 --- a/core/services/standardcapabilities/standard_capabilities.go +++ b/core/services/standardcapabilities/standard_capabilities.go @@ -23,18 +23,110 @@ type standardCapabilities struct { errorLog core.ErrorLog pipelineRunner core.PipelineRunnerService relayerSet core.RelayerSet + oracleFactory core.OracleFactory capabilitiesLoop *loop.StandardCapabilitiesService } -func newStandardCapabilities(log logger.Logger, spec *job.StandardCapabilitiesSpec, +func newStandardCapabilities( + log logger.Logger, + spec *job.StandardCapabilitiesSpec, pluginRegistrar plugins.RegistrarConfig, telemetryService core.TelemetryService, store core.KeyValueStore, CapabilitiesRegistry core.CapabilitiesRegistry, errorLog core.ErrorLog, pipelineRunner core.PipelineRunnerService, - relayerSet core.RelayerSet) *standardCapabilities { + relayerSet core.RelayerSet, + oracleFactory core.OracleFactory, +) *standardCapabilities { + /* + GENERIC DELEGATE + oracleArgs := libocr2.OCR3OracleArgs[[]byte]{ + // QUESTION: Can we abstract this away from standard capability dev? + BinaryNetworkEndpointFactory: d.peerWrapper.Peer2, + // Where do we get this from? We need a set of global bootstrappers that + // allow any nodes from the capabilities registry to connect to each other. + V2Bootstrappers: bootstrapPeers, + // TODO: I can implement this for config coming from the capabilities registry. + ContractConfigTracker: provider.ContractConfigTracker(), + // PASS: Implementation taken from the capability. + // TODO: (Re)define interface? + ContractTransmitter: contractTransmitter, + // TODO: Provide during setup. + Database: ocrDB, + // TODO: Provide during setup or skip. + LocalConfig: lc, + // TODO: Provide during setup. + Logger: ocrLogger, + // TODO: Provide during setup. + MonitoringEndpoint: oracleEndpoint, + // TODO: Provide during setup. + // PASS: Implementation taken from the capability. + // TODO: (Re)define interface? + OffchainConfigDigester: provider.OffchainConfigDigester(), + // TODO: Provide during setup. + OffchainKeyring: kb, + // TODO: Provide during setup. + OnchainKeyring: onchainKeyringAdapter, + // TODO: Provide during setup. + MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": jb.Name.ValueOrZero()}, prometheus.DefaultRegisterer), + } + oracleArgs.ReportingPluginFactory = plugin + + INITIAL (from https://docs.google.com/document/d/1nEvHO_d1CSpP53YhUuU2xaVzXHzAkFqAo-AQTIe4-5k/edit): + type LocalConfig struct { + BlockchainTimeout time.Duration // This should be part of the syncer. + ContractConfigConfirmations uint16 // This should be part of the syncer. + SkipContractConfigConfirmations bool // This should be part of the syncer. + // This should be part of the syncer. Because we can't really have a custom syncer + // interval for each capability. Also, this would be blockchain specific anyway. + ContractConfigTrackerPollInterval time.Duration + ContractTransmitterTransmitTimeout time.Duration // This should be part of the syncer. + MinOCR2MaxDurationQuery time.Duration // Not sure what this is for. + } + + type OCR3OracleArgs struct { + localConfig LocalConfig + contractTransmitter ocr3types.ContractTransmitter[[]byte] + offchainConfigDigester ocr3types.OffchainConfigDigester[[]byte] + // Should this be default and shared by all oracle instance spawned by the node + // that same way that a p2pId is? + onchainKeyring ocr3types.OnchainKeyring[[]byte] + } + + type NewOracleAPI interface { + NewOracle(OracleArgs) + } + + PROPOSED: + type OCR3OracleArgs struct { + // Controlling the transmitter allows the capability to send reports to a local inbox, + // on-chain, etc. + // Capability devs will likely send a capability response or store to outbox. + contractTransmitter ocr3types.ContractTransmitter[[]byte] + // The capability would need to store its on-chain config the same way that it is going + // to be decoded by the config digester. So config encode/decode/validate should be + // implemented. + offchainConfigDigester ocr3types.OffchainConfigDigester[[]byte] + + // Missing? + // - ReportingPlugin + // - Updates to the config restarting the oracle. + } + + type NewOracleAPI interface { + NewOracle(OracleArgs) + } + + QUESTIONS: + - Do we want job.NewServiceAdapter like thing for capabilities if instances will be spawned from capabilities binary? + - Why are oracle and plugin separate services? + + */ + + // KeyBundle - figure out if we create one on startup. + // COuld we KeyBundles.getAll() and then use the first one? return &standardCapabilities{ log: log, spec: spec, @@ -45,6 +137,7 @@ func newStandardCapabilities(log logger.Logger, spec *job.StandardCapabilitiesSp errorLog: errorLog, pipelineRunner: pipelineRunner, relayerSet: relayerSet, + oracleFactory: oracleFactory, } } @@ -73,7 +166,7 @@ func (s *standardCapabilities) Start(ctx context.Context) error { } if err = s.capabilitiesLoop.Service.Initialise(ctx, s.spec.Config, s.telemetryService, s.store, s.CapabilitiesRegistry, s.errorLog, - s.pipelineRunner, s.relayerSet); err != nil { + s.pipelineRunner, s.relayerSet, s.oracleFactory); err != nil { return fmt.Errorf("error initialising standard capabilities service: %v", err) } diff --git a/go.mod b/go.mod index 7210941bd01..1606976b395 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/graph-gophers/graphql-go v1.3.0 github.com/hashicorp/consul/sdk v0.16.0 github.com/hashicorp/go-envparse v0.1.0 - github.com/hashicorp/go-plugin v1.6.0 + github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 github.com/hashicorp/go-retryablehttp v0.7.5 github.com/hdevalence/ed25519consensus v0.1.0 github.com/jackc/pgconn v1.14.3 @@ -75,7 +75,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.21 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827 @@ -208,6 +208,7 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.15.5 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/go-webauthn/x v0.1.5 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect @@ -228,7 +229,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect @@ -330,17 +331,15 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/sdk v1.28.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/ratelimit v0.3.0 // indirect golang.org/x/arch v0.8.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect google.golang.org/api v0.188.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect gopkg.in/guregu/null.v2 v2.1.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index fb9d877c564..6ec2e3ad159 100644 --- a/go.sum +++ b/go.sum @@ -480,6 +480,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-webauthn/webauthn v0.9.4 h1:YxvHSqgUyc5AK2pZbqkWWR55qKeDPhP8zLDr6lpIc2g= github.com/go-webauthn/webauthn v0.9.4/go.mod h1:LqupCtzSef38FcxzaklmOn7AykGKhAhr9xlRbdbgnTw= github.com/go-webauthn/x v0.1.5 h1:V2TCzDU2TGLd0kSZOXdrqDVV5JB9ILnKxA9S53CSBw0= @@ -648,8 +650,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -1141,8 +1143,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 h1:W8jK09xMKjhnduR4FsyM2aQKe+4/K1EsAhfJQgv2DEk= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84/go.mod h1:5rmU5YKBkIOwWkuNZi26sMXlBUBm6weBFXh+8BEEp2s= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 h1:lpSTJZZ81qabxenBcqyYTucBUF1Ky4aLfPnnjSHL3X4= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8/go.mod h1:c2iZi7NC7cfQY/aKo2V9AAMyFOU+6/odYzASvNhupko= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1535,8 +1537,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1636,8 +1638,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1821,10 +1823,10 @@ google.golang.org/genproto v0.0.0-20210401141331-865547bb08e2/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d h1:/hmn0Ku5kWij/kjGsrcJeC1T/MrJi2iNWwgAqrihFwc= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index d50ac2673ed..b6389b4ac4e 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -33,7 +33,7 @@ require ( github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chain-selectors v1.0.21 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 github.com/smartcontractkit/chainlink-testing-framework v1.34.6 github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.1 github.com/smartcontractkit/chainlink-testing-framework/havoc v0.0.0-20240822140612-df8e03c10dc1 @@ -223,6 +223,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.15.5 // indirect github.com/go-redis/redis/v8 v8.11.5 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/go-webauthn/webauthn v0.9.4 // indirect github.com/go-webauthn/x v0.1.5 // indirect github.com/goccy/go-json v0.10.2 // indirect @@ -265,7 +266,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect @@ -278,7 +279,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-msgpack v0.5.5 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect @@ -466,16 +467,16 @@ require ( golang.org/x/arch v0.8.0 // indirect golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.24.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 5bd93085eab..269f1e0f7d6 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -680,6 +680,8 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-webauthn/webauthn v0.9.4 h1:YxvHSqgUyc5AK2pZbqkWWR55qKeDPhP8zLDr6lpIc2g= github.com/go-webauthn/webauthn v0.9.4/go.mod h1:LqupCtzSef38FcxzaklmOn7AykGKhAhr9xlRbdbgnTw= github.com/go-webauthn/x v0.1.5 h1:V2TCzDU2TGLd0kSZOXdrqDVV5JB9ILnKxA9S53CSBw0= @@ -908,8 +910,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= @@ -1519,8 +1521,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 h1:W8jK09xMKjhnduR4FsyM2aQKe+4/K1EsAhfJQgv2DEk= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84/go.mod h1:5rmU5YKBkIOwWkuNZi26sMXlBUBm6weBFXh+8BEEp2s= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 h1:lpSTJZZ81qabxenBcqyYTucBUF1Ky4aLfPnnjSHL3X4= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8/go.mod h1:c2iZi7NC7cfQY/aKo2V9AAMyFOU+6/odYzASvNhupko= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1972,8 +1974,8 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -2086,8 +2088,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2282,10 +2284,10 @@ google.golang.org/genproto v0.0.0-20210401141331-865547bb08e2/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d h1:/hmn0Ku5kWij/kjGsrcJeC1T/MrJi2iNWwgAqrihFwc= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index b0b65ac3842..dc18bb7db2b 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -16,7 +16,7 @@ require ( github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 github.com/smartcontractkit/chainlink-testing-framework v1.34.6 github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240214231432-4ad5eb95178c github.com/smartcontractkit/chainlink/v2 v2.9.0-beta0.0.20240216210048-da02459ddad8 @@ -51,6 +51,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/sts v1.30.4 // indirect github.com/aws/smithy-go v1.20.4 // indirect github.com/blang/semver/v4 v4.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect @@ -254,7 +255,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect @@ -267,7 +268,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-msgpack v0.5.5 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect @@ -465,9 +466,9 @@ require ( golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect @@ -475,8 +476,8 @@ require ( gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/guregu/null.v4 v4.0.0 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 2f92d1e6b4e..b6b4d40b546 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -672,6 +672,8 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-webauthn/webauthn v0.9.4 h1:YxvHSqgUyc5AK2pZbqkWWR55qKeDPhP8zLDr6lpIc2g= github.com/go-webauthn/webauthn v0.9.4/go.mod h1:LqupCtzSef38FcxzaklmOn7AykGKhAhr9xlRbdbgnTw= github.com/go-webauthn/x v0.1.5 h1:V2TCzDU2TGLd0kSZOXdrqDVV5JB9ILnKxA9S53CSBw0= @@ -900,8 +902,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= @@ -1499,8 +1501,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84 h1:W8jK09xMKjhnduR4FsyM2aQKe+4/K1EsAhfJQgv2DEk= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240823143943-86fc7c5deb84/go.mod h1:5rmU5YKBkIOwWkuNZi26sMXlBUBm6weBFXh+8BEEp2s= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 h1:lpSTJZZ81qabxenBcqyYTucBUF1Ky4aLfPnnjSHL3X4= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8/go.mod h1:c2iZi7NC7cfQY/aKo2V9AAMyFOU+6/odYzASvNhupko= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1952,8 +1954,8 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -2064,8 +2066,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2260,10 +2262,10 @@ google.golang.org/genproto v0.0.0-20210401141331-865547bb08e2/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d h1:/hmn0Ku5kWij/kjGsrcJeC1T/MrJi2iNWwgAqrihFwc= google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= From ae26b40990101cc4b2370498492d857d9733dbc2 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Mon, 2 Sep 2024 12:15:35 +0300 Subject: [PATCH 02/30] --wip-- [skip CI] --- core/services/chainlink/application.go | 4 +- .../ocr2/plugins/generic/oraclefactory.go | 74 ++++++++++++---- .../services/standardcapabilities/delegate.go | 31 ++++++- .../standardcapabilities/delegate_test.go | 37 ++++++++ .../standard_capabilities.go | 87 ------------------- 5 files changed, 123 insertions(+), 110 deletions(-) create mode 100644 core/services/standardcapabilities/delegate_test.go diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index 3efc92c2270..d4289568909 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -442,7 +442,9 @@ func NewApplication(opts ApplicationOpts) (Application, error) { loopRegistrarConfig, telemetryManager, pipelineRunner, - opts.RelayerChainInteroperators), + opts.RelayerChainInteroperators, + keyStore.OCR2(), + ), } webhookJobRunner = delegates[job.Webhook].(*webhook.Delegate).WebhookJobRunner() ) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 97cbd27616f..7fbc1282054 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -4,30 +4,55 @@ import ( "context" "fmt" + "github.com/prometheus/client_golang/prometheus" ocr "github.com/smartcontractkit/libocr/offchainreporting2plus" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + + "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/services/job" + "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" + "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" + "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" "github.com/smartcontractkit/chainlink-common/pkg/types/core" ) -type oracleFactory struct{} - -type adaptedOracle struct { - oracle ocr.Oracle +type oracleFactory struct { + database ocr3types.Database + jobID int32 + jobName string + jobORM job.ORM + kb ocr2key.KeyBundle + lggr logger.Logger } -func (a *adaptedOracle) Start(ctx context.Context) error { - return a.oracle.Start() +type OracleFactoryParams struct { + Database ocr3types.Database + JobID int32 + JobName string + JobORM job.ORM + Kb ocr2key.KeyBundle + Logger logger.Logger } -func (a *adaptedOracle) Close(ctx context.Context) error { - return a.oracle.Close() +func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { + return &oracleFactory{ + database: params.Database, + jobID: params.JobID, + jobName: params.JobName, + jobORM: params.JobORM, + kb: params.Kb, + lggr: params.Logger, + }, nil } -func NewOracleFactory() (core.OracleFactory, error) { - return &oracleFactory{}, nil -} +func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (core.Oracle, error) { + // Could come from the capability spec config. Unsure about this as it feels wrong to expose implementation details of OCR config to the capability spec. + traceLogging := false + ocrLogger := ocrcommon.NewOCRWrapper(of.lggr, traceLogging, func(ctx context.Context, msg string) { + logger.Sugared(of.lggr).ErrorIf(of.jobORM.RecordError(ctx, of.jobID, msg), "unable to record error") + }) -func (o *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (core.Oracle, error) { // create the oracle from config values oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ LocalConfig: args.LocalConfig, @@ -37,12 +62,13 @@ func (o *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (co ReportingPluginFactory: args.ReportingPluginFactoryService, // BinaryNetworkEndpointFactory: d.cfg.BinaryNetworkEndpointFactory, // V2Bootstrappers: d.cfg.V2Bootstrappers, - // Database: d.cfg.Database, - // Logger: d.cfg.OCRLogger, - // MonitoringEndpoint: d.cfg.MonitoringEndpoint, - // OffchainKeyring: d.cfg.OffchainKeyring, - // OnchainKeyring: d.cfg.OnchainKeyring, - // MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": d.cfg.JobName.ValueOrZero()}, prometheus.DefaultRegisterer), + Database: of.database, + Logger: ocrLogger, + // TODO: This is Relayer Dependent - can we make it Relayer agnostic? + MonitoringEndpoint: &telemetry.NoopAgent{}, + OffchainKeyring: of.kb, + OnchainKeyring: ocrcommon.NewOCR3OnchainKeyringAdapter(of.kb), + MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": of.jobName}, prometheus.DefaultRegisterer), }) if err != nil { @@ -51,3 +77,15 @@ func (o *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (co return &adaptedOracle{oracle: oracle}, nil } + +type adaptedOracle struct { + oracle ocr.Oracle +} + +func (a *adaptedOracle) Start(ctx context.Context) error { + return a.oracle.Start() +} + +func (a *adaptedOracle) Close(ctx context.Context) error { + return a.oracle.Close() +} diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 72f4d62cad0..3ca594d1eb2 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -14,6 +14,8 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/core" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" + "github.com/smartcontractkit/chainlink/v2/core/services/keystore" + "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/generic" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" @@ -34,15 +36,20 @@ type Delegate struct { monitoringEndpointGen telemetry.MonitoringEndpointGenerator pipelineRunner pipeline.Runner relayers RelayGetter + ocrKs keystore.OCR2 isNewlyCreatedJob bool } func NewDelegate(logger logger.Logger, ds sqlutil.DataSource, jobORM job.ORM, registry core.CapabilitiesRegistry, cfg plugins.RegistrarConfig, monitoringEndpointGen telemetry.MonitoringEndpointGenerator, pipelineRunner pipeline.Runner, - relayers RelayGetter) *Delegate { + relayers RelayGetter, + ocrKs keystore.OCR2, +) *Delegate { return &Delegate{logger: logger, ds: ds, jobORM: jobORM, registry: registry, cfg: cfg, monitoringEndpointGen: monitoringEndpointGen, pipelineRunner: pipelineRunner, - relayers: relayers, isNewlyCreatedJob: false} + relayers: relayers, isNewlyCreatedJob: false, + ocrKs: ocrKs, + } } func (d *Delegate) JobType() job.Type { @@ -67,11 +74,27 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser return nil, fmt.Errorf("failed to create relayer set: %w", err) } - oracleFactory, err := generic.NewOracleFactory() + keyBundles, err := d.ocrKs.GetAll() if err != nil { - return nil, fmt.Errorf("failed to create oracle factory: %w", err) + return nil, err + } + if len(keyBundles) > 1 { + return nil, fmt.Errorf("expected only one OCR key bundle, but found found: %s", len(keyBundles)) } + // KeyBundle - figure out if we create one on startup. + // COuld we KeyBundles.getAll() and then use the first one? + oracleFactory, err := generic.NewOracleFactory(generic.OracleFactoryParams{ + Logger: log, + JobORM: d.jobORM, + JobID: spec.ID, + JobName: spec.Name.ValueOrZero(), + Database: ocr2.NewDB(d.ds, spec.ID, 0, log), + Kb: keyBundles[0], + }) + if err != nil { + return nil, fmt.Errorf("failed to create oracle factory: %w", err) + } standardCapability := newStandardCapabilities(log, spec.StandardCapabilitiesSpec, d.cfg, telemetryService, kvStore, d.registry, errorLog, pr, relayerSet, oracleFactory) diff --git a/core/services/standardcapabilities/delegate_test.go b/core/services/standardcapabilities/delegate_test.go new file mode 100644 index 00000000000..98173eb8883 --- /dev/null +++ b/core/services/standardcapabilities/delegate_test.go @@ -0,0 +1,37 @@ +package standardcapabilities_test + +import ( + "testing" + + "github.com/test-go/testify/require" + + "github.com/smartcontractkit/chainlink/v2/core/services/standardcapabilities" +) + +func Test_ValidatedStandardCapabilitiesSpec(t *testing.T) { + + type testCase struct { + name string + expectedError string + } + + testCases := []testCase{ + { + name: "invalid TOML string", + expectedError: "toml error on load standard capabilities", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := standardcapabilities.ValidatedStandardCapabilitiesSpec("invalid TOML string") + + if tc.expectedError == "" { + require.NoError(t, err) + } else { + require.Error(t, err, tc.expectedError) + } + }) + } + +} diff --git a/core/services/standardcapabilities/standard_capabilities.go b/core/services/standardcapabilities/standard_capabilities.go index 82316fcf9a1..fe3dad7bb2f 100644 --- a/core/services/standardcapabilities/standard_capabilities.go +++ b/core/services/standardcapabilities/standard_capabilities.go @@ -40,93 +40,6 @@ func newStandardCapabilities( relayerSet core.RelayerSet, oracleFactory core.OracleFactory, ) *standardCapabilities { - /* - GENERIC DELEGATE - oracleArgs := libocr2.OCR3OracleArgs[[]byte]{ - // QUESTION: Can we abstract this away from standard capability dev? - BinaryNetworkEndpointFactory: d.peerWrapper.Peer2, - // Where do we get this from? We need a set of global bootstrappers that - // allow any nodes from the capabilities registry to connect to each other. - V2Bootstrappers: bootstrapPeers, - // TODO: I can implement this for config coming from the capabilities registry. - ContractConfigTracker: provider.ContractConfigTracker(), - // PASS: Implementation taken from the capability. - // TODO: (Re)define interface? - ContractTransmitter: contractTransmitter, - // TODO: Provide during setup. - Database: ocrDB, - // TODO: Provide during setup or skip. - LocalConfig: lc, - // TODO: Provide during setup. - Logger: ocrLogger, - // TODO: Provide during setup. - MonitoringEndpoint: oracleEndpoint, - // TODO: Provide during setup. - // PASS: Implementation taken from the capability. - // TODO: (Re)define interface? - OffchainConfigDigester: provider.OffchainConfigDigester(), - // TODO: Provide during setup. - OffchainKeyring: kb, - // TODO: Provide during setup. - OnchainKeyring: onchainKeyringAdapter, - // TODO: Provide during setup. - MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": jb.Name.ValueOrZero()}, prometheus.DefaultRegisterer), - } - oracleArgs.ReportingPluginFactory = plugin - - INITIAL (from https://docs.google.com/document/d/1nEvHO_d1CSpP53YhUuU2xaVzXHzAkFqAo-AQTIe4-5k/edit): - type LocalConfig struct { - BlockchainTimeout time.Duration // This should be part of the syncer. - ContractConfigConfirmations uint16 // This should be part of the syncer. - SkipContractConfigConfirmations bool // This should be part of the syncer. - // This should be part of the syncer. Because we can't really have a custom syncer - // interval for each capability. Also, this would be blockchain specific anyway. - ContractConfigTrackerPollInterval time.Duration - ContractTransmitterTransmitTimeout time.Duration // This should be part of the syncer. - MinOCR2MaxDurationQuery time.Duration // Not sure what this is for. - } - - type OCR3OracleArgs struct { - localConfig LocalConfig - contractTransmitter ocr3types.ContractTransmitter[[]byte] - offchainConfigDigester ocr3types.OffchainConfigDigester[[]byte] - // Should this be default and shared by all oracle instance spawned by the node - // that same way that a p2pId is? - onchainKeyring ocr3types.OnchainKeyring[[]byte] - } - - type NewOracleAPI interface { - NewOracle(OracleArgs) - } - - PROPOSED: - type OCR3OracleArgs struct { - // Controlling the transmitter allows the capability to send reports to a local inbox, - // on-chain, etc. - // Capability devs will likely send a capability response or store to outbox. - contractTransmitter ocr3types.ContractTransmitter[[]byte] - // The capability would need to store its on-chain config the same way that it is going - // to be decoded by the config digester. So config encode/decode/validate should be - // implemented. - offchainConfigDigester ocr3types.OffchainConfigDigester[[]byte] - - // Missing? - // - ReportingPlugin - // - Updates to the config restarting the oracle. - } - - type NewOracleAPI interface { - NewOracle(OracleArgs) - } - - QUESTIONS: - - Do we want job.NewServiceAdapter like thing for capabilities if instances will be spawned from capabilities binary? - - Why are oracle and plugin separate services? - - */ - - // KeyBundle - figure out if we create one on startup. - // COuld we KeyBundles.getAll() and then use the first one? return &standardCapabilities{ log: log, spec: spec, From c9e28643bc039dc8053ab722478595091e4d2275 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Mon, 2 Sep 2024 16:07:34 +0300 Subject: [PATCH 03/30] Add bootstrap peers via capabilities spec --- core/scripts/go.mod | 4 +- core/scripts/go.sum | 8 +- core/services/job/models.go | 11 +-- .../ocr2/plugins/generic/oraclefactory.go | 48 +++++++++- .../services/standardcapabilities/delegate.go | 13 ++- .../standardcapabilities/delegate_test.go | 89 +++++++++++++++++-- go.mod | 4 +- go.sum | 8 +- integration-tests/go.mod | 4 +- integration-tests/go.sum | 8 +- integration-tests/load/go.mod | 4 +- integration-tests/load/go.sum | 8 +- 12 files changed, 168 insertions(+), 41 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 2e1d24ba1ad..c4c961d89ee 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.17.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.0 @@ -243,7 +243,6 @@ require ( github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/mwitkow/grpc-proxy v0.0.0-20230212185441-f345521cb9c9 // indirect github.com/oklog/run v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect @@ -277,6 +276,7 @@ require ( github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827 // indirect github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240821170223-a2f5c39f457f // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240709043547-03612098f799 // indirect + github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.3 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index f718f2a66d7..1d98371bb32 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1190,8 +1190,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b h1:v1RnZVfUoHIm/lwIqRAH4eDRNTu+N+AtQE5Ik4U9hsU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b/go.mod h1:Z9lQ5t20kRk28pzRLnqAJZUVOw8E6/siA3P3MLyKqoM= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8 h1:lpSTJZZ81qabxenBcqyYTucBUF1Ky4aLfPnnjSHL3X4= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830100518-f84e8e2a7de8/go.mod h1:c2iZi7NC7cfQY/aKo2V9AAMyFOU+6/odYzASvNhupko= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c h1:dX68Us+R9M2OM4mJovOsat4DxKmkVjTkA/LYqpsl8yY= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c/go.mod h1:qtkr71Qrx62qLQyG/UyqJaMeIlVwnu7zoYsc92PYFEI= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1202,8 +1202,8 @@ github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240821170223-a2f5c39f457 github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240821170223-a2f5c39f457f/go.mod h1:Ml88TJTwZCj6yHDkAEN/EhxVutzSlk+kDZgfibRIqF0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240709043547-03612098f799 h1:HyLTySm7BR+oNfZqDTkVJ25wnmcTtxBBD31UkFL+kEM= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240709043547-03612098f799/go.mod h1:UVFRacRkP7O7TQAzFmR52v5mUlxf+G1ovMlCQAB/cHU= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= diff --git a/core/services/job/models.go b/core/services/job/models.go index 1c46d08c59c..411236c0d22 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -896,11 +896,12 @@ func (w *WorkflowSpec) Validate() error { } type StandardCapabilitiesSpec struct { - ID int32 - CreatedAt time.Time `toml:"-"` - UpdatedAt time.Time `toml:"-"` - Command string `toml:"command"` - Config string `toml:"config"` + ID int32 + CreatedAt time.Time `toml:"-"` + UpdatedAt time.Time `toml:"-"` + Command string `toml:"command"` + Config string `toml:"config"` + OracleFactory JSONConfig `toml:"oracleFactory"` } func (w *StandardCapabilitiesSpec) GetID() string { diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 7fbc1282054..5b1ed920b42 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -2,9 +2,12 @@ package generic import ( "context" + "encoding/json" "fmt" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" + "github.com/smartcontractkit/libocr/commontypes" ocr "github.com/smartcontractkit/libocr/offchainreporting2plus" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" @@ -17,6 +20,41 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/core" ) +type oracleFactoryConfig struct { + Enabled bool + BootstrapPeers []commontypes.BootstrapperLocator +} + +func NewOracleFactoryConfig(config job.JSONConfig) (*oracleFactoryConfig, error) { + var ofc struct { + Enabled bool `json:"enabled"` + BootstrapPeers []string `json:"bootstrapPeers"` + } + err := json.Unmarshal(config.Bytes(), &ofc) + if err != nil { + return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") + } + + if !ofc.Enabled { + return &oracleFactoryConfig{}, nil + } + + bootstrapPeers, err := ocrcommon.ParseBootstrapPeers(ofc.BootstrapPeers) + if err != nil { + return nil, errors.Wrap(err, "failed to parse bootstrap peers") + } + + // If Oracle Factory is enabled, it must have at least one bootstrap peer + if len(bootstrapPeers) == 0 { + return nil, errors.New("no bootstrap peers found") + } + + return &oracleFactoryConfig{ + Enabled: true, + BootstrapPeers: bootstrapPeers, + }, nil +} + type oracleFactory struct { database ocr3types.Database jobID int32 @@ -24,6 +62,7 @@ type oracleFactory struct { jobORM job.ORM kb ocr2key.KeyBundle lggr logger.Logger + config *oracleFactoryConfig } type OracleFactoryParams struct { @@ -33,6 +72,7 @@ type OracleFactoryParams struct { JobORM job.ORM Kb ocr2key.KeyBundle Logger logger.Logger + Config *oracleFactoryConfig } func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { @@ -43,6 +83,7 @@ func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { jobORM: params.JobORM, kb: params.Kb, lggr: params.Logger, + config: params.Config, }, nil } @@ -61,10 +102,9 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c OffchainConfigDigester: args.OffchainConfigDigester, ReportingPluginFactory: args.ReportingPluginFactoryService, // BinaryNetworkEndpointFactory: d.cfg.BinaryNetworkEndpointFactory, - // V2Bootstrappers: d.cfg.V2Bootstrappers, - Database: of.database, - Logger: ocrLogger, - // TODO: This is Relayer Dependent - can we make it Relayer agnostic? + V2Bootstrappers: of.config.BootstrapPeers, + Database: of.database, + Logger: ocrLogger, MonitoringEndpoint: &telemetry.NoopAgent{}, OffchainKeyring: of.kb, OnchainKeyring: ocrcommon.NewOCR3OnchainKeyringAdapter(of.kb), diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 3ca594d1eb2..2dd04604820 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -79,7 +79,12 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser return nil, err } if len(keyBundles) > 1 { - return nil, fmt.Errorf("expected only one OCR key bundle, but found found: %s", len(keyBundles)) + return nil, fmt.Errorf("expected only one OCR key bundle, but found found: %d", len(keyBundles)) + } + + oracleFactoryConfig, err := generic.NewOracleFactoryConfig(spec.StandardCapabilitiesSpec.OracleFactory) + if err != nil { + return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") } // KeyBundle - figure out if we create one on startup. @@ -91,6 +96,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobName: spec.Name.ValueOrZero(), Database: ocr2.NewDB(d.ds, spec.ID, 0, log), Kb: keyBundles[0], + Config: oracleFactoryConfig, }) if err != nil { return nil, fmt.Errorf("failed to create oracle factory: %w", err) @@ -135,6 +141,11 @@ func ValidatedStandardCapabilitiesSpec(tomlString string) (job.Job, error) { return jb, errors.Errorf("standard capabilities command must be set") } + _, err = generic.NewOracleFactoryConfig(jb.StandardCapabilitiesSpec.OracleFactory) + if err != nil { + return jb, errors.Wrap(err, "failed to unmarshal oracle factory config") + } + return jb, nil } diff --git a/core/services/standardcapabilities/delegate_test.go b/core/services/standardcapabilities/delegate_test.go index 98173eb8883..4cb19a7b1c3 100644 --- a/core/services/standardcapabilities/delegate_test.go +++ b/core/services/standardcapabilities/delegate_test.go @@ -3,35 +3,110 @@ package standardcapabilities_test import ( "testing" - "github.com/test-go/testify/require" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/standardcapabilities" ) func Test_ValidatedStandardCapabilitiesSpec(t *testing.T) { - type testCase struct { name string + tomlString string expectedError string + expectedSpec *job.StandardCapabilitiesSpec } testCases := []testCase{ { name: "invalid TOML string", + tomlString: `[[]`, expectedError: "toml error on load standard capabilities", }, + { + name: "incorrect job type", + tomlString: ` + type="nonstandardcapabilities" + `, + expectedError: "standard capabilities unsupported job type", + }, + { + name: "command unset", + tomlString: ` + type="standardcapabilities" + `, + expectedError: "standard capabilities command must be set", + }, + { + name: "invalid oracle config: malformed peer", + tomlString: ` + type="standardcapabilities" + command="path/to/binary" + + [oracleFactory] + enabled=true + bootstrapPeers = [ + "invalid_p2p_id@invalid_ip:1111" + ] + `, + expectedError: "failed to parse bootstrap peers", + }, + { + name: "invalid oracle config: missing bootstrap peers", + tomlString: ` + type="standardcapabilities" + command="path/to/binary" + + [oracleFactory] + enabled=true + `, + expectedError: "no bootstrap peers found", + }, + { + name: "valid spec", + tomlString: ` + type="standardcapabilities" + command="path/to/binary" + `, + }, + { + name: "valid spec with oracle config", + tomlString: ` + type="standardcapabilities" + command="path/to/binary" + + [oracleFactory] + enabled=true + bootstrapPeers = [ + "12D3KooWEBVwbfdhKnicois7FTYVsBFGFcoMhMCKXQC57BQyZMhz@localhost:6690" + ] + `, + expectedSpec: &job.StandardCapabilitiesSpec{ + Command: "path/to/binary", + OracleFactory: job.JSONConfig{ + "enabled": true, + "bootstrapPeers": []interface{}{ + "12D3KooWEBVwbfdhKnicois7FTYVsBFGFcoMhMCKXQC57BQyZMhz@localhost:6690", + }, + }, + }, + }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - _, err := standardcapabilities.ValidatedStandardCapabilitiesSpec("invalid TOML string") + jobSpec, err := standardcapabilities.ValidatedStandardCapabilitiesSpec(tc.tomlString) - if tc.expectedError == "" { - require.NoError(t, err) + if tc.expectedError != "" { + assert.ErrorContains(t, err, tc.expectedError) } else { - require.Error(t, err, tc.expectedError) + require.NoError(t, err) + } + + if tc.expectedSpec != nil { + assert.EqualValues(t, tc.expectedSpec, jobSpec.StandardCapabilitiesSpec) } }) } - } diff --git a/go.mod b/go.mod index baf4c187ef3..a4484c129b3 100644 --- a/go.mod +++ b/go.mod @@ -75,7 +75,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.21 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827 @@ -279,7 +279,6 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/mwitkow/grpc-proxy v0.0.0-20230212185441-f345521cb9c9 // indirect github.com/oklog/run v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect @@ -294,6 +293,7 @@ require ( github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect diff --git a/go.sum b/go.sum index fee72a64936..03989707a14 100644 --- a/go.sum +++ b/go.sum @@ -1147,8 +1147,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b h1:v1RnZVfUoHIm/lwIqRAH4eDRNTu+N+AtQE5Ik4U9hsU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b/go.mod h1:Z9lQ5t20kRk28pzRLnqAJZUVOw8E6/siA3P3MLyKqoM= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8 h1:MOFuL1J4/rRcR0x09qSlOsKIiq4I7YzbZcQ421KqUZA= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8/go.mod h1:TJSY2ETKiXLRPvGHNO7Dp1tlpFIPSCWwN3iIdrsadIE= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c h1:dX68Us+R9M2OM4mJovOsat4DxKmkVjTkA/LYqpsl8yY= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c/go.mod h1:qtkr71Qrx62qLQyG/UyqJaMeIlVwnu7zoYsc92PYFEI= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1159,8 +1159,8 @@ github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240821170223-a2f5c39f457 github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240821170223-a2f5c39f457f/go.mod h1:Ml88TJTwZCj6yHDkAEN/EhxVutzSlk+kDZgfibRIqF0= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240709043547-03612098f799 h1:HyLTySm7BR+oNfZqDTkVJ25wnmcTtxBBD31UkFL+kEM= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240709043547-03612098f799/go.mod h1:UVFRacRkP7O7TQAzFmR52v5mUlxf+G1ovMlCQAB/cHU= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 792452ee522..006c3b716c1 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -36,7 +36,7 @@ require ( github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240808195812-ae0378684685 github.com/smartcontractkit/chain-selectors v1.0.21 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c github.com/smartcontractkit/chainlink-testing-framework v1.34.10 github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.1 github.com/smartcontractkit/chainlink-testing-framework/havoc v0.1.0 @@ -361,7 +361,6 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect - github.com/mwitkow/grpc-proxy v0.0.0-20230212185441-f345521cb9c9 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/oklog/run v1.1.0 // indirect github.com/oklog/ulid v1.3.1 // indirect @@ -409,6 +408,7 @@ require ( github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827 // indirect github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240821170223-a2f5c39f457f // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240709043547-03612098f799 // indirect + github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.8.1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 3227d1ec705..b0601dec408 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1425,8 +1425,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b h1:v1RnZVfUoHIm/lwIqRAH4eDRNTu+N+AtQE5Ik4U9hsU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b/go.mod h1:Z9lQ5t20kRk28pzRLnqAJZUVOw8E6/siA3P3MLyKqoM= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8 h1:MOFuL1J4/rRcR0x09qSlOsKIiq4I7YzbZcQ421KqUZA= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8/go.mod h1:TJSY2ETKiXLRPvGHNO7Dp1tlpFIPSCWwN3iIdrsadIE= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c h1:dX68Us+R9M2OM4mJovOsat4DxKmkVjTkA/LYqpsl8yY= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c/go.mod h1:qtkr71Qrx62qLQyG/UyqJaMeIlVwnu7zoYsc92PYFEI= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1447,8 +1447,8 @@ github.com/smartcontractkit/chainlink-testing-framework/seth v1.2.1 h1:GRAAvtn2+ github.com/smartcontractkit/chainlink-testing-framework/seth v1.2.1/go.mod h1:afY3QmNgeR/VI1pRbGH8g3YXGy7C2RrFOwUzEFvL3L8= github.com/smartcontractkit/chainlink-testing-framework/wasp v0.4.10 h1:s7e9YPU/ECQ9xCyLc60ApFbf0blMjg9LWi31CAEjaZY= github.com/smartcontractkit/chainlink-testing-framework/wasp v0.4.10/go.mod h1:E7x2ICsT8vzy0nL6wwBphoQMoNwOMl0L9voQpEl1FoM= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 6e9b41bf383..5fd5709d543 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -16,7 +16,7 @@ require ( github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c github.com/smartcontractkit/chainlink-testing-framework v1.34.10 github.com/smartcontractkit/chainlink-testing-framework/seth v1.2.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v0.4.10 @@ -62,6 +62,7 @@ require ( github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 // indirect github.com/smartcontractkit/chainlink-testing-framework/havoc v0.1.0 // indirect + github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect github.com/sourcegraph/conc v0.3.0 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect k8s.io/apimachinery v0.31.0 // indirect @@ -351,7 +352,6 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect - github.com/mwitkow/grpc-proxy v0.0.0-20230212185441-f345521cb9c9 // indirect github.com/oklog/run v1.1.0 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 252abe81041..a458c0dd5a1 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1395,8 +1395,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b h1:v1RnZVfUoHIm/lwIqRAH4eDRNTu+N+AtQE5Ik4U9hsU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240828115624-442f1cff195b/go.mod h1:Z9lQ5t20kRk28pzRLnqAJZUVOw8E6/siA3P3MLyKqoM= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8 h1:MOFuL1J4/rRcR0x09qSlOsKIiq4I7YzbZcQ421KqUZA= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240829145110-4a45c426fbe8/go.mod h1:TJSY2ETKiXLRPvGHNO7Dp1tlpFIPSCWwN3iIdrsadIE= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c h1:dX68Us+R9M2OM4mJovOsat4DxKmkVjTkA/LYqpsl8yY= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240902092205-6c13b641e59c/go.mod h1:qtkr71Qrx62qLQyG/UyqJaMeIlVwnu7zoYsc92PYFEI= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240820130645-cf4b159fbba2 h1:KH6tpCw5hu8u6UTtgll7a8mE4sIbHCbmtzHJdKuRwBw= @@ -1417,8 +1417,8 @@ github.com/smartcontractkit/chainlink-testing-framework/seth v1.2.1 h1:GRAAvtn2+ github.com/smartcontractkit/chainlink-testing-framework/seth v1.2.1/go.mod h1:afY3QmNgeR/VI1pRbGH8g3YXGy7C2RrFOwUzEFvL3L8= github.com/smartcontractkit/chainlink-testing-framework/wasp v0.4.10 h1:s7e9YPU/ECQ9xCyLc60ApFbf0blMjg9LWi31CAEjaZY= github.com/smartcontractkit/chainlink-testing-framework/wasp v0.4.10/go.mod h1:E7x2ICsT8vzy0nL6wwBphoQMoNwOMl0L9voQpEl1FoM= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= -github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= +github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= From 80c43de50d290a37da8fbe3efd48ef985eaf4496 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Mon, 2 Sep 2024 16:46:15 +0300 Subject: [PATCH 04/30] Add peer wrapper to Oracle Factory --- core/services/chainlink/application.go | 22 +++--- .../ocr2/plugins/generic/oraclefactory.go | 76 ++++++++++--------- .../services/standardcapabilities/delegate.go | 27 ++++--- .../standardcapabilities/delegate_test.go | 4 +- 4 files changed, 71 insertions(+), 58 deletions(-) diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index bdd2351d6d6..0b121509498 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -438,16 +438,6 @@ func NewApplication(opts ApplicationOpts) (Application, error) { pipelineRunner, cfg.JobPipeline(), ), - job.StandardCapabilities: standardcapabilities.NewDelegate( - globalLogger, - opts.DS, jobORM, - opts.CapabilitiesRegistry, - loopRegistrarConfig, - telemetryManager, - pipelineRunner, - opts.RelayerChainInteroperators, - keyStore.OCR2(), - ), } webhookJobRunner = delegates[job.Webhook].(*webhook.Delegate).WebhookJobRunner() ) @@ -487,6 +477,18 @@ func NewApplication(opts ApplicationOpts) (Application, error) { return nil, fmt.Errorf("P2P stack required for OCR or OCR2") } + delegates[job.StandardCapabilities] = standardcapabilities.NewDelegate( + globalLogger, + opts.DS, jobORM, + opts.CapabilitiesRegistry, + loopRegistrarConfig, + telemetryManager, + pipelineRunner, + opts.RelayerChainInteroperators, + keyStore.OCR2(), + peerWrapper, + ) + if cfg.OCR().Enabled() { delegates[job.OffchainReporting] = ocr.NewDelegate( opts.DS, diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 5b1ed920b42..2864c52f876 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -22,12 +22,14 @@ import ( type oracleFactoryConfig struct { Enabled bool + TraceLogging bool BootstrapPeers []commontypes.BootstrapperLocator } func NewOracleFactoryConfig(config job.JSONConfig) (*oracleFactoryConfig, error) { var ofc struct { Enabled bool `json:"enabled"` + TraceLogging bool `json:"traceLogging"` BootstrapPeers []string `json:"bootstrapPeers"` } err := json.Unmarshal(config.Bytes(), &ofc) @@ -51,60 +53,60 @@ func NewOracleFactoryConfig(config job.JSONConfig) (*oracleFactoryConfig, error) return &oracleFactoryConfig{ Enabled: true, + TraceLogging: ofc.TraceLogging, BootstrapPeers: bootstrapPeers, }, nil } type oracleFactory struct { - database ocr3types.Database - jobID int32 - jobName string - jobORM job.ORM - kb ocr2key.KeyBundle - lggr logger.Logger - config *oracleFactoryConfig + database ocr3types.Database + jobID int32 + jobName string + jobORM job.ORM + kb ocr2key.KeyBundle + lggr logger.Logger + config *oracleFactoryConfig + peerWrapper *ocrcommon.SingletonPeerWrapper } type OracleFactoryParams struct { - Database ocr3types.Database - JobID int32 - JobName string - JobORM job.ORM - Kb ocr2key.KeyBundle - Logger logger.Logger - Config *oracleFactoryConfig + Database ocr3types.Database + JobID int32 + JobName string + JobORM job.ORM + Kb ocr2key.KeyBundle + Logger logger.Logger + Config *oracleFactoryConfig + PeerWrapper *ocrcommon.SingletonPeerWrapper } func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { return &oracleFactory{ - database: params.Database, - jobID: params.JobID, - jobName: params.JobName, - jobORM: params.JobORM, - kb: params.Kb, - lggr: params.Logger, - config: params.Config, + database: params.Database, + jobID: params.JobID, + jobName: params.JobName, + jobORM: params.JobORM, + kb: params.Kb, + lggr: params.Logger, + config: params.Config, + peerWrapper: params.PeerWrapper, }, nil } func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (core.Oracle, error) { - // Could come from the capability spec config. Unsure about this as it feels wrong to expose implementation details of OCR config to the capability spec. - traceLogging := false - ocrLogger := ocrcommon.NewOCRWrapper(of.lggr, traceLogging, func(ctx context.Context, msg string) { - logger.Sugared(of.lggr).ErrorIf(of.jobORM.RecordError(ctx, of.jobID, msg), "unable to record error") - }) - - // create the oracle from config values oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ - LocalConfig: args.LocalConfig, - ContractConfigTracker: args.ContractConfigTracker, - ContractTransmitter: args.ContractTransmitter, - OffchainConfigDigester: args.OffchainConfigDigester, - ReportingPluginFactory: args.ReportingPluginFactoryService, - // BinaryNetworkEndpointFactory: d.cfg.BinaryNetworkEndpointFactory, - V2Bootstrappers: of.config.BootstrapPeers, - Database: of.database, - Logger: ocrLogger, + LocalConfig: args.LocalConfig, + ContractConfigTracker: args.ContractConfigTracker, + ContractTransmitter: args.ContractTransmitter, + OffchainConfigDigester: args.OffchainConfigDigester, + ReportingPluginFactory: args.ReportingPluginFactoryService, + BinaryNetworkEndpointFactory: of.peerWrapper.Peer2, + V2Bootstrappers: of.config.BootstrapPeers, + Database: of.database, + Logger: ocrcommon.NewOCRWrapper(of.lggr, of.config.TraceLogging, func(ctx context.Context, msg string) { + logger.Sugared(of.lggr).ErrorIf(of.jobORM.RecordError(ctx, of.jobID, msg), "unable to record error") + }), + // TODO? MonitoringEndpoint: &telemetry.NoopAgent{}, OffchainKeyring: of.kb, OnchainKeyring: ocrcommon.NewOCR3OnchainKeyringAdapter(of.kb), diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 2dd04604820..60e09ffa3e9 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -17,6 +17,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/generic" + "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" "github.com/smartcontractkit/chainlink/v2/plugins" @@ -37,6 +38,7 @@ type Delegate struct { pipelineRunner pipeline.Runner relayers RelayGetter ocrKs keystore.OCR2 + peerWrapper *ocrcommon.SingletonPeerWrapper isNewlyCreatedJob bool } @@ -45,10 +47,12 @@ func NewDelegate(logger logger.Logger, ds sqlutil.DataSource, jobORM job.ORM, re cfg plugins.RegistrarConfig, monitoringEndpointGen telemetry.MonitoringEndpointGenerator, pipelineRunner pipeline.Runner, relayers RelayGetter, ocrKs keystore.OCR2, + peerWrapper *ocrcommon.SingletonPeerWrapper, ) *Delegate { return &Delegate{logger: logger, ds: ds, jobORM: jobORM, registry: registry, cfg: cfg, monitoringEndpointGen: monitoringEndpointGen, pipelineRunner: pipelineRunner, relayers: relayers, isNewlyCreatedJob: false, - ocrKs: ocrKs, + ocrKs: ocrKs, + peerWrapper: peerWrapper, } } @@ -87,16 +91,19 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") } - // KeyBundle - figure out if we create one on startup. - // COuld we KeyBundles.getAll() and then use the first one? + if oracleFactoryConfig.Enabled && d.peerWrapper == nil { + return nil, errors.New("P2P stack required for Oracle Factory") + } + oracleFactory, err := generic.NewOracleFactory(generic.OracleFactoryParams{ - Logger: log, - JobORM: d.jobORM, - JobID: spec.ID, - JobName: spec.Name.ValueOrZero(), - Database: ocr2.NewDB(d.ds, spec.ID, 0, log), - Kb: keyBundles[0], - Config: oracleFactoryConfig, + Logger: log, + JobORM: d.jobORM, + JobID: spec.ID, + JobName: spec.Name.ValueOrZero(), + Database: ocr2.NewDB(d.ds, spec.ID, 0, log), + Kb: keyBundles[0], + Config: oracleFactoryConfig, + PeerWrapper: d.peerWrapper, }) if err != nil { return nil, fmt.Errorf("failed to create oracle factory: %w", err) diff --git a/core/services/standardcapabilities/delegate_test.go b/core/services/standardcapabilities/delegate_test.go index 4cb19a7b1c3..8c9ea1de097 100644 --- a/core/services/standardcapabilities/delegate_test.go +++ b/core/services/standardcapabilities/delegate_test.go @@ -78,6 +78,7 @@ func Test_ValidatedStandardCapabilitiesSpec(t *testing.T) { [oracleFactory] enabled=true + traceLogging=true bootstrapPeers = [ "12D3KooWEBVwbfdhKnicois7FTYVsBFGFcoMhMCKXQC57BQyZMhz@localhost:6690" ] @@ -85,7 +86,8 @@ func Test_ValidatedStandardCapabilitiesSpec(t *testing.T) { expectedSpec: &job.StandardCapabilitiesSpec{ Command: "path/to/binary", OracleFactory: job.JSONConfig{ - "enabled": true, + "enabled": true, + "traceLogging": true, "bootstrapPeers": []interface{}{ "12D3KooWEBVwbfdhKnicois7FTYVsBFGFcoMhMCKXQC57BQyZMhz@localhost:6690", }, From 0b969fb21773a791bd20d5811969c4c359bf4c7f Mon Sep 17 00:00:00 2001 From: DeividasK Date: Mon, 2 Sep 2024 19:46:28 +0300 Subject: [PATCH 05/30] Add comment explaining delegate position --- core/services/chainlink/application.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index 0b121509498..0172f03e253 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -477,6 +477,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) { return nil, fmt.Errorf("P2P stack required for OCR or OCR2") } + // If peer wrapper is initialized, Oracle Factory dependency will be available to standard capabilities delegates[job.StandardCapabilities] = standardcapabilities.NewDelegate( globalLogger, opts.DS, jobORM, From c9a3fca3192c1260aa706f26d9a5ee11873c9773 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Mon, 2 Sep 2024 19:55:44 +0300 Subject: [PATCH 06/30] Cleanup --- core/services/ocr2/delegate.go | 1 - core/services/ocr2/plugins/generic/oraclefactory.go | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index ac7c36a1ac7..52dbbf87b53 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -792,7 +792,6 @@ func (d *Delegate) newServicesGenericPlugin( OnchainKeyring: onchainKeyringAdapter, MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": jb.Name.ValueOrZero()}, prometheus.DefaultRegisterer), } - // This would be newReportingPluginFactory that returns the service oracleArgs.ReportingPluginFactory = plugin srvs = append(srvs, plugin) oracle, err := libocr2.NewOracle(oracleArgs) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 2864c52f876..73e44626f5a 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -41,16 +41,16 @@ func NewOracleFactoryConfig(config job.JSONConfig) (*oracleFactoryConfig, error) return &oracleFactoryConfig{}, nil } + // If Oracle Factory is enabled, it must have at least one bootstrap peer + if len(ofc.BootstrapPeers) == 0 { + return nil, errors.New("no bootstrap peers found") + } + bootstrapPeers, err := ocrcommon.ParseBootstrapPeers(ofc.BootstrapPeers) if err != nil { return nil, errors.Wrap(err, "failed to parse bootstrap peers") } - // If Oracle Factory is enabled, it must have at least one bootstrap peer - if len(bootstrapPeers) == 0 { - return nil, errors.New("no bootstrap peers found") - } - return &oracleFactoryConfig{ Enabled: true, TraceLogging: ofc.TraceLogging, From 8f09d65668e75f194d99d0cfa005fd4a78aa5251 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Tue, 3 Sep 2024 13:16:49 +0300 Subject: [PATCH 07/30] Create a key bundle if none exists --- core/services/standardcapabilities/delegate.go | 18 ++++++++++++++++-- core/services/workflows/engine.go | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 60e09ffa3e9..ee7c91dbab8 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -15,6 +15,8 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" + "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" + "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/generic" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" @@ -82,8 +84,20 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser if err != nil { return nil, err } + if len(keyBundles) > 1 { - return nil, fmt.Errorf("expected only one OCR key bundle, but found found: %d", len(keyBundles)) + return nil, fmt.Errorf("expected exactly one OCR key bundle, but found: %d", len(keyBundles)) + } + + var keyBundle ocr2key.KeyBundle + + if len(keyBundles) == 0 { + keyBundle, err = d.ocrKs.Create(ctx, chaintype.EVM) + if err != nil { + return nil, errors.Wrap(err, "failed to create OCR key bundle") + } + } else { + keyBundle = keyBundles[0] } oracleFactoryConfig, err := generic.NewOracleFactoryConfig(spec.StandardCapabilitiesSpec.OracleFactory) @@ -101,7 +115,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobID: spec.ID, JobName: spec.Name.ValueOrZero(), Database: ocr2.NewDB(d.ds, spec.ID, 0, log), - Kb: keyBundles[0], + Kb: keyBundle, Config: oracleFactoryConfig, PeerWrapper: d.peerWrapper, }) diff --git a/core/services/workflows/engine.go b/core/services/workflows/engine.go index e98c592cc24..1b607bf97de 100644 --- a/core/services/workflows/engine.go +++ b/core/services/workflows/engine.go @@ -10,6 +10,7 @@ import ( "time" "github.com/jonboulle/clockwork" + "github.com/smartcontractkit/chainlink-common/pkg/workflows/exec" "github.com/smartcontractkit/chainlink-common/pkg/capabilities" From 1af14211312154b80972311964e21077b3bedc2b Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 25 Sep 2024 15:32:07 +0300 Subject: [PATCH 08/30] Use PR #738 hash --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 81501034ce4..8bf2bb1d1a0 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.20.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 08f3fb2b764..77da96beb94 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1083,8 +1083,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/go.mod b/go.mod index 53633f263b5..e02e196bf2d 100644 --- a/go.mod +++ b/go.mod @@ -75,7 +75,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f diff --git a/go.sum b/go.sum index 166b268a80e..e4e542d7aff 100644 --- a/go.sum +++ b/go.sum @@ -1044,8 +1044,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 5eeb68f773b..d14a674d702 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -40,7 +40,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 0a8d40353bd..a7a423dc41c 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1425,8 +1425,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 7fc07069d54..df5db711f55 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -15,7 +15,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 0715c672cf5..034437b1dd5 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1399,8 +1399,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= From 475e29226ccbda947e3b9ae5bae3a59441ed86eb Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 25 Sep 2024 15:43:36 +0300 Subject: [PATCH 09/30] Fix bad merge --- .../services/standardcapabilities/delegate.go | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index ffeee2b4fe9..60d492e732f 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -52,13 +52,33 @@ const ( commandOverrideForWebAPITrigger = "__builtin_web-api-trigger" ) -func NewDelegate(logger logger.Logger, ds sqlutil.DataSource, jobORM job.ORM, registry core.CapabilitiesRegistry, - cfg plugins.RegistrarConfig, monitoringEndpointGen telemetry.MonitoringEndpointGenerator, pipelineRunner pipeline.Runner, - relayers RelayGetter, gatewayConnectorWrapper *gatewayconnector.ServiceWrapper) *Delegate { - return &Delegate{logger: logger, ds: ds, jobORM: jobORM, registry: registry, cfg: cfg, monitoringEndpointGen: monitoringEndpointGen, pipelineRunner: pipelineRunner, - relayers: relayers, isNewlyCreatedJob: false, gatewayConnectorWrapper: gatewayConnectorWrapper, - ocrKs: ocrKs, - peerWrapper: peerWrapper} +func NewDelegate( + logger logger.Logger, + ds sqlutil.DataSource, + jobORM job.ORM, + registry core.CapabilitiesRegistry, + cfg plugins.RegistrarConfig, + monitoringEndpointGen telemetry.MonitoringEndpointGenerator, + pipelineRunner pipeline.Runner, + relayers RelayGetter, + gatewayConnectorWrapper *gatewayconnector.ServiceWrapper, + ocrKs keystore.OCR2, + peerWrapper *ocrcommon.SingletonPeerWrapper, +) *Delegate { + return &Delegate{ + logger: logger, + ds: ds, + jobORM: jobORM, + registry: registry, + cfg: cfg, + monitoringEndpointGen: monitoringEndpointGen, + pipelineRunner: pipelineRunner, + relayers: relayers, + isNewlyCreatedJob: false, + gatewayConnectorWrapper: gatewayConnectorWrapper, + ocrKs: ocrKs, + peerWrapper: peerWrapper, + } } func (d *Delegate) JobType() job.Type { From 5f2fc40e1449e3f7f7921cabbc73c23380d2cd20 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Thu, 26 Sep 2024 12:45:47 +0300 Subject: [PATCH 10/30] Bump chainlink-common --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- core/services/ocr2/plugins/generic/oraclefactory.go | 3 +++ go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- 9 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 8bf2bb1d1a0..f1183df16ee 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.20.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 77da96beb94..a5faa293479 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1083,8 +1083,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 73e44626f5a..4d00c9e2bbd 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -94,6 +94,9 @@ func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { } func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (core.Oracle, error) { + if !of.peerWrapper.IsStarted() { + return nil, errors.New("peer wrapper not started") + } oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ LocalConfig: args.LocalConfig, ContractConfigTracker: args.ContractConfigTracker, diff --git a/go.mod b/go.mod index e02e196bf2d..40d93203dd0 100644 --- a/go.mod +++ b/go.mod @@ -75,7 +75,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f diff --git a/go.sum b/go.sum index e4e542d7aff..47cfa220fff 100644 --- a/go.sum +++ b/go.sum @@ -1044,8 +1044,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index d14a674d702..21f57939f13 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -40,7 +40,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index a7a423dc41c..abf6771a43b 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1425,8 +1425,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index df5db711f55..800691f871d 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -15,7 +15,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 034437b1dd5..569e2d1fe77 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1399,8 +1399,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad h1:jR3YZx0qxKPP6jYrw5wwD0aAfvmFFeJ4QIeIZy/1XuU= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925123037-0385cd4a38ad/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= From 0d24b8b7d5e79609bc1747eae5dc080d7be91b1d Mon Sep 17 00:00:00 2001 From: DeividasK Date: Mon, 30 Sep 2024 18:58:29 +0300 Subject: [PATCH 11/30] Use in-memory DB for OCR persistance --- .../ocr2/plugins/generic/oracle_factory_db.go | 123 ++++++++++++++++++ .../ocr2/plugins/generic/oraclefactory.go | 3 +- .../services/standardcapabilities/delegate.go | 22 +++- 3 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 core/services/ocr2/plugins/generic/oracle_factory_db.go diff --git a/core/services/ocr2/plugins/generic/oracle_factory_db.go b/core/services/ocr2/plugins/generic/oracle_factory_db.go new file mode 100644 index 00000000000..bf87054ce18 --- /dev/null +++ b/core/services/ocr2/plugins/generic/oracle_factory_db.go @@ -0,0 +1,123 @@ +package generic + +import ( + "context" + "time" + + "github.com/pkg/errors" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + + "github.com/smartcontractkit/chainlink/v2/core/logger" +) + +type memoryDb struct { + // The ID is used for logging and error messages + // A single standard capabilities spec can instantiate multiple oracles + // TODO: NewOracle should take a unique identifier for the oracle + specID int32 + lggr logger.SugaredLogger + config *ocrtypes.ContractConfig + states map[ocrtypes.ConfigDigest]*ocrtypes.PersistentState + pendingTransmissions map[ocrtypes.ReportTimestamp]ocrtypes.PendingTransmission + protocolStates map[ocrtypes.ConfigDigest]map[string][]byte +} + +var ( + _ ocrtypes.Database = &memoryDb{} +) + +// NewDB returns a new DB scoped to this instanceID +func NewMemoryDB(specID int32, lggr logger.Logger) *memoryDb { + return &memoryDb{ + specID: specID, + lggr: logger.Sugared(lggr.Named("OracleFactoryMemoryDb")), + } +} + +func (md *memoryDb) ReadState(ctx context.Context, cd ocrtypes.ConfigDigest) (ps *ocrtypes.PersistentState, err error) { + ps, ok := md.states[cd] + if !ok { + return nil, errors.Errorf("state not found for standard capabilities spec ID %d, config digest %s", md.specID, cd) + } + + return ps, nil +} + +func (md *memoryDb) WriteState(ctx context.Context, cd ocrtypes.ConfigDigest, state ocrtypes.PersistentState) error { + md.states[cd] = &state + return nil +} + +func (md *memoryDb) ReadConfig(ctx context.Context) (c *ocrtypes.ContractConfig, err error) { + if md.config == nil { + return nil, errors.Errorf("config not found for standard capabilities spec ID %d", md.specID) + } + return md.config, nil +} + +func (md *memoryDb) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { + md.config = &c + return nil +} + +func (md *memoryDb) StorePendingTransmission(ctx context.Context, t ocrtypes.ReportTimestamp, tx ocrtypes.PendingTransmission) error { + md.pendingTransmissions[t] = tx + return nil +} + +func (md *memoryDb) PendingTransmissionsWithConfigDigest(ctx context.Context, cd ocrtypes.ConfigDigest) (map[ocrtypes.ReportTimestamp]ocrtypes.PendingTransmission, error) { + m := make(map[ocrtypes.ReportTimestamp]ocrtypes.PendingTransmission) + for k, v := range md.pendingTransmissions { + if k.ConfigDigest == cd { + m[k] = v + } + } + + return m, nil +} + +func (md *memoryDb) DeletePendingTransmission(ctx context.Context, t ocrtypes.ReportTimestamp) error { + delete(md.pendingTransmissions, t) + return nil +} + +func (md *memoryDb) DeletePendingTransmissionsOlderThan(ctx context.Context, t time.Time) error { + for k, v := range md.pendingTransmissions { + if v.Time.Before(t) { + delete(md.pendingTransmissions, k) + } + } + + return nil +} + +func (md *memoryDb) ReadProtocolState( + ctx context.Context, + configDigest ocrtypes.ConfigDigest, + key string, +) ([]byte, error) { + value, ok := md.protocolStates[configDigest][key] + if !ok { + // Previously implementation returned nil if the state is not found + // TODO: Should this return nil, nil? + return nil, nil + } + return value, nil +} + +func (md *memoryDb) WriteProtocolState( + ctx context.Context, + configDigest ocrtypes.ConfigDigest, + key string, + value []byte, +) error { + if value == nil { + delete(md.protocolStates[configDigest], key) + } else { + if md.protocolStates[configDigest] == nil { + md.protocolStates[configDigest] = make(map[string][]byte) + } + md.protocolStates[configDigest][key] = value + } + return nil +} diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 4d00c9e2bbd..60e4dfe7034 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -70,7 +70,6 @@ type oracleFactory struct { } type OracleFactoryParams struct { - Database ocr3types.Database JobID int32 JobName string JobORM job.ORM @@ -82,7 +81,7 @@ type OracleFactoryParams struct { func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { return &oracleFactory{ - database: params.Database, + database: NewMemoryDB(params.JobID, params.Logger), jobID: params.JobID, jobName: params.JobName, jobORM: params.JobORM, diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 60d492e732f..46c14304ffe 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -2,6 +2,7 @@ package standardcapabilities import ( "context" + "encoding/json" "fmt" "github.com/google/uuid" @@ -19,7 +20,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/generic" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" @@ -123,6 +123,25 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser keyBundle = keyBundles[0] } + keyBundleBytes, err := json.Marshal(struct { + PeerID string + PublicKey []byte + OffchainPublicKey [32]byte + ConfigEncryptionPublicKey [32]byte + }{ + PeerID: d.peerWrapper.Peer2.PeerID(), + PublicKey: keyBundle.PublicKey(), + OffchainPublicKey: keyBundle.OffchainPublicKey(), + ConfigEncryptionPublicKey: keyBundle.ConfigEncryptionPublicKey(), + }) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal key bundle") + } + log.Debug("string(keyBundleBytes): ", string(keyBundleBytes)) + + spec.StandardCapabilitiesSpec.Config = spec.StandardCapabilitiesSpec.Config + string(keyBundleBytes) + log.Debug("Config: ", spec.StandardCapabilitiesSpec.Config) + oracleFactoryConfig, err := generic.NewOracleFactoryConfig(spec.StandardCapabilitiesSpec.OracleFactory) if err != nil { return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") @@ -137,7 +156,6 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobORM: d.jobORM, JobID: spec.ID, JobName: spec.Name.ValueOrZero(), - Database: ocr2.NewDB(d.ds, spec.ID, 0, log), Kb: keyBundle, Config: oracleFactoryConfig, PeerWrapper: d.peerWrapper, From 370170bdd3153240948fcf97542b0f55e7bd260d Mon Sep 17 00:00:00 2001 From: DeividasK Date: Thu, 3 Oct 2024 11:20:04 +0300 Subject: [PATCH 12/30] Also add eth pubkey --- core/services/chainlink/application.go | 2 +- .../services/standardcapabilities/delegate.go | 58 +++++++++++++------ 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index 836ad49179c..95da62cdfe7 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -502,7 +502,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) { pipelineRunner, opts.RelayerChainInteroperators, gatewayConnectorWrapper, - keyStore.OCR2(), + keyStore, peerWrapper, ) diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 46c14304ffe..96979744131 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" + "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/generic" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" @@ -42,7 +43,7 @@ type Delegate struct { pipelineRunner pipeline.Runner relayers RelayGetter gatewayConnectorWrapper *gatewayconnector.ServiceWrapper - ocrKs keystore.OCR2 + ks keystore.Master peerWrapper *ocrcommon.SingletonPeerWrapper isNewlyCreatedJob bool @@ -62,7 +63,7 @@ func NewDelegate( pipelineRunner pipeline.Runner, relayers RelayGetter, gatewayConnectorWrapper *gatewayconnector.ServiceWrapper, - ocrKs keystore.OCR2, + ks keystore.Master, peerWrapper *ocrcommon.SingletonPeerWrapper, ) *Delegate { return &Delegate{ @@ -76,7 +77,7 @@ func NewDelegate( relayers: relayers, isNewlyCreatedJob: false, gatewayConnectorWrapper: gatewayConnectorWrapper, - ocrKs: ocrKs, + ks: ks, peerWrapper: peerWrapper, } } @@ -103,36 +104,55 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser return nil, fmt.Errorf("failed to create relayer set: %w", err) } - keyBundles, err := d.ocrKs.GetAll() + ocrKeyBundles, err := d.ks.OCR2().GetAll() if err != nil { return nil, err } - if len(keyBundles) > 1 { - return nil, fmt.Errorf("expected exactly one OCR key bundle, but found: %d", len(keyBundles)) + if len(ocrKeyBundles) > 1 { + return nil, fmt.Errorf("expected exactly one OCR key bundle, but found: %d", len(ocrKeyBundles)) } - var keyBundle ocr2key.KeyBundle - - if len(keyBundles) == 0 { - keyBundle, err = d.ocrKs.Create(ctx, chaintype.EVM) + var ocrKeyBundle ocr2key.KeyBundle + if len(ocrKeyBundles) == 0 { + ocrKeyBundle, err = d.ks.OCR2().Create(ctx, chaintype.EVM) if err != nil { return nil, errors.Wrap(err, "failed to create OCR key bundle") } } else { - keyBundle = keyBundles[0] + ocrKeyBundle = ocrKeyBundles[0] + } + + ethKeyBundles, err := d.ks.Eth().GetAll(ctx) + if err != nil { + return nil, err + } + if len(ethKeyBundles) > 1 { + return nil, fmt.Errorf("expected exactly one ETH key bundle, but found: %d", len(ethKeyBundles)) + } + + var ethKeyBundle ethkey.KeyV2 + if len(ethKeyBundles) == 0 { + ethKeyBundle, err = d.ks.Eth().Create(ctx) + if err != nil { + return nil, errors.Wrap(err, "failed to create ETH key bundle") + } + } else { + ethKeyBundle = ethKeyBundles[0] } keyBundleBytes, err := json.Marshal(struct { - PeerID string - PublicKey []byte - OffchainPublicKey [32]byte - ConfigEncryptionPublicKey [32]byte + EVMKey string `json:"evm_key"` + PeerID string `json:"peer_id"` + PublicKey []byte `json:"public_key"` + OffchainPublicKey [32]byte `json:"offchain_public_key"` + ConfigEncryptionPublicKey [32]byte `json:"config_encryption_public_key"` }{ + EVMKey: ethKeyBundle.String(), PeerID: d.peerWrapper.Peer2.PeerID(), - PublicKey: keyBundle.PublicKey(), - OffchainPublicKey: keyBundle.OffchainPublicKey(), - ConfigEncryptionPublicKey: keyBundle.ConfigEncryptionPublicKey(), + PublicKey: ocrKeyBundle.PublicKey(), + OffchainPublicKey: ocrKeyBundle.OffchainPublicKey(), + ConfigEncryptionPublicKey: ocrKeyBundle.ConfigEncryptionPublicKey(), }) if err != nil { return nil, errors.Wrap(err, "failed to marshal key bundle") @@ -156,7 +176,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobORM: d.jobORM, JobID: spec.ID, JobName: spec.Name.ValueOrZero(), - Kb: keyBundle, + Kb: ocrKeyBundle, Config: oracleFactoryConfig, PeerWrapper: d.peerWrapper, }) From abc6f336321ca0795e6a43e7963436f5a6ec9ad5 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Fri, 4 Oct 2024 15:40:38 +0300 Subject: [PATCH 13/30] Oracle instance spawned --- core/services/job/models.go | 11 ++- core/services/ocr2/database.go | 10 ++- .../ocr2/plugins/generic/oracle_factory_db.go | 19 ++++- .../ocr2/plugins/generic/oraclefactory.go | 70 +++++++++++++++++-- .../plugins/generic/oraclefactory_test.go | 63 +++++++++++++++++ core/services/relay/evm/config_poller.go | 21 +++++- .../services/standardcapabilities/delegate.go | 29 ++++---- 7 files changed, 192 insertions(+), 31 deletions(-) create mode 100644 core/services/ocr2/plugins/generic/oraclefactory_test.go diff --git a/core/services/job/models.go b/core/services/job/models.go index 5cca627fe01..b9ec8e726f4 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -928,12 +928,11 @@ func (w *WorkflowSpec) SDKSpec(ctx context.Context) (sdk.WorkflowSpec, error) { } type StandardCapabilitiesSpec struct { - ID int32 - CreatedAt time.Time `toml:"-"` - UpdatedAt time.Time `toml:"-"` - Command string `toml:"command"` - Config string `toml:"config"` - OracleFactory JSONConfig `toml:"oracleFactory"` + ID int32 + CreatedAt time.Time `toml:"-"` + UpdatedAt time.Time `toml:"-"` + Command string `toml:"command"` + Config string `toml:"config"` } func (w *StandardCapabilitiesSpec) GetID() string { diff --git a/core/services/ocr2/database.go b/core/services/ocr2/database.go index 83ee3240a46..cde573d2cb5 100644 --- a/core/services/ocr2/database.go +++ b/core/services/ocr2/database.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "encoding/binary" + "encoding/json" "time" "github.com/lib/pq" @@ -163,6 +164,13 @@ func (d *db) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { for _, s := range c.Signers { signers = append(signers, []byte(s)) } + + cBytes, err := json.Marshal(c) + if err != nil { + return errors.Wrap(err, "WriteConfig failed to marshal config") + } + d.lggr.Debugw("WriteConfig", "ocrtypes.ContractConfig", string(cBytes)) + stmt := ` INSERT INTO ocr2_contract_configs ( ocr2_oracle_spec_id, @@ -190,7 +198,7 @@ func (d *db) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { offchain_config = EXCLUDED.offchain_config, updated_at = NOW() ` - _, err := d.ds.ExecContext(ctx, stmt, + _, err = d.ds.ExecContext(ctx, stmt, d.oracleSpecID, d.pluginID, c.ConfigDigest, diff --git a/core/services/ocr2/plugins/generic/oracle_factory_db.go b/core/services/ocr2/plugins/generic/oracle_factory_db.go index bf87054ce18..26d9ba483da 100644 --- a/core/services/ocr2/plugins/generic/oracle_factory_db.go +++ b/core/services/ocr2/plugins/generic/oracle_factory_db.go @@ -2,6 +2,7 @@ package generic import ( "context" + "encoding/json" "time" "github.com/pkg/errors" @@ -29,8 +30,11 @@ var ( // NewDB returns a new DB scoped to this instanceID func NewMemoryDB(specID int32, lggr logger.Logger) *memoryDb { return &memoryDb{ - specID: specID, - lggr: logger.Sugared(lggr.Named("OracleFactoryMemoryDb")), + specID: specID, + lggr: logger.Sugared(lggr.Named("OracleFactoryMemoryDb")), + states: make(map[ocrtypes.ConfigDigest]*ocrtypes.PersistentState), + pendingTransmissions: make(map[ocrtypes.ReportTimestamp]ocrtypes.PendingTransmission), + protocolStates: make(map[ocrtypes.ConfigDigest]map[string][]byte), } } @@ -50,13 +54,22 @@ func (md *memoryDb) WriteState(ctx context.Context, cd ocrtypes.ConfigDigest, st func (md *memoryDb) ReadConfig(ctx context.Context) (c *ocrtypes.ContractConfig, err error) { if md.config == nil { - return nil, errors.Errorf("config not found for standard capabilities spec ID %d", md.specID) + // Returning nil, nil because this is a cache miss + return nil, nil } return md.config, nil } func (md *memoryDb) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { md.config = &c + + cBytes, err := json.Marshal(c) + if err != nil { + return errors.Wrap(err, "MemoryDB: WriteConfig failed to marshal config") + } + + md.lggr.Debugw("MemoryDB: WriteConfig", "ocrtypes.ContractConfig", string(cBytes)) + return nil } diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 60e4dfe7034..b0fef054ef0 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -17,6 +17,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" + "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/core" ) @@ -26,13 +27,13 @@ type oracleFactoryConfig struct { BootstrapPeers []commontypes.BootstrapperLocator } -func NewOracleFactoryConfig(config job.JSONConfig) (*oracleFactoryConfig, error) { +func NewOracleFactoryConfig(config string) (*oracleFactoryConfig, error) { var ofc struct { Enabled bool `json:"enabled"` TraceLogging bool `json:"traceLogging"` BootstrapPeers []string `json:"bootstrapPeers"` } - err := json.Unmarshal(config.Bytes(), &ofc) + err := json.Unmarshal([]byte(config), &ofc) if err != nil { return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") } @@ -58,6 +59,14 @@ func NewOracleFactoryConfig(config job.JSONConfig) (*oracleFactoryConfig, error) }, nil } +type OracleIdentity struct { + EVMKey string `json:"evm_key"` + PeerID string `json:"peer_id"` + PublicKey []byte `json:"public_key"` + OffchainPublicKey [32]byte `json:"offchain_public_key"` + ConfigEncryptionPublicKey [32]byte `json:"config_encryption_public_key"` +} + type oracleFactory struct { database ocr3types.Database jobID int32 @@ -67,6 +76,8 @@ type oracleFactory struct { lggr logger.Logger config *oracleFactoryConfig peerWrapper *ocrcommon.SingletonPeerWrapper + relayerSet *RelayerSet + identity OracleIdentity } type OracleFactoryParams struct { @@ -77,6 +88,8 @@ type OracleFactoryParams struct { Logger logger.Logger Config *oracleFactoryConfig PeerWrapper *ocrcommon.SingletonPeerWrapper + RelayerSet *RelayerSet + Identity OracleIdentity } func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { @@ -89,18 +102,67 @@ func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { lggr: params.Logger, config: params.Config, peerWrapper: params.PeerWrapper, + relayerSet: params.RelayerSet, + identity: params.Identity, }, nil } +type JSONConfig map[string]interface{} + +// Bytes returns the raw bytes +func (r JSONConfig) Bytes() []byte { + b, _ := json.Marshal(r) + return b +} + func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (core.Oracle, error) { if !of.peerWrapper.IsStarted() { return nil, errors.New("peer wrapper not started") } + + of.lggr.Debug("oracleIdentity: ", of.identity) + + relayer, err := of.relayerSet.Get(ctx, types.RelayID{Network: "evm", ChainID: "31337"}) + if err != nil { + return nil, fmt.Errorf("error when getting relayer: %w", err) + } + + type RelayConfig struct { + ChainID string `json:"chainID"` + EffectiveTransmitterID string `json:"effectiveTransmitterID"` + SendingKeys []string `json:"sendingKeys"` + } + + var relayConfig = RelayConfig{ + ChainID: "31337", + EffectiveTransmitterID: of.identity.EVMKey, + SendingKeys: []string{of.identity.EVMKey}, + } + relayConfigBytes, err := json.Marshal(relayConfig) + if err != nil { + return nil, fmt.Errorf("error when marshalling relay config: %w", err) + } + + pluginProvider, err := relayer.NewPluginProvider(ctx, core.RelayArgs{ + ContractID: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6", // TODO: Oracle Factory config + ProviderType: "plugin", + RelayConfig: relayConfigBytes, + }, core.PluginArgs{ + TransmitterID: of.identity.EVMKey, + PluginConfig: JSONConfig{ + "pluginName": "kvstore-capability", + "OCRVersion": 3, + }.Bytes(), + }) + if err != nil { + return nil, fmt.Errorf("error when getting offchain digester: %w", err) + } + oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ LocalConfig: args.LocalConfig, - ContractConfigTracker: args.ContractConfigTracker, + ContractConfigTracker: pluginProvider.ContractConfigTracker(), ContractTransmitter: args.ContractTransmitter, - OffchainConfigDigester: args.OffchainConfigDigester, + OffchainConfigDigester: pluginProvider.OffchainConfigDigester(), ReportingPluginFactory: args.ReportingPluginFactoryService, BinaryNetworkEndpointFactory: of.peerWrapper.Peer2, V2Bootstrappers: of.config.BootstrapPeers, diff --git a/core/services/ocr2/plugins/generic/oraclefactory_test.go b/core/services/ocr2/plugins/generic/oraclefactory_test.go new file mode 100644 index 00000000000..9f47bed8a13 --- /dev/null +++ b/core/services/ocr2/plugins/generic/oraclefactory_test.go @@ -0,0 +1,63 @@ +package generic + +import ( + "testing" + + "github.com/pkg/errors" + "github.com/smartcontractkit/libocr/commontypes" + "github.com/stretchr/testify/assert" +) + +func TestNewOracleFactoryConfig(t *testing.T) { + tests := []struct { + name string + config string + expectedError error + expected *oracleFactoryConfig + }{ + { + name: "valid config", + config: `{"enabled": true, "traceLogging": true, "bootstrapPeers": [ "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh@localhost:8001" ]}`, + expected: &oracleFactoryConfig{ + Enabled: true, + TraceLogging: true, + BootstrapPeers: []commontypes.BootstrapperLocator{ + { + PeerID: "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh", + Addrs: []string{"localhost:8001"}, + }, + }, + }, + }, + { + name: "invalid JSON", + config: `{"enabled": true, "traceLogging": true, "bootstrapPeers": [ "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh@localhost:8001" `, + expectedError: errors.New("failed to unmarshal oracle factory config"), + }, + { + name: "disabled config", + config: `{"enabled": false, "traceLogging": true, "bootstrapPeers": [ "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh@localhost:8001" ]}`, + expected: &oracleFactoryConfig{ + Enabled: false, + }, + }, + { + name: "enabled with no bootstrap peers", + config: `{"enabled": true, "traceLogging": true, "bootstrapPeers": []}`, + expectedError: errors.New("no bootstrap peers found"), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + config, err := NewOracleFactoryConfig(tt.config) + if tt.expectedError != nil { + assert.Error(t, err) + assert.Contains(t, err.Error(), tt.expectedError.Error()) + } else { + assert.NoError(t, err) + assert.Equal(t, tt.expected, config) + } + }) + } +} diff --git a/core/services/relay/evm/config_poller.go b/core/services/relay/evm/config_poller.go index a00b04b0786..135e5c12e31 100644 --- a/core/services/relay/evm/config_poller.go +++ b/core/services/relay/evm/config_poller.go @@ -3,7 +3,9 @@ package evm import ( "context" "database/sql" + "encoding/json" "fmt" + "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -140,6 +142,10 @@ func (cp *configPoller) LatestConfigDetails(ctx context.Context) (changedInBlock if err != nil { return 0, ocrtypes.ConfigDigest{}, err } + cp.lggr.Infow("ConfigPoller: LatestConfigDetails", + "latest.BlockNumber", uint64(latest.BlockNumber), + "latestConfigSet.ConfigDigest", latestConfigSet.ConfigDigest, + ) return uint64(latest.BlockNumber), latestConfigSet.ConfigDigest, nil } @@ -160,12 +166,22 @@ func (cp *configPoller) LatestConfig(ctx context.Context, changedInBlock uint64) if err != nil { return ocrtypes.ContractConfig{}, err } - cp.lggr.Infow("LatestConfig", "latestConfig", latestConfigSet) + configJSON, err := json.Marshal(latestConfigSet) + if err != nil { + return ocrtypes.ContractConfig{}, err + } + cp.lggr.Infow("ConfigPoller: LatestConfig", + "latestConfig", string(configJSON), + ) return latestConfigSet, nil } // LatestBlockHeight returns the latest block height from the logs func (cp *configPoller) LatestBlockHeight(ctx context.Context) (blockHeight uint64, err error) { + deadline, _ := ctx.Deadline() + // Expect the deadline to be 10 or 20s + // If lower, something is interfering + cp.lggr.Debugf("LatestBlockHeight called: deadline == %s; now == %s", deadline, time.Now()) latest, err := cp.destChainLogPoller.LatestBlock(ctx) if err != nil { if errors.Is(err, sql.ErrNoRows) { @@ -173,6 +189,9 @@ func (cp *configPoller) LatestBlockHeight(ctx context.Context) (blockHeight uint } return 0, err } + cp.lggr.Infow("ConfigPoller: LatestBlockHeight", + "uint64(latest.BlockNumber)", uint64(latest.BlockNumber), + ) return uint64(latest.BlockNumber), nil } diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 96979744131..8735341f735 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -141,28 +141,28 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser ethKeyBundle = ethKeyBundles[0] } - keyBundleBytes, err := json.Marshal(struct { - EVMKey string `json:"evm_key"` - PeerID string `json:"peer_id"` - PublicKey []byte `json:"public_key"` - OffchainPublicKey [32]byte `json:"offchain_public_key"` - ConfigEncryptionPublicKey [32]byte `json:"config_encryption_public_key"` - }{ - EVMKey: ethKeyBundle.String(), + oracleIdentity := generic.OracleIdentity{ + EVMKey: ethKeyBundle.Address.String(), PeerID: d.peerWrapper.Peer2.PeerID(), PublicKey: ocrKeyBundle.PublicKey(), OffchainPublicKey: ocrKeyBundle.OffchainPublicKey(), ConfigEncryptionPublicKey: ocrKeyBundle.ConfigEncryptionPublicKey(), - }) + } + + keyBundleBytes, err := json.Marshal(oracleIdentity) if err != nil { return nil, errors.Wrap(err, "failed to marshal key bundle") } log.Debug("string(keyBundleBytes): ", string(keyBundleBytes)) - spec.StandardCapabilitiesSpec.Config = spec.StandardCapabilitiesSpec.Config + string(keyBundleBytes) + // TODO: Overwriting for now as it is not stored in the DB, which loses it in translation + oracleFactoryConfig, err := generic.NewOracleFactoryConfig(spec.StandardCapabilitiesSpec.Config) + log.Debug("oracleFactoryConfig: ", oracleFactoryConfig) + + // TODO: Fix overwriting of oracle config + spec.StandardCapabilitiesSpec.Config = string(keyBundleBytes) log.Debug("Config: ", spec.StandardCapabilitiesSpec.Config) - oracleFactoryConfig, err := generic.NewOracleFactoryConfig(spec.StandardCapabilitiesSpec.OracleFactory) if err != nil { return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") } @@ -179,6 +179,8 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser Kb: ocrKeyBundle, Config: oracleFactoryConfig, PeerWrapper: d.peerWrapper, + RelayerSet: relayerSet, + Identity: oracleIdentity, }) if err != nil { return nil, fmt.Errorf("failed to create oracle factory: %w", err) @@ -236,11 +238,6 @@ func ValidatedStandardCapabilitiesSpec(tomlString string) (job.Job, error) { return jb, errors.Errorf("standard capabilities command must be set") } - _, err = generic.NewOracleFactoryConfig(jb.StandardCapabilitiesSpec.OracleFactory) - if err != nil { - return jb, errors.Wrap(err, "failed to unmarshal oracle factory config") - } - return jb, nil } From 0107ef3eab2e799f83a82a8eba123bc0a0dbede9 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Tue, 8 Oct 2024 15:26:07 +0300 Subject: [PATCH 14/30] Bump chainlink-common version --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index f1183df16ee..765c865b908 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.20.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index a5faa293479..528749285c9 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1083,8 +1083,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/go.mod b/go.mod index 40d93203dd0..6201934c640 100644 --- a/go.mod +++ b/go.mod @@ -75,7 +75,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f diff --git a/go.sum b/go.sum index 47cfa220fff..5c5266708d8 100644 --- a/go.sum +++ b/go.sum @@ -1044,8 +1044,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 21f57939f13..d8c5592cb02 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -40,7 +40,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index abf6771a43b..df71ad2c9b9 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1425,8 +1425,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 800691f871d..b1e7ccbac93 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -15,7 +15,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 569e2d1fe77..6940763fcf5 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1399,8 +1399,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef h1:tZ5R0SJcxGptU0E1DhiDxxVM7HJEamv86dK9T1CYN7I= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926094457-238a5afc96ef/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= From 4b6b4b8ace39c0383fb07e4db5de95c0e076d000 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Tue, 8 Oct 2024 16:31:56 +0300 Subject: [PATCH 15/30] Undo some changes --- core/services/ocr2/database.go | 9 +---- .../ocr2/plugins/generic/oraclefactory.go | 39 ++++++++++--------- core/services/relay/evm/config_poller.go | 20 ---------- 3 files changed, 22 insertions(+), 46 deletions(-) diff --git a/core/services/ocr2/database.go b/core/services/ocr2/database.go index cde573d2cb5..e5369864e0f 100644 --- a/core/services/ocr2/database.go +++ b/core/services/ocr2/database.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "encoding/binary" - "encoding/json" "time" "github.com/lib/pq" @@ -165,12 +164,6 @@ func (d *db) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { signers = append(signers, []byte(s)) } - cBytes, err := json.Marshal(c) - if err != nil { - return errors.Wrap(err, "WriteConfig failed to marshal config") - } - d.lggr.Debugw("WriteConfig", "ocrtypes.ContractConfig", string(cBytes)) - stmt := ` INSERT INTO ocr2_contract_configs ( ocr2_oracle_spec_id, @@ -198,7 +191,7 @@ func (d *db) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { offchain_config = EXCLUDED.offchain_config, updated_at = NOW() ` - _, err = d.ds.ExecContext(ctx, stmt, + _, err := d.ds.ExecContext(ctx, stmt, d.oracleSpecID, d.pluginID, c.ConfigDigest, diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index b0fef054ef0..9b2397936b8 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -25,13 +25,22 @@ type oracleFactoryConfig struct { Enabled bool TraceLogging bool BootstrapPeers []commontypes.BootstrapperLocator + ContractID string `json:"contractID"` + RelayConfig RelayConfig `json:"relayConfig"` +} + +type RelayConfig struct { + ChainID string `json:"chainID"` // e.g., "31337" + Network string `json:"networkID"` // e.g., "evm" } func NewOracleFactoryConfig(config string) (*oracleFactoryConfig, error) { var ofc struct { - Enabled bool `json:"enabled"` - TraceLogging bool `json:"traceLogging"` - BootstrapPeers []string `json:"bootstrapPeers"` + Enabled bool `json:"enabled"` + TraceLogging bool `json:"traceLogging"` + BootstrapPeers []string `json:"bootstrapPeers"` + ContractID string `json:"contractID"` + RelayConfig RelayConfig `json:"relayConfig"` } err := json.Unmarshal([]byte(config), &ofc) if err != nil { @@ -120,23 +129,19 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c return nil, errors.New("peer wrapper not started") } - of.lggr.Debug("oracleIdentity: ", of.identity) - relayer, err := of.relayerSet.Get(ctx, types.RelayID{Network: "evm", ChainID: "31337"}) if err != nil { return nil, fmt.Errorf("error when getting relayer: %w", err) } - type RelayConfig struct { + var relayConfig = struct { ChainID string `json:"chainID"` EffectiveTransmitterID string `json:"effectiveTransmitterID"` SendingKeys []string `json:"sendingKeys"` - } - - var relayConfig = RelayConfig{ - ChainID: "31337", - EffectiveTransmitterID: of.identity.EVMKey, - SendingKeys: []string{of.identity.EVMKey}, + }{ + ChainID: "31337", // TODO: Come from oracle factory config + EffectiveTransmitterID: of.identity.EVMKey, // TODO: This should be removed long-term. + SendingKeys: []string{of.identity.EVMKey}, // TODO: This should be removed long-term. } relayConfigBytes, err := json.Marshal(relayConfig) if err != nil { @@ -149,20 +154,18 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c RelayConfig: relayConfigBytes, }, core.PluginArgs{ TransmitterID: of.identity.EVMKey, - PluginConfig: JSONConfig{ - "pluginName": "kvstore-capability", - "OCRVersion": 3, - }.Bytes(), }) if err != nil { return nil, fmt.Errorf("error when getting offchain digester: %w", err) } oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ + // This will be re-written long-term to read from CapabilitiesRegistry + ContractConfigTracker: pluginProvider.ContractConfigTracker(), + // This will be re-written long-term to read from CapabilitiesRegistry + OffchainConfigDigester: pluginProvider.OffchainConfigDigester(), LocalConfig: args.LocalConfig, - ContractConfigTracker: pluginProvider.ContractConfigTracker(), ContractTransmitter: args.ContractTransmitter, - OffchainConfigDigester: pluginProvider.OffchainConfigDigester(), ReportingPluginFactory: args.ReportingPluginFactoryService, BinaryNetworkEndpointFactory: of.peerWrapper.Peer2, V2Bootstrappers: of.config.BootstrapPeers, diff --git a/core/services/relay/evm/config_poller.go b/core/services/relay/evm/config_poller.go index 135e5c12e31..dfa85a1a607 100644 --- a/core/services/relay/evm/config_poller.go +++ b/core/services/relay/evm/config_poller.go @@ -3,9 +3,7 @@ package evm import ( "context" "database/sql" - "encoding/json" "fmt" - "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -142,10 +140,6 @@ func (cp *configPoller) LatestConfigDetails(ctx context.Context) (changedInBlock if err != nil { return 0, ocrtypes.ConfigDigest{}, err } - cp.lggr.Infow("ConfigPoller: LatestConfigDetails", - "latest.BlockNumber", uint64(latest.BlockNumber), - "latestConfigSet.ConfigDigest", latestConfigSet.ConfigDigest, - ) return uint64(latest.BlockNumber), latestConfigSet.ConfigDigest, nil } @@ -166,22 +160,11 @@ func (cp *configPoller) LatestConfig(ctx context.Context, changedInBlock uint64) if err != nil { return ocrtypes.ContractConfig{}, err } - configJSON, err := json.Marshal(latestConfigSet) - if err != nil { - return ocrtypes.ContractConfig{}, err - } - cp.lggr.Infow("ConfigPoller: LatestConfig", - "latestConfig", string(configJSON), - ) return latestConfigSet, nil } // LatestBlockHeight returns the latest block height from the logs func (cp *configPoller) LatestBlockHeight(ctx context.Context) (blockHeight uint64, err error) { - deadline, _ := ctx.Deadline() - // Expect the deadline to be 10 or 20s - // If lower, something is interfering - cp.lggr.Debugf("LatestBlockHeight called: deadline == %s; now == %s", deadline, time.Now()) latest, err := cp.destChainLogPoller.LatestBlock(ctx) if err != nil { if errors.Is(err, sql.ErrNoRows) { @@ -189,9 +172,6 @@ func (cp *configPoller) LatestBlockHeight(ctx context.Context) (blockHeight uint } return 0, err } - cp.lggr.Infow("ConfigPoller: LatestBlockHeight", - "uint64(latest.BlockNumber)", uint64(latest.BlockNumber), - ) return uint64(latest.BlockNumber), nil } From dba261fc342979bc54894a364efc8add4112f236 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Tue, 8 Oct 2024 16:36:56 +0300 Subject: [PATCH 16/30] Add changeset + fix interface --- .changeset/chilled-months-bow.md | 5 +++++ plugins/cmd/capabilities/log-event-trigger/main.go | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/chilled-months-bow.md diff --git a/.changeset/chilled-months-bow.md b/.changeset/chilled-months-bow.md new file mode 100644 index 00000000000..8600cc76a39 --- /dev/null +++ b/.changeset/chilled-months-bow.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +Add oracle support to standard capabilities diff --git a/plugins/cmd/capabilities/log-event-trigger/main.go b/plugins/cmd/capabilities/log-event-trigger/main.go index 7cf66f9c847..d01485a743f 100644 --- a/plugins/cmd/capabilities/log-event-trigger/main.go +++ b/plugins/cmd/capabilities/log-event-trigger/main.go @@ -92,6 +92,7 @@ func (cs *LogEventTriggerGRPCService) Initialise( errorLog core.ErrorLog, pipelineRunner core.PipelineRunnerService, relayerSet core.RelayerSet, + oracleFactory core.OracleFactory, ) error { cs.s.Logger.Debugf("Initialising %s", serviceName) From c1ea4b571d1d80a711e2b69800955fd97dcd45a3 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Tue, 8 Oct 2024 16:42:17 +0300 Subject: [PATCH 17/30] Update changeset --- .changeset/chilled-months-bow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/chilled-months-bow.md b/.changeset/chilled-months-bow.md index 8600cc76a39..d3bbf7f97e3 100644 --- a/.changeset/chilled-months-bow.md +++ b/.changeset/chilled-months-bow.md @@ -2,4 +2,4 @@ "chainlink": minor --- -Add oracle support to standard capabilities +#added oracle support in standard capabilities From beff13f07ac6ddf1e72daef739d3f62281d0b3e5 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Tue, 8 Oct 2024 20:05:26 +0300 Subject: [PATCH 18/30] Use chainlink-common commit from main branch --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 8c9df959cb1..cc8d2dfc431 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.20.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index b2d399416c2..e1dc98371e5 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1099,8 +1099,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371 h1:d2IS24wRrsUXyDcW9avaRo7l+eLCbBbcyXJoBwELueU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/go.mod b/go.mod index 61f756d11b3..0b2bfb9b4e4 100644 --- a/go.mod +++ b/go.mod @@ -76,7 +76,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f diff --git a/go.sum b/go.sum index 32e3037d841..8316332e881 100644 --- a/go.sum +++ b/go.sum @@ -1060,8 +1060,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371 h1:d2IS24wRrsUXyDcW9avaRo7l+eLCbBbcyXJoBwELueU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 85271bc6ecb..48348092d09 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -40,7 +40,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index bfec70b0d50..748191cc493 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1439,8 +1439,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371 h1:d2IS24wRrsUXyDcW9avaRo7l+eLCbBbcyXJoBwELueU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 4b66dcfcb4b..dde97f795c2 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -15,7 +15,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 562be59ab82..3d1f2bd592a 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1415,8 +1415,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371 h1:d2IS24wRrsUXyDcW9avaRo7l+eLCbBbcyXJoBwELueU= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241003141241-00dcd7fa8371/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed h1:iAjpOW9lb9St3xG76dwf5n3qBxVU2cgJPSXBkGwtQCE= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008121811-eb37463e60ed/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= From cc9e97f6a50ee2ae324003398721c1024f94f0ea Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 10:48:55 +0300 Subject: [PATCH 19/30] Add oracle_factory config to SC spec --- core/services/job/models.go | 33 ++++++-- core/services/job/orm.go | 4 +- .../ocr2/plugins/generic/oraclefactory.go | 75 ++++--------------- .../services/standardcapabilities/delegate.go | 30 +++++--- .../standardcapabilities/delegate_test.go | 27 ++++--- .../0255_standard_capabilities_extension.sql | 9 +++ 6 files changed, 91 insertions(+), 87 deletions(-) create mode 100644 core/store/migrate/migrations/0255_standard_capabilities_extension.sql diff --git a/core/services/job/models.go b/core/services/job/models.go index 7a2f49eb49c..71f5cc0bcca 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -943,12 +943,35 @@ func (w *WorkflowSpec) RawSpec(ctx context.Context) ([]byte, error) { return rs, nil } +type OracleFactoryConfig struct { + Enabled bool `toml:"enabled"` + BootstrapPeers []string `toml:"bootstrap_peers"` // e.g.,["12D3KooWEBVwbfdhKnicois7FTYVsBFGFcoMhMCKXQC57BQyZMhz@localhost:6690"] + OCRContractAddress string `toml:"ocr_contract_address"` // e.g., 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 + ChainID string `toml:"chain_id"` // e.g., "31337" + Network string `toml:"network"` // e.g., "evm" +} + +// Value returns this instance serialized for database storage. +func (ofc OracleFactoryConfig) Value() (driver.Value, error) { + return json.Marshal(ofc) +} + +// Scan reads the database value and returns an instance. +func (ofc *OracleFactoryConfig) Scan(value interface{}) error { + b, ok := value.([]byte) + if !ok { + return errors.Errorf("expected bytes got %T", b) + } + return json.Unmarshal(b, &ofc) +} + type StandardCapabilitiesSpec struct { - ID int32 - CreatedAt time.Time `toml:"-"` - UpdatedAt time.Time `toml:"-"` - Command string `toml:"command"` - Config string `toml:"config"` + ID int32 + CreatedAt time.Time `toml:"-"` + UpdatedAt time.Time `toml:"-"` + Command string `toml:"command" db:"command"` + Config string `toml:"config" db:"config"` + OracleFactory OracleFactoryConfig `toml:"oracle_factory" db:"oracle_factory"` } func (w *StandardCapabilitiesSpec) GetID() string { diff --git a/core/services/job/orm.go b/core/services/job/orm.go index d02e0b29200..071ca37203e 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -418,8 +418,8 @@ func (o *orm) CreateJob(ctx context.Context, jb *Job) error { } jb.WorkflowSpecID = &specID case StandardCapabilities: - sql := `INSERT INTO standardcapabilities_specs (command, config, created_at, updated_at) - VALUES (:command, :config, NOW(), NOW()) + sql := `INSERT INTO standardcapabilities_specs (command, config, oracle_factory, created_at, updated_at) + VALUES (:command, :config, :oracle_factory, NOW(), NOW()) RETURNING id;` specID, err := tx.prepareQuerySpecID(ctx, sql, jb.StandardCapabilitiesSpec) if err != nil { diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 9b2397936b8..f7e440963f9 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -7,7 +7,6 @@ import ( "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/smartcontractkit/libocr/commontypes" ocr "github.com/smartcontractkit/libocr/offchainreporting2plus" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" @@ -21,53 +20,6 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/core" ) -type oracleFactoryConfig struct { - Enabled bool - TraceLogging bool - BootstrapPeers []commontypes.BootstrapperLocator - ContractID string `json:"contractID"` - RelayConfig RelayConfig `json:"relayConfig"` -} - -type RelayConfig struct { - ChainID string `json:"chainID"` // e.g., "31337" - Network string `json:"networkID"` // e.g., "evm" -} - -func NewOracleFactoryConfig(config string) (*oracleFactoryConfig, error) { - var ofc struct { - Enabled bool `json:"enabled"` - TraceLogging bool `json:"traceLogging"` - BootstrapPeers []string `json:"bootstrapPeers"` - ContractID string `json:"contractID"` - RelayConfig RelayConfig `json:"relayConfig"` - } - err := json.Unmarshal([]byte(config), &ofc) - if err != nil { - return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") - } - - if !ofc.Enabled { - return &oracleFactoryConfig{}, nil - } - - // If Oracle Factory is enabled, it must have at least one bootstrap peer - if len(ofc.BootstrapPeers) == 0 { - return nil, errors.New("no bootstrap peers found") - } - - bootstrapPeers, err := ocrcommon.ParseBootstrapPeers(ofc.BootstrapPeers) - if err != nil { - return nil, errors.Wrap(err, "failed to parse bootstrap peers") - } - - return &oracleFactoryConfig{ - Enabled: true, - TraceLogging: ofc.TraceLogging, - BootstrapPeers: bootstrapPeers, - }, nil -} - type OracleIdentity struct { EVMKey string `json:"evm_key"` PeerID string `json:"peer_id"` @@ -83,7 +35,7 @@ type oracleFactory struct { jobORM job.ORM kb ocr2key.KeyBundle lggr logger.Logger - config *oracleFactoryConfig + config job.OracleFactoryConfig peerWrapper *ocrcommon.SingletonPeerWrapper relayerSet *RelayerSet identity OracleIdentity @@ -95,7 +47,7 @@ type OracleFactoryParams struct { JobORM job.ORM Kb ocr2key.KeyBundle Logger logger.Logger - Config *oracleFactoryConfig + Config job.OracleFactoryConfig PeerWrapper *ocrcommon.SingletonPeerWrapper RelayerSet *RelayerSet Identity OracleIdentity @@ -129,7 +81,7 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c return nil, errors.New("peer wrapper not started") } - relayer, err := of.relayerSet.Get(ctx, types.RelayID{Network: "evm", ChainID: "31337"}) + relayer, err := of.relayerSet.Get(ctx, types.RelayID{Network: of.config.Network, ChainID: of.config.ChainID}) if err != nil { return nil, fmt.Errorf("error when getting relayer: %w", err) } @@ -139,9 +91,9 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c EffectiveTransmitterID string `json:"effectiveTransmitterID"` SendingKeys []string `json:"sendingKeys"` }{ - ChainID: "31337", // TODO: Come from oracle factory config - EffectiveTransmitterID: of.identity.EVMKey, // TODO: This should be removed long-term. - SendingKeys: []string{of.identity.EVMKey}, // TODO: This should be removed long-term. + ChainID: of.config.ChainID, + EffectiveTransmitterID: of.identity.EVMKey, + SendingKeys: []string{of.identity.EVMKey}, } relayConfigBytes, err := json.Marshal(relayConfig) if err != nil { @@ -149,7 +101,7 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c } pluginProvider, err := relayer.NewPluginProvider(ctx, core.RelayArgs{ - ContractID: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6", // TODO: Oracle Factory config + ContractID: of.config.OCRContractAddress, ProviderType: "plugin", RelayConfig: relayConfigBytes, }, core.PluginArgs{ @@ -159,18 +111,21 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c return nil, fmt.Errorf("error when getting offchain digester: %w", err) } + bootstrapPeers, err := ocrcommon.ParseBootstrapPeers(of.config.BootstrapPeers) + if err != nil { + return nil, errors.Wrap(err, "failed to parse bootstrap peers") + } + oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ - // This will be re-written long-term to read from CapabilitiesRegistry - ContractConfigTracker: pluginProvider.ContractConfigTracker(), - // This will be re-written long-term to read from CapabilitiesRegistry + ContractConfigTracker: pluginProvider.ContractConfigTracker(), OffchainConfigDigester: pluginProvider.OffchainConfigDigester(), LocalConfig: args.LocalConfig, ContractTransmitter: args.ContractTransmitter, ReportingPluginFactory: args.ReportingPluginFactoryService, BinaryNetworkEndpointFactory: of.peerWrapper.Peer2, - V2Bootstrappers: of.config.BootstrapPeers, + V2Bootstrappers: bootstrapPeers, Database: of.database, - Logger: ocrcommon.NewOCRWrapper(of.lggr, of.config.TraceLogging, func(ctx context.Context, msg string) { + Logger: ocrcommon.NewOCRWrapper(of.lggr, true, func(ctx context.Context, msg string) { logger.Sugared(of.lggr).ErrorIf(of.jobORM.RecordError(ctx, of.jobID, msg), "unable to record error") }), // TODO? diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 8d44cb46b49..1df06aa285a 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -159,19 +159,13 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser } log.Debug("string(keyBundleBytes): ", string(keyBundleBytes)) - // TODO: Overwriting for now as it is not stored in the DB, which loses it in translation - oracleFactoryConfig, err := generic.NewOracleFactoryConfig(spec.StandardCapabilitiesSpec.Config) - log.Debug("oracleFactoryConfig: ", oracleFactoryConfig) + log.Debug("oracleFactoryConfig: ", spec.StandardCapabilitiesSpec.OracleFactory) - // TODO: Fix overwriting of oracle config + // TODO: Fix overwriting of config spec.StandardCapabilitiesSpec.Config = string(keyBundleBytes) log.Debug("Config: ", spec.StandardCapabilitiesSpec.Config) - if err != nil { - return nil, errors.Wrap(err, "failed to unmarshal oracle factory config") - } - - if oracleFactoryConfig.Enabled && d.peerWrapper == nil { + if spec.StandardCapabilitiesSpec.OracleFactory.Enabled && d.peerWrapper == nil { return nil, errors.New("P2P stack required for Oracle Factory") } @@ -181,7 +175,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobID: spec.ID, JobName: spec.Name.ValueOrZero(), Kb: ocrKeyBundle, - Config: oracleFactoryConfig, + Config: spec.StandardCapabilitiesSpec.OracleFactory, PeerWrapper: d.peerWrapper, RelayerSet: relayerSet, Identity: oracleIdentity, @@ -272,6 +266,22 @@ func ValidatedStandardCapabilitiesSpec(tomlString string) (job.Job, error) { return jb, errors.Errorf("standard capabilities command must be set") } + // Skip validation if Oracle Factory is not enabled + if !jb.StandardCapabilitiesSpec.OracleFactory.Enabled { + return jb, nil + } + + // If Oracle Factory is enabled, it must have at least one bootstrap peer + if len(jb.StandardCapabilitiesSpec.OracleFactory.BootstrapPeers) == 0 { + return jb, errors.New("no bootstrap peers found") + } + + // Validate bootstrap peers + _, err = ocrcommon.ParseBootstrapPeers(jb.StandardCapabilitiesSpec.OracleFactory.BootstrapPeers) + if err != nil { + return jb, errors.Wrap(err, "failed to parse bootstrap peers") + } + return jb, nil } diff --git a/core/services/standardcapabilities/delegate_test.go b/core/services/standardcapabilities/delegate_test.go index 8c9ea1de097..27b6734f911 100644 --- a/core/services/standardcapabilities/delegate_test.go +++ b/core/services/standardcapabilities/delegate_test.go @@ -44,9 +44,9 @@ func Test_ValidatedStandardCapabilitiesSpec(t *testing.T) { type="standardcapabilities" command="path/to/binary" - [oracleFactory] + [oracle_factory] enabled=true - bootstrapPeers = [ + bootstrap_peers = [ "invalid_p2p_id@invalid_ip:1111" ] `, @@ -58,7 +58,7 @@ func Test_ValidatedStandardCapabilitiesSpec(t *testing.T) { type="standardcapabilities" command="path/to/binary" - [oracleFactory] + [oracle_factory] enabled=true `, expectedError: "no bootstrap peers found", @@ -76,21 +76,28 @@ func Test_ValidatedStandardCapabilitiesSpec(t *testing.T) { type="standardcapabilities" command="path/to/binary" - [oracleFactory] + [capabilities] + target = "enabled" + + [oracle_factory] enabled=true - traceLogging=true - bootstrapPeers = [ + bootstrap_peers = [ "12D3KooWEBVwbfdhKnicois7FTYVsBFGFcoMhMCKXQC57BQyZMhz@localhost:6690" ] + network="evm" + chain_id="31337" + ocr_contract_address="0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6" `, expectedSpec: &job.StandardCapabilitiesSpec{ Command: "path/to/binary", - OracleFactory: job.JSONConfig{ - "enabled": true, - "traceLogging": true, - "bootstrapPeers": []interface{}{ + OracleFactory: job.OracleFactoryConfig{ + Enabled: true, + BootstrapPeers: []string{ "12D3KooWEBVwbfdhKnicois7FTYVsBFGFcoMhMCKXQC57BQyZMhz@localhost:6690", }, + OCRContractAddress: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6", + ChainID: "31337", + Network: "evm", }, }, }, diff --git a/core/store/migrate/migrations/0255_standard_capabilities_extension.sql b/core/store/migrate/migrations/0255_standard_capabilities_extension.sql new file mode 100644 index 00000000000..d81b4864eb4 --- /dev/null +++ b/core/store/migrate/migrations/0255_standard_capabilities_extension.sql @@ -0,0 +1,9 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE standardcapabilities_specs +ADD COLUMN oracle_factory JSONB; +-- +goose StatementEnd +-- +goose Down +-- +goose StatementBegin +ALTER TABLE standardcapabilities_specs DROP COLUMN oracle_factory; +-- +goose StatementEnd From c254675585abbc998098ec26746a2daeaba4405d Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 10:50:10 +0300 Subject: [PATCH 20/30] Undo a change --- core/services/ocr2/database.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/services/ocr2/database.go b/core/services/ocr2/database.go index e5369864e0f..83ee3240a46 100644 --- a/core/services/ocr2/database.go +++ b/core/services/ocr2/database.go @@ -163,7 +163,6 @@ func (d *db) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { for _, s := range c.Signers { signers = append(signers, []byte(s)) } - stmt := ` INSERT INTO ocr2_contract_configs ( ocr2_oracle_spec_id, From 01020f3c4e46fbbfa0910cb94c6f9699a14b9120 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 11:31:36 +0300 Subject: [PATCH 21/30] Things work as is. Checkpoint. --- .../ocr2/plugins/generic/oraclefactory.go | 2 +- ...racle_factory_db.go => oraclefactorydb.go} | 63 +++++++++---------- 2 files changed, 32 insertions(+), 33 deletions(-) rename core/services/ocr2/plugins/generic/{oracle_factory_db.go => oraclefactorydb.go} (51%) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index f7e440963f9..74273ccf5f4 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -55,7 +55,7 @@ type OracleFactoryParams struct { func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { return &oracleFactory{ - database: NewMemoryDB(params.JobID, params.Logger), + database: OracleFactoryDB(params.JobID, params.Logger), jobID: params.JobID, jobName: params.JobName, jobORM: params.JobORM, diff --git a/core/services/ocr2/plugins/generic/oracle_factory_db.go b/core/services/ocr2/plugins/generic/oraclefactorydb.go similarity index 51% rename from core/services/ocr2/plugins/generic/oracle_factory_db.go rename to core/services/ocr2/plugins/generic/oraclefactorydb.go index 26d9ba483da..239581a35d5 100644 --- a/core/services/ocr2/plugins/generic/oracle_factory_db.go +++ b/core/services/ocr2/plugins/generic/oraclefactorydb.go @@ -11,7 +11,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" ) -type memoryDb struct { +type oracleFactoryDb struct { // The ID is used for logging and error messages // A single standard capabilities spec can instantiate multiple oracles // TODO: NewOracle should take a unique identifier for the oracle @@ -24,12 +24,12 @@ type memoryDb struct { } var ( - _ ocrtypes.Database = &memoryDb{} + _ ocrtypes.Database = &oracleFactoryDb{} ) // NewDB returns a new DB scoped to this instanceID -func NewMemoryDB(specID int32, lggr logger.Logger) *memoryDb { - return &memoryDb{ +func OracleFactoryDB(specID int32, lggr logger.Logger) *oracleFactoryDb { + return &oracleFactoryDb{ specID: specID, lggr: logger.Sugared(lggr.Named("OracleFactoryMemoryDb")), states: make(map[ocrtypes.ConfigDigest]*ocrtypes.PersistentState), @@ -38,49 +38,49 @@ func NewMemoryDB(specID int32, lggr logger.Logger) *memoryDb { } } -func (md *memoryDb) ReadState(ctx context.Context, cd ocrtypes.ConfigDigest) (ps *ocrtypes.PersistentState, err error) { - ps, ok := md.states[cd] +func (ofdb *oracleFactoryDb) ReadState(ctx context.Context, cd ocrtypes.ConfigDigest) (ps *ocrtypes.PersistentState, err error) { + ps, ok := ofdb.states[cd] if !ok { - return nil, errors.Errorf("state not found for standard capabilities spec ID %d, config digest %s", md.specID, cd) + return nil, errors.Errorf("state not found for standard capabilities spec ID %d, config digest %s", ofdb.specID, cd) } return ps, nil } -func (md *memoryDb) WriteState(ctx context.Context, cd ocrtypes.ConfigDigest, state ocrtypes.PersistentState) error { - md.states[cd] = &state +func (ofdb *oracleFactoryDb) WriteState(ctx context.Context, cd ocrtypes.ConfigDigest, state ocrtypes.PersistentState) error { + ofdb.states[cd] = &state return nil } -func (md *memoryDb) ReadConfig(ctx context.Context) (c *ocrtypes.ContractConfig, err error) { - if md.config == nil { +func (ofdb *oracleFactoryDb) ReadConfig(ctx context.Context) (c *ocrtypes.ContractConfig, err error) { + if ofdb.config == nil { // Returning nil, nil because this is a cache miss return nil, nil } - return md.config, nil + return ofdb.config, nil } -func (md *memoryDb) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { - md.config = &c +func (ofdb *oracleFactoryDb) WriteConfig(ctx context.Context, c ocrtypes.ContractConfig) error { + ofdb.config = &c cBytes, err := json.Marshal(c) if err != nil { return errors.Wrap(err, "MemoryDB: WriteConfig failed to marshal config") } - md.lggr.Debugw("MemoryDB: WriteConfig", "ocrtypes.ContractConfig", string(cBytes)) + ofdb.lggr.Debugw("MemoryDB: WriteConfig", "ocrtypes.ContractConfig", string(cBytes)) return nil } -func (md *memoryDb) StorePendingTransmission(ctx context.Context, t ocrtypes.ReportTimestamp, tx ocrtypes.PendingTransmission) error { - md.pendingTransmissions[t] = tx +func (ofdb *oracleFactoryDb) StorePendingTransmission(ctx context.Context, t ocrtypes.ReportTimestamp, tx ocrtypes.PendingTransmission) error { + ofdb.pendingTransmissions[t] = tx return nil } -func (md *memoryDb) PendingTransmissionsWithConfigDigest(ctx context.Context, cd ocrtypes.ConfigDigest) (map[ocrtypes.ReportTimestamp]ocrtypes.PendingTransmission, error) { +func (ofdb *oracleFactoryDb) PendingTransmissionsWithConfigDigest(ctx context.Context, cd ocrtypes.ConfigDigest) (map[ocrtypes.ReportTimestamp]ocrtypes.PendingTransmission, error) { m := make(map[ocrtypes.ReportTimestamp]ocrtypes.PendingTransmission) - for k, v := range md.pendingTransmissions { + for k, v := range ofdb.pendingTransmissions { if k.ConfigDigest == cd { m[k] = v } @@ -89,48 +89,47 @@ func (md *memoryDb) PendingTransmissionsWithConfigDigest(ctx context.Context, cd return m, nil } -func (md *memoryDb) DeletePendingTransmission(ctx context.Context, t ocrtypes.ReportTimestamp) error { - delete(md.pendingTransmissions, t) +func (ofdb *oracleFactoryDb) DeletePendingTransmission(ctx context.Context, t ocrtypes.ReportTimestamp) error { + delete(ofdb.pendingTransmissions, t) return nil } -func (md *memoryDb) DeletePendingTransmissionsOlderThan(ctx context.Context, t time.Time) error { - for k, v := range md.pendingTransmissions { +func (ofdb *oracleFactoryDb) DeletePendingTransmissionsOlderThan(ctx context.Context, t time.Time) error { + for k, v := range ofdb.pendingTransmissions { if v.Time.Before(t) { - delete(md.pendingTransmissions, k) + delete(ofdb.pendingTransmissions, k) } } return nil } -func (md *memoryDb) ReadProtocolState( +func (ofdb *oracleFactoryDb) ReadProtocolState( ctx context.Context, configDigest ocrtypes.ConfigDigest, key string, ) ([]byte, error) { - value, ok := md.protocolStates[configDigest][key] + value, ok := ofdb.protocolStates[configDigest][key] if !ok { // Previously implementation returned nil if the state is not found - // TODO: Should this return nil, nil? return nil, nil } return value, nil } -func (md *memoryDb) WriteProtocolState( +func (ofdb *oracleFactoryDb) WriteProtocolState( ctx context.Context, configDigest ocrtypes.ConfigDigest, key string, value []byte, ) error { if value == nil { - delete(md.protocolStates[configDigest], key) + delete(ofdb.protocolStates[configDigest], key) } else { - if md.protocolStates[configDigest] == nil { - md.protocolStates[configDigest] = make(map[string][]byte) + if ofdb.protocolStates[configDigest] == nil { + ofdb.protocolStates[configDigest] = make(map[string][]byte) } - md.protocolStates[configDigest][key] = value + ofdb.protocolStates[configDigest][key] = value } return nil } From 1385f654f1275eb574699dcd4ff5aaf4e7a65e34 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 11:52:10 +0300 Subject: [PATCH 22/30] Update comments. Remove redundant log. --- core/services/standardcapabilities/delegate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 1df06aa285a..a2e3d94ff21 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -157,11 +157,11 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser if err != nil { return nil, errors.Wrap(err, "failed to marshal key bundle") } - log.Debug("string(keyBundleBytes): ", string(keyBundleBytes)) log.Debug("oracleFactoryConfig: ", spec.StandardCapabilitiesSpec.OracleFactory) - // TODO: Fix overwriting of config + // TODO: Fix overwriting of config. + // Correct fix is to remove the requirement to have an oracle identity. spec.StandardCapabilitiesSpec.Config = string(keyBundleBytes) log.Debug("Config: ", spec.StandardCapabilitiesSpec.Config) From 7374174178cf00acbc06bdffa50a330725bd360f Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 11:58:31 +0300 Subject: [PATCH 23/30] Remove redundant test and bring back log line --- .../plugins/generic/oraclefactory_test.go | 63 ------------------- core/services/relay/evm/config_poller.go | 1 + 2 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 core/services/ocr2/plugins/generic/oraclefactory_test.go diff --git a/core/services/ocr2/plugins/generic/oraclefactory_test.go b/core/services/ocr2/plugins/generic/oraclefactory_test.go deleted file mode 100644 index 9f47bed8a13..00000000000 --- a/core/services/ocr2/plugins/generic/oraclefactory_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package generic - -import ( - "testing" - - "github.com/pkg/errors" - "github.com/smartcontractkit/libocr/commontypes" - "github.com/stretchr/testify/assert" -) - -func TestNewOracleFactoryConfig(t *testing.T) { - tests := []struct { - name string - config string - expectedError error - expected *oracleFactoryConfig - }{ - { - name: "valid config", - config: `{"enabled": true, "traceLogging": true, "bootstrapPeers": [ "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh@localhost:8001" ]}`, - expected: &oracleFactoryConfig{ - Enabled: true, - TraceLogging: true, - BootstrapPeers: []commontypes.BootstrapperLocator{ - { - PeerID: "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh", - Addrs: []string{"localhost:8001"}, - }, - }, - }, - }, - { - name: "invalid JSON", - config: `{"enabled": true, "traceLogging": true, "bootstrapPeers": [ "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh@localhost:8001" `, - expectedError: errors.New("failed to unmarshal oracle factory config"), - }, - { - name: "disabled config", - config: `{"enabled": false, "traceLogging": true, "bootstrapPeers": [ "12D3KooWDSxjWrKDscvUx7xEebZ6Dez1W1nfcS2jjCRuFVoujpMh@localhost:8001" ]}`, - expected: &oracleFactoryConfig{ - Enabled: false, - }, - }, - { - name: "enabled with no bootstrap peers", - config: `{"enabled": true, "traceLogging": true, "bootstrapPeers": []}`, - expectedError: errors.New("no bootstrap peers found"), - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - config, err := NewOracleFactoryConfig(tt.config) - if tt.expectedError != nil { - assert.Error(t, err) - assert.Contains(t, err.Error(), tt.expectedError.Error()) - } else { - assert.NoError(t, err) - assert.Equal(t, tt.expected, config) - } - }) - } -} diff --git a/core/services/relay/evm/config_poller.go b/core/services/relay/evm/config_poller.go index dfa85a1a607..a00b04b0786 100644 --- a/core/services/relay/evm/config_poller.go +++ b/core/services/relay/evm/config_poller.go @@ -160,6 +160,7 @@ func (cp *configPoller) LatestConfig(ctx context.Context, changedInBlock uint64) if err != nil { return ocrtypes.ContractConfig{}, err } + cp.lggr.Infow("LatestConfig", "latestConfig", latestConfigSet) return latestConfigSet, nil } From c38024f23c796dce83837d8d87c7889542033cf1 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 12:20:35 +0300 Subject: [PATCH 24/30] Remove redundant JSONConfig --- core/services/ocr2/plugins/generic/oraclefactory.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 74273ccf5f4..9800baa326d 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -68,14 +68,6 @@ func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { }, nil } -type JSONConfig map[string]interface{} - -// Bytes returns the raw bytes -func (r JSONConfig) Bytes() []byte { - b, _ := json.Marshal(r) - return b -} - func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (core.Oracle, error) { if !of.peerWrapper.IsStarted() { return nil, errors.New("peer wrapper not started") From 880a3168d6e63d57d70728721033ce3c84d58288 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 13:35:18 +0300 Subject: [PATCH 25/30] Implement oracle factory transmitter --- .../ocr2/plugins/generic/oraclefactory.go | 76 +++++++++---------- .../generic/oraclefactorytransmitter.go | 36 +++++++++ .../services/standardcapabilities/delegate.go | 37 +++------ 3 files changed, 80 insertions(+), 69 deletions(-) create mode 100644 core/services/ocr2/plugins/generic/oraclefactorytransmitter.go diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 9800baa326d..f48f222084e 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -20,51 +20,43 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/core" ) -type OracleIdentity struct { - EVMKey string `json:"evm_key"` - PeerID string `json:"peer_id"` - PublicKey []byte `json:"public_key"` - OffchainPublicKey [32]byte `json:"offchain_public_key"` - ConfigEncryptionPublicKey [32]byte `json:"config_encryption_public_key"` -} - type oracleFactory struct { - database ocr3types.Database - jobID int32 - jobName string - jobORM job.ORM - kb ocr2key.KeyBundle - lggr logger.Logger - config job.OracleFactoryConfig - peerWrapper *ocrcommon.SingletonPeerWrapper - relayerSet *RelayerSet - identity OracleIdentity + database ocr3types.Database + jobID int32 + jobName string + jobORM job.ORM + kb ocr2key.KeyBundle + lggr logger.Logger + config job.OracleFactoryConfig + peerWrapper *ocrcommon.SingletonPeerWrapper + relayerSet *RelayerSet + transmitterID string } type OracleFactoryParams struct { - JobID int32 - JobName string - JobORM job.ORM - Kb ocr2key.KeyBundle - Logger logger.Logger - Config job.OracleFactoryConfig - PeerWrapper *ocrcommon.SingletonPeerWrapper - RelayerSet *RelayerSet - Identity OracleIdentity + JobID int32 + JobName string + JobORM job.ORM + Kb ocr2key.KeyBundle + Logger logger.Logger + Config job.OracleFactoryConfig + PeerWrapper *ocrcommon.SingletonPeerWrapper + RelayerSet *RelayerSet + TransmitterID string } func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { return &oracleFactory{ - database: OracleFactoryDB(params.JobID, params.Logger), - jobID: params.JobID, - jobName: params.JobName, - jobORM: params.JobORM, - kb: params.Kb, - lggr: params.Logger, - config: params.Config, - peerWrapper: params.PeerWrapper, - relayerSet: params.RelayerSet, - identity: params.Identity, + database: OracleFactoryDB(params.JobID, params.Logger), + jobID: params.JobID, + jobName: params.JobName, + jobORM: params.JobORM, + kb: params.Kb, + lggr: params.Logger, + config: params.Config, + peerWrapper: params.PeerWrapper, + relayerSet: params.RelayerSet, + transmitterID: params.TransmitterID, }, nil } @@ -84,8 +76,8 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c SendingKeys []string `json:"sendingKeys"` }{ ChainID: of.config.ChainID, - EffectiveTransmitterID: of.identity.EVMKey, - SendingKeys: []string{of.identity.EVMKey}, + EffectiveTransmitterID: of.transmitterID, + SendingKeys: []string{of.transmitterID}, } relayConfigBytes, err := json.Marshal(relayConfig) if err != nil { @@ -97,7 +89,7 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c ProviderType: "plugin", RelayConfig: relayConfigBytes, }, core.PluginArgs{ - TransmitterID: of.identity.EVMKey, + TransmitterID: of.transmitterID, }) if err != nil { return nil, fmt.Errorf("error when getting offchain digester: %w", err) @@ -109,10 +101,12 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c } oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ + // We are relying on the relayer plugin provider for the offchain config digester + // and the contract config tracker to save time. ContractConfigTracker: pluginProvider.ContractConfigTracker(), OffchainConfigDigester: pluginProvider.OffchainConfigDigester(), LocalConfig: args.LocalConfig, - ContractTransmitter: args.ContractTransmitter, + ContractTransmitter: NewContractTransmitter(of.transmitterID, args.ContractTransmitter), ReportingPluginFactory: args.ReportingPluginFactoryService, BinaryNetworkEndpointFactory: of.peerWrapper.Peer2, V2Bootstrappers: bootstrapPeers, diff --git a/core/services/ocr2/plugins/generic/oraclefactorytransmitter.go b/core/services/ocr2/plugins/generic/oraclefactorytransmitter.go new file mode 100644 index 00000000000..41a2c3fa1c4 --- /dev/null +++ b/core/services/ocr2/plugins/generic/oraclefactorytransmitter.go @@ -0,0 +1,36 @@ +package generic + +import ( + "context" + + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" +) + +var _ ocr3types.ContractTransmitter[[]byte] = (*contractTransmitter)(nil) + +type contractTransmitter struct { + impl ocr3types.ContractTransmitter[[]byte] + transmitterID string +} + +func NewContractTransmitter(transmitterID string, impl ocr3types.ContractTransmitter[[]byte]) *contractTransmitter { + return &contractTransmitter{ + impl: impl, + transmitterID: transmitterID, + } +} + +func (ct *contractTransmitter) Transmit( + ctx context.Context, + configDigest types.ConfigDigest, + seqNr uint64, + reportWithInfo ocr3types.ReportWithInfo[[]byte], + attributedOnchainSignature []types.AttributedOnchainSignature, +) error { + return ct.impl.Transmit(ctx, configDigest, seqNr, reportWithInfo, attributedOnchainSignature) +} + +func (ct *contractTransmitter) FromAccount() (types.Account, error) { + return types.Account(ct.transmitterID), nil +} diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index a2e3d94ff21..438dbb06733 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -2,7 +2,6 @@ package standardcapabilities import ( "context" - "encoding/json" "fmt" "github.com/google/uuid" @@ -145,40 +144,22 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser ethKeyBundle = ethKeyBundles[0] } - oracleIdentity := generic.OracleIdentity{ - EVMKey: ethKeyBundle.Address.String(), - PeerID: d.peerWrapper.Peer2.PeerID(), - PublicKey: ocrKeyBundle.PublicKey(), - OffchainPublicKey: ocrKeyBundle.OffchainPublicKey(), - ConfigEncryptionPublicKey: ocrKeyBundle.ConfigEncryptionPublicKey(), - } - - keyBundleBytes, err := json.Marshal(oracleIdentity) - if err != nil { - return nil, errors.Wrap(err, "failed to marshal key bundle") - } - log.Debug("oracleFactoryConfig: ", spec.StandardCapabilitiesSpec.OracleFactory) - // TODO: Fix overwriting of config. - // Correct fix is to remove the requirement to have an oracle identity. - spec.StandardCapabilitiesSpec.Config = string(keyBundleBytes) - log.Debug("Config: ", spec.StandardCapabilitiesSpec.Config) - if spec.StandardCapabilitiesSpec.OracleFactory.Enabled && d.peerWrapper == nil { return nil, errors.New("P2P stack required for Oracle Factory") } oracleFactory, err := generic.NewOracleFactory(generic.OracleFactoryParams{ - Logger: log, - JobORM: d.jobORM, - JobID: spec.ID, - JobName: spec.Name.ValueOrZero(), - Kb: ocrKeyBundle, - Config: spec.StandardCapabilitiesSpec.OracleFactory, - PeerWrapper: d.peerWrapper, - RelayerSet: relayerSet, - Identity: oracleIdentity, + Logger: log, + JobORM: d.jobORM, + JobID: spec.ID, + JobName: spec.Name.ValueOrZero(), + Kb: ocrKeyBundle, + Config: spec.StandardCapabilitiesSpec.OracleFactory, + PeerWrapper: d.peerWrapper, + RelayerSet: relayerSet, + TransmitterID: ethKeyBundle.Address.String(), }) if err != nil { return nil, fmt.Errorf("failed to create oracle factory: %w", err) From fbe81aba546d1cb917d2fa7ff883101d771933de Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 16:41:23 +0300 Subject: [PATCH 26/30] Stop using pkg/errors --- core/services/ocr2/plugins/generic/oraclefactory.go | 5 ++--- core/services/ocr2/plugins/generic/oraclefactorydb.go | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index f48f222084e..69ad42f4c12 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -3,9 +3,9 @@ package generic import ( "context" "encoding/json" + "errors" "fmt" - "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" ocr "github.com/smartcontractkit/libocr/offchainreporting2plus" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" @@ -97,7 +97,7 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c bootstrapPeers, err := ocrcommon.ParseBootstrapPeers(of.config.BootstrapPeers) if err != nil { - return nil, errors.Wrap(err, "failed to parse bootstrap peers") + return nil, fmt.Errorf("failed to parse bootstrap peers: %s", err) } oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ @@ -114,7 +114,6 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c Logger: ocrcommon.NewOCRWrapper(of.lggr, true, func(ctx context.Context, msg string) { logger.Sugared(of.lggr).ErrorIf(of.jobORM.RecordError(ctx, of.jobID, msg), "unable to record error") }), - // TODO? MonitoringEndpoint: &telemetry.NoopAgent{}, OffchainKeyring: of.kb, OnchainKeyring: ocrcommon.NewOCR3OnchainKeyringAdapter(of.kb), diff --git a/core/services/ocr2/plugins/generic/oraclefactorydb.go b/core/services/ocr2/plugins/generic/oraclefactorydb.go index 239581a35d5..cb0e9c743ec 100644 --- a/core/services/ocr2/plugins/generic/oraclefactorydb.go +++ b/core/services/ocr2/plugins/generic/oraclefactorydb.go @@ -3,9 +3,9 @@ package generic import ( "context" "encoding/json" + "fmt" "time" - "github.com/pkg/errors" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -41,7 +41,7 @@ func OracleFactoryDB(specID int32, lggr logger.Logger) *oracleFactoryDb { func (ofdb *oracleFactoryDb) ReadState(ctx context.Context, cd ocrtypes.ConfigDigest) (ps *ocrtypes.PersistentState, err error) { ps, ok := ofdb.states[cd] if !ok { - return nil, errors.Errorf("state not found for standard capabilities spec ID %d, config digest %s", ofdb.specID, cd) + return nil, fmt.Errorf("state not found for standard capabilities spec ID %d, config digest %s", ofdb.specID, cd) } return ps, nil @@ -65,7 +65,7 @@ func (ofdb *oracleFactoryDb) WriteConfig(ctx context.Context, c ocrtypes.Contrac cBytes, err := json.Marshal(c) if err != nil { - return errors.Wrap(err, "MemoryDB: WriteConfig failed to marshal config") + return fmt.Errorf("MemoryDB: WriteConfig failed to marshal config: %v", err) } ofdb.lggr.Debugw("MemoryDB: WriteConfig", "ocrtypes.ContractConfig", string(cBytes)) From faf4a2d89274926f28de99a7edec4f52722a4148 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 16:42:09 +0300 Subject: [PATCH 27/30] Naming convention --- core/services/ocr2/plugins/generic/oraclefactory.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 69ad42f4c12..050710551fd 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -37,7 +37,7 @@ type OracleFactoryParams struct { JobID int32 JobName string JobORM job.ORM - Kb ocr2key.KeyBundle + KB ocr2key.KeyBundle Logger logger.Logger Config job.OracleFactoryConfig PeerWrapper *ocrcommon.SingletonPeerWrapper @@ -51,7 +51,7 @@ func NewOracleFactory(params OracleFactoryParams) (core.OracleFactory, error) { jobID: params.JobID, jobName: params.JobName, jobORM: params.JobORM, - kb: params.Kb, + kb: params.KB, lggr: params.Logger, config: params.Config, peerWrapper: params.PeerWrapper, From 128664b994a6871e48405021ef09a450ee6556f1 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 16:47:44 +0300 Subject: [PATCH 28/30] Woops --- core/services/standardcapabilities/delegate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 438dbb06733..7c370d4f8de 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -155,7 +155,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobORM: d.jobORM, JobID: spec.ID, JobName: spec.Name.ValueOrZero(), - Kb: ocrKeyBundle, + KB: ocrKeyBundle, Config: spec.StandardCapabilitiesSpec.OracleFactory, PeerWrapper: d.peerWrapper, RelayerSet: relayerSet, From dd006ad92ea69f34aaac5c38273327129577c197 Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 17:03:23 +0300 Subject: [PATCH 29/30] Fix lint errors --- core/services/ocr2/plugins/generic/oraclefactory.go | 2 +- core/services/ocr2/plugins/generic/oraclefactorydb.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/ocr2/plugins/generic/oraclefactory.go b/core/services/ocr2/plugins/generic/oraclefactory.go index 050710551fd..7d44a239d2e 100644 --- a/core/services/ocr2/plugins/generic/oraclefactory.go +++ b/core/services/ocr2/plugins/generic/oraclefactory.go @@ -97,7 +97,7 @@ func (of *oracleFactory) NewOracle(ctx context.Context, args core.OracleArgs) (c bootstrapPeers, err := ocrcommon.ParseBootstrapPeers(of.config.BootstrapPeers) if err != nil { - return nil, fmt.Errorf("failed to parse bootstrap peers: %s", err) + return nil, fmt.Errorf("failed to parse bootstrap peers: %w", err) } oracle, err := ocr.NewOracle(ocr.OCR3OracleArgs[[]byte]{ diff --git a/core/services/ocr2/plugins/generic/oraclefactorydb.go b/core/services/ocr2/plugins/generic/oraclefactorydb.go index cb0e9c743ec..5db6f8a2ffe 100644 --- a/core/services/ocr2/plugins/generic/oraclefactorydb.go +++ b/core/services/ocr2/plugins/generic/oraclefactorydb.go @@ -65,7 +65,7 @@ func (ofdb *oracleFactoryDb) WriteConfig(ctx context.Context, c ocrtypes.Contrac cBytes, err := json.Marshal(c) if err != nil { - return fmt.Errorf("MemoryDB: WriteConfig failed to marshal config: %v", err) + return fmt.Errorf("MemoryDB: WriteConfig failed to marshal config: %w", err) } ofdb.lggr.Debugw("MemoryDB: WriteConfig", "ocrtypes.ContractConfig", string(cBytes)) From 81a6a5a715285be666137173bbc34c03b3cdae5d Mon Sep 17 00:00:00 2001 From: DeividasK Date: Wed, 9 Oct 2024 17:44:25 +0300 Subject: [PATCH 30/30] Tidy --- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.sum | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 684155bba51..edb7d16b965 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1099,8 +1099,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb h1:bYT7j5syymCtAKv/gGG7CLp4APe/VDWkig9Ph7mc8fQ= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd h1:DraA9kRpkyI02OEx7QDbSq3bCYxVFZ78TdOP2rUvHts= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/go.mod b/go.mod index 93696685c60..a2c9b1b211f 100644 --- a/go.mod +++ b/go.mod @@ -76,7 +76,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb - github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f diff --git a/go.sum b/go.sum index 2e4a7775a60..8fad9ec97ad 100644 --- a/go.sum +++ b/go.sum @@ -1060,8 +1060,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb h1:bYT7j5syymCtAKv/gGG7CLp4APe/VDWkig9Ph7mc8fQ= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd h1:DraA9kRpkyI02OEx7QDbSq3bCYxVFZ78TdOP2rUvHts= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index d3ad17f908c..34cf2df9cbb 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -40,7 +40,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb - github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd + github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 90c7f08b0f9..bd416855c59 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1439,8 +1439,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb h1:bYT7j5syymCtAKv/gGG7CLp4APe/VDWkig9Ph7mc8fQ= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd h1:DraA9kRpkyI02OEx7QDbSq3bCYxVFZ78TdOP2rUvHts= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 8bdc23dc35f..b921352eeb5 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1415,8 +1415,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb h1:bYT7j5syymCtAKv/gGG7CLp4APe/VDWkig9Ph7mc8fQ= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241009125450-4290917273fb/go.mod h1:WbtjuYMnDAYojL3CSWmruc1ecSBgSTggzXJ6F1U6bxw= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd h1:DraA9kRpkyI02OEx7QDbSq3bCYxVFZ78TdOP2rUvHts= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20241001210038-dd59341432bd/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d h1:GpGKzVtDWSb8cesHSvm+LQpCJpFdfVPk3us5wAY6ixI= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20241008170407-8bfcea33a98d/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q=