Skip to content

Commit

Permalink
[CCIP-Merge] OCR2 plugins [CCIP-2942] (#14043)
Browse files Browse the repository at this point in the history
* Copy over core/services/ocr2/plugins/ccip from ccip repo (#14024)

This is first part in merging offchain code from ccip repo (https://github.com/smartcontractkit/ccip) into chainlink

Maintaining history across repos for specific direcotires was complicated so we chose to copy the directory right away.

-----------------

Co-authored-by: Abdelrahman Soliman (Boda) <2677789+asoliman92@users.noreply.github.com>
Co-authored-by: Agustina Aldasoro <agusaldasoro@users.noreply.github.com>
Co-authored-by: Amir Y <83904651+amirylm@users.noreply.github.com>
Co-authored-by: André Vitor de Lima Matos <andre.matos@smartcontract.com>
Co-authored-by: AnieeG <anindita.ghosh@smartcontract.com>
Co-authored-by: Anindita Ghosh <88458927+AnieeG@users.noreply.github.com>
Co-authored-by: Chunkai Yang <matYang@users.noreply.github.com>
Co-authored-by: Connor Stein <connor.stein@mail.mcgill.ca>
Co-authored-by: Evaldas Latoškinas <34982762+elatoskinas@users.noreply.github.com>
Co-authored-by: Jean Arnaud <jarnaud@users.noreply.github.com>
Co-authored-by: Justin Kaseman <justinkaseman@live.com>
Co-authored-by: Makram <makramkd@users.noreply.github.com>
Co-authored-by: Makram Kamaleddine <makramkd@users.noreply.github.com>
Co-authored-by: Mateusz Sekara <mateusz.sekara@gmail.com>
Co-authored-by: Matt Yang <matt.yang@smartcontract.com>
Co-authored-by: Patrick <patrick.huie@smartcontract.com>
Co-authored-by: Rens Rooimans <github@rensrooimans.nl>
Co-authored-by: Roman Kashitsyn <roman.kashitsyn@gmail.com>
Co-authored-by: Roman Kashitsyn <roman.kashitsyn@smartcontract.com>
Co-authored-by: Ryan Stout <ryan.stout@smartcontract.com>
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Co-authored-by: connorwstein <connor.stein@mail.mcgill.ca>
Co-authored-by: dimitris <dimitrios.kouveris@smartcontract.com>
Co-authored-by: dimkouv <dimitrios.kouveris@smartcontract.com>
Co-authored-by: nogo <0xnogo@gmail.com>
Co-authored-by: nogo <110664798+0xnogo@users.noreply.github.com>
Co-authored-by: valerii-kabisov-cll <172247313+valerii-kabisov-cll@users.noreply.github.com>

* [CCIP-2942] OCR2 plugins merge fixes [CCIP-2942] (#14026)

* Add status checker

original commit:
smartcontractkit/ccip@451984a

* Add CCIP to types.go

* Add Unsafe_SetConnectionsManager to feeds service for testing

* Add CCIP feature to core.toml

* Rebuilding config

* Wiring up relayer and ocr2 delegates - this commit touches shared code !

* Adding mockery configuration for ccip specific code

* Setting CCIP feature flag to true - it's no longer used anywhere

---------

Co-authored-by: Mateusz Sekara <mateusz.sekara@gmail.com>

* VRF-1138: Make CTF tests to reuse existing VRF Wrapper (#13854)

* VRF-1138: Make CTF tests to reuse existing VRF Wrapper

* VRF-1138: remove old code

* VRF-1138: remove comments

* VRF-1138: refactoring

* VRF-1138: pr comments

* VRF-1138: pr comments

* VRF-1138: fixing lint issues

* VRF-1138: PR comments

* changes to support deterministic message hash in the remote target (#13935)

* common version update to head of develop (#14030)

* Add changeset

---------

Co-authored-by: Agustina Aldasoro <agusaldasoro@users.noreply.github.com>
Co-authored-by: Amir Y <83904651+amirylm@users.noreply.github.com>
Co-authored-by: André Vitor de Lima Matos <andre.matos@smartcontract.com>
Co-authored-by: AnieeG <anindita.ghosh@smartcontract.com>
Co-authored-by: Anindita Ghosh <88458927+AnieeG@users.noreply.github.com>
Co-authored-by: Chunkai Yang <matYang@users.noreply.github.com>
Co-authored-by: Connor Stein <connor.stein@mail.mcgill.ca>
Co-authored-by: Evaldas Latoškinas <34982762+elatoskinas@users.noreply.github.com>
Co-authored-by: Jean Arnaud <jarnaud@users.noreply.github.com>
Co-authored-by: Justin Kaseman <justinkaseman@live.com>
Co-authored-by: Makram <makramkd@users.noreply.github.com>
Co-authored-by: Mateusz Sekara <mateusz.sekara@gmail.com>
Co-authored-by: Matt Yang <matt.yang@smartcontract.com>
Co-authored-by: Patrick <patrick.huie@smartcontract.com>
Co-authored-by: Rens Rooimans <github@rensrooimans.nl>
Co-authored-by: Roman Kashitsyn <roman.kashitsyn@gmail.com>
Co-authored-by: Roman Kashitsyn <roman.kashitsyn@smartcontract.com>
Co-authored-by: Ryan Stout <ryan.stout@smartcontract.com>
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Co-authored-by: dimitris <dimitrios.kouveris@smartcontract.com>
Co-authored-by: nogo <0xnogo@gmail.com>
Co-authored-by: nogo <110664798+0xnogo@users.noreply.github.com>
Co-authored-by: valerii-kabisov-cll <172247313+valerii-kabisov-cll@users.noreply.github.com>
Co-authored-by: Ilja Pavlovs <5300706+iljapavlovs@users.noreply.github.com>
Co-authored-by: Matthew Pendrey <matthew.pendrey@gmail.com>
  • Loading branch information
1 parent 8b9f2b6 commit 55e7c8b
Show file tree
Hide file tree
Showing 224 changed files with 42,778 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-mice-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Added CCIP plugins code from https://github.com/smartcontractkit/ccip/ #added
93 changes: 92 additions & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -457,4 +457,95 @@ packages:
filename: optimism_dispute_game_factory_interface.go
outpkg: mock_optimism_dispute_game_factory
interfaces:
OptimismDisputeGameFactoryInterface:
OptimismDisputeGameFactoryInterface:
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/cache:
config:
filename: chain_health_mock.go
interfaces:
ChainHealthcheck:
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdata:
interfaces:
CommitStoreReader:
config:
filename: commit_store_reader_mock.go
OffRampReader:
config:
filename: offramp_reader_mock.go
OnRampReader:
config:
filename: onramp_reader_mock.go
PriceRegistryReader:
config:
filename: price_registry_reader_mock.go
TokenPoolReader:
config:
filename: token_pool_reader_mock.go
USDCReader:
config:
filename: usdc_reader_mock.go
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdata/batchreader:
config:
filename: token_pool_batched_reader_mock.go
interfaces:
TokenPoolBatchedReader:
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdata/ccipdataprovider:
config:
filename: price_registry_mock.go
interfaces:
PriceRegistry:
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdb:
config:
filename: price_service_mock.go
interfaces:
PriceService:
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/pricegetter:
config:
filename: mock.go
dir: "{{ .InterfaceDir }}/"
outpkg: pricegetter
interfaces:
PriceGetter:
config:
mockname: "Mock{{ .InterfaceName }}"
github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/statuschecker:
interfaces:
CCIPTransactionStatusChecker:
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/rpclib:
config:
outpkg: rpclibmocks
interfaces:
BatchCaller:
config:
filename: batch_caller.go
dir: core/services/relay/evm/rpclibmocks
EvmBatchCaller:
config:
filename: evm_mock.go
dir: "{{ .InterfaceDir }}/rpclibmocks"

github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/prices:
config:
dir: "{{ .InterfaceDir }}/"
outpkg: prices
interfaces:
GasPriceEstimatorCommit:
config:
mockname: "Mock{{ .InterfaceName }}"
filename: gas_price_estimator_commit_mock.go
GasPriceEstimatorExec:
config:
mockname: "Mock{{ .InterfaceName }}"
filename: gas_price_estimator_exec_mock.go
GasPriceEstimator:
config:
mockname: "Mock{{ .InterfaceName }}"
filename: gas_price_estimator_mock.go
github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/tokendata:
config:
filename: reader_mock.go
dir: "{{ .InterfaceDir }}/"
outpkg: tokendata
interfaces:
Reader:
config:
mockname: "Mock{{ .InterfaceName }}"
2 changes: 2 additions & 0 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ FeedsManager = true # Default
LogPoller = false # Default
# UICSAKeys enables CSA Keys in the UI.
UICSAKeys = false # Default
# CCIP enables the CCIP service.
CCIP = true # Default

[Database]
# DefaultIdleInTxSessionTimeout is the maximum time allowed for a transaction to be open and idle before timing out. See Postgres `idle_in_transaction_session_timeout` for more details.
Expand Down
4 changes: 4 additions & 0 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ type Feature struct {
FeedsManager *bool
LogPoller *bool
UICSAKeys *bool
CCIP *bool
}

func (f *Feature) setFrom(f2 *Feature) {
Expand All @@ -315,6 +316,9 @@ func (f *Feature) setFrom(f2 *Feature) {
if v := f2.UICSAKeys; v != nil {
f.UICSAKeys = v
}
if v := f2.CCIP; v != nil {
f.CCIP = v
}
}

type Database struct {
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ require (
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/XSAM/otelsql v0.27.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/avast/retry-go/v4 v4.5.1 // indirect
github.com/avast/retry-go/v4 v4.6.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA=
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/avast/retry-go/v4 v4.5.1 h1:AxIx0HGi4VZ3I02jr78j5lZ3M6x1E0Ivxa6b0pUUh7o=
github.com/avast/retry-go/v4 v4.5.1/go.mod h1:/sipNsvNB3RRuT5iNcb6h73nw3IBmXJ/H3XrCQYSOpc=
github.com/avast/retry-go/v4 v4.6.0 h1:K9xNA+KeB8HHc2aWFuLb25Offp+0iVRXEvFx8IinRJA=
github.com/avast/retry-go/v4 v4.6.0/go.mod h1:gvWlPhBVsvBbLkVGDg/KwvBv0bEkCOLRRSHKIr2PyOE=
github.com/aws/aws-sdk-go v1.22.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.45.25 h1:c4fLlh5sLdK2DCRTY1z0hyuJZU4ygxX8m1FswL6/nF4=
Expand Down
2 changes: 2 additions & 0 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ func TestConfig_Marshal(t *testing.T) {
FeedsManager: ptr(true),
LogPoller: ptr(true),
UICSAKeys: ptr(true),
CCIP: ptr(true),
}
full.Database = toml.Database{
DefaultIdleInTxSessionTimeout: commoncfg.MustNewDuration(time.Minute),
Expand Down Expand Up @@ -771,6 +772,7 @@ Headers = ['Authorization: token', 'X-SomeOther-Header: value with spaces | and
FeedsManager = true
LogPoller = true
UICSAKeys = true
CCIP = true
`},
{"Database", Config{Core: toml.Core{Database: full.Database}}, `[Database]
DefaultIdleInTxSessionTimeout = '1m0s'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ShutdownGracePeriod = '5s'
FeedsManager = true
LogPoller = false
UICSAKeys = false
CCIP = true

[Database]
DefaultIdleInTxSessionTimeout = '1h0m0s'
Expand Down
1 change: 1 addition & 0 deletions core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ShutdownGracePeriod = '10s'
FeedsManager = true
LogPoller = true
UICSAKeys = true
CCIP = true

[Database]
DefaultIdleInTxSessionTimeout = '1m0s'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ShutdownGracePeriod = '5s'
FeedsManager = true
LogPoller = false
UICSAKeys = false
CCIP = true

[Database]
DefaultIdleInTxSessionTimeout = '1h0m0s'
Expand Down
33 changes: 33 additions & 0 deletions core/services/feeds/mocks/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions core/services/feeds/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ type Service interface {
ListSpecsByJobProposalIDs(ctx context.Context, ids []int64) ([]JobProposalSpec, error)
RejectSpec(ctx context.Context, id int64) error
UpdateSpecDefinition(ctx context.Context, id int64, spec string) error

// Unsafe_SetConnectionsManager Only for testing
Unsafe_SetConnectionsManager(ConnectionsManager)
}

type service struct {
Expand Down Expand Up @@ -1105,6 +1108,16 @@ func (s *service) observeJobProposalCounts(ctx context.Context) error {
return nil
}

// Unsafe_SetConnectionsManager sets the ConnectionsManager on the service.
//
// We need to be able to inject a mock for the client to facilitate integration
// tests.
//
// ONLY TO BE USED FOR TESTING.
func (s *service) Unsafe_SetConnectionsManager(connMgr ConnectionsManager) {
s.connMgr = connMgr
}

// findExistingJobForOCR2 looks for existing job for OCR2
func findExistingJobForOCR2(ctx context.Context, j *job.Job, tx job.ORM) (int32, error) {
var contractID string
Expand Down Expand Up @@ -1501,5 +1514,6 @@ func (ns NullService) IsJobManaged(ctx context.Context, jobID int64) (bool, erro
func (ns NullService) UpdateSpecDefinition(ctx context.Context, id int64, spec string) error {
return ErrFeedsManagerDisabled
}
func (ns NullService) Unsafe_SetConnectionsManager(_ ConnectionsManager) {}

//revive:enable
Loading

0 comments on commit 55e7c8b

Please sign in to comment.