From 04e02244a0131792cc1dbfdee79d225af67305de Mon Sep 17 00:00:00 2001 From: Makram Date: Wed, 14 Aug 2024 12:37:36 +0300 Subject: [PATCH] core/capabilities/ccip: bump chainlink-ccip, fix tests (#1291) ## Motivation Bump chainlink-ccip to the version from this PR: https://github.com/smartcontractkit/chainlink-ccip/pull/64 ## Solution Bump and fix the tests. --- .../integrationhelpers/integration_helpers.go | 5 ++- core/capabilities/ccip/delegate.go | 41 ++++++++++--------- 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 +- 10 files changed, 37 insertions(+), 33 deletions(-) diff --git a/core/capabilities/ccip/ccip_integration_tests/integrationhelpers/integration_helpers.go b/core/capabilities/ccip/ccip_integration_tests/integrationhelpers/integration_helpers.go index c23cd21403..3009ecf222 100644 --- a/core/capabilities/ccip/ccip_integration_tests/integrationhelpers/integration_helpers.go +++ b/core/capabilities/ccip/ccip_integration_tests/integrationhelpers/integration_helpers.go @@ -232,7 +232,10 @@ func (t *TestUniverse) AddCapability(p2pIDs [][32]byte) { func NewHomeChainReader(t *testing.T, logPoller logpoller.LogPoller, headTracker logpoller.HeadTracker, client client.Client, ccAddress common.Address) ccipreader.HomeChain { cr := NewReader(t, logPoller, headTracker, client, ccAddress, configsevm.HomeChainReaderConfigRaw()) - hcr := ccipreader.NewHomeChainReader(cr, logger.TestLogger(t), 500*time.Millisecond) + hcr := ccipreader.NewHomeChainReader(cr, logger.TestLogger(t), 500*time.Millisecond, types.BoundContract{ + Address: ccAddress.String(), + Name: consts.ContractNameCCIPConfig, + }) require.NoError(t, hcr.Start(testutils.Context(t))) t.Cleanup(func() { require.NoError(t, hcr.Close()) }) diff --git a/core/capabilities/ccip/delegate.go b/core/capabilities/ccip/delegate.go index 1b4b9e25ae..afa8152ea5 100644 --- a/core/capabilities/ccip/delegate.go +++ b/core/capabilities/ccip/delegate.go @@ -118,7 +118,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services // since all queries are scoped by config digest. ocrDB := ocr2.NewDB(d.ds, spec.ID, 0, d.lggr) - homeChainContractReader, err := d.getHomeChainContractReader( + homeChainContractReader, ccipConfigBinding, err := d.getHomeChainContractReader( ctx, d.chains, spec.CCIPSpec.CapabilityLabelledName, @@ -131,6 +131,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services homeChainContractReader, d.lggr.Named("HomeChainReader"), 100*time.Millisecond, + ccipConfigBinding, ) oracleCreator := oraclecreator.New( @@ -223,13 +224,13 @@ func (d *Delegate) getHomeChainContractReader( chains legacyevm.LegacyChainContainer, capabilityLabelledName, capabilityVersion string, -) (types.ContractReader, error) { +) (types.ContractReader, types.BoundContract, error) { // home chain is where the capability registry is deployed, // which should be set correctly in toml config. homeChainRelayID := d.capabilityConfig.ExternalRegistry().RelayID() homeChain, err := chains.Get(homeChainRelayID.ChainID) if err != nil { - return nil, fmt.Errorf("home chain relayer not found, chain id: %s, err: %w", homeChainRelayID.String(), err) + return nil, types.BoundContract{}, fmt.Errorf("home chain relayer not found, chain id: %s, err: %w", homeChainRelayID.String(), err) } reader, err := evm.NewChainReaderService( @@ -241,35 +242,36 @@ func (d *Delegate) getHomeChainContractReader( configsevm.HomeChainReaderConfigRaw(), ) if err != nil { - return nil, fmt.Errorf("failed to create home chain contract reader: %w", err) + return nil, types.BoundContract{}, fmt.Errorf("failed to create home chain contract reader: %w", err) } - reader, err = bindReader(ctx, reader, d.capabilityConfig.ExternalRegistry().Address(), capabilityLabelledName, capabilityVersion) + reader, ccipConfigBinding, err := bindReader(ctx, reader, d.capabilityConfig.ExternalRegistry().Address(), capabilityLabelledName, capabilityVersion) if err != nil { - return nil, fmt.Errorf("failed to bind home chain contract reader: %w", err) + return nil, types.BoundContract{}, fmt.Errorf("failed to bind home chain contract reader: %w", err) } - return reader, nil + return reader, ccipConfigBinding, nil } func bindReader(ctx context.Context, reader types.ContractReader, capRegAddress, capabilityLabelledName, - capabilityVersion string) (types.ContractReader, error) { - err := reader.Bind(ctx, []types.BoundContract{ + capabilityVersion string, +) (boundReader types.ContractReader, ccipConfigBinding types.BoundContract, err error) { + err = reader.Bind(ctx, []types.BoundContract{ { Address: capRegAddress, Name: consts.ContractNameCapabilitiesRegistry, }, }) if err != nil { - return nil, fmt.Errorf("failed to bind home chain contract reader: %w", err) + return nil, types.BoundContract{}, fmt.Errorf("failed to bind home chain contract reader: %w", err) } hid, err := common.HashedCapabilityID(capabilityLabelledName, capabilityVersion) if err != nil { - return nil, fmt.Errorf("failed to hash capability id: %w", err) + return nil, types.BoundContract{}, fmt.Errorf("failed to hash capability id: %w", err) } var ccipCapabilityInfo kcr.CapabilitiesRegistryCapabilityInfo @@ -277,19 +279,18 @@ func bindReader(ctx context.Context, "hashedId": hid, }, &ccipCapabilityInfo) if err != nil { - return nil, fmt.Errorf("failed to get CCIP capability info from chain reader: %w", err) + return nil, types.BoundContract{}, fmt.Errorf("failed to get CCIP capability info from chain reader: %w", err) } // bind the ccip capability configuration contract - err = reader.Bind(ctx, []types.BoundContract{ - { - Address: ccipCapabilityInfo.ConfigurationContract.String(), - Name: consts.ContractNameCCIPConfig, - }, - }) + ccipConfigBinding = types.BoundContract{ + Address: ccipCapabilityInfo.ConfigurationContract.String(), + Name: consts.ContractNameCCIPConfig, + } + err = reader.Bind(ctx, []types.BoundContract{ccipConfigBinding}) if err != nil { - return nil, fmt.Errorf("failed to bind CCIP capability configuration contract: %w", err) + return nil, types.BoundContract{}, fmt.Errorf("failed to bind CCIP capability configuration contract: %w", err) } - return reader, nil + return reader, ccipConfigBinding, nil } diff --git a/core/scripts/go.mod b/core/scripts/go.mod index ccf4a2b32b..7848a1dade 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -274,7 +274,7 @@ require ( github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/shirou/gopsutil/v3 v3.24.3 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240718160222-2dc0c8136bfa // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index b95551d8b2..e3cf65c26a 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1070,8 +1070,8 @@ github.com/smartcontractkit/chain-selectors v1.0.21 h1:KCR9SA7PhOexaBzFieHoLv1Wo github.com/smartcontractkit/chain-selectors v1.0.21/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 h1:XKEmg6dOkCsyNcW3R+IhhrUYdVJTKirLL2sCCgzRWjU= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f h1:sxBPgtGeqJ3h3+JgF6N3wwr4xgy9wLbBIjFVVn6mMCs= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834 h1:pTf4xdcmiWBqWZ6rTy2RMTDBzhHk89VC1pM7jXKQztI= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= diff --git a/go.mod b/go.mod index fc89fbb06c..8ca696860f 100644 --- a/go.mod +++ b/go.mod @@ -74,7 +74,7 @@ require ( github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chain-selectors v1.0.21 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240718160222-2dc0c8136bfa diff --git a/go.sum b/go.sum index 5aa0189250..bb7deba816 100644 --- a/go.sum +++ b/go.sum @@ -1027,8 +1027,8 @@ github.com/smartcontractkit/chain-selectors v1.0.21 h1:KCR9SA7PhOexaBzFieHoLv1Wo github.com/smartcontractkit/chain-selectors v1.0.21/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 h1:XKEmg6dOkCsyNcW3R+IhhrUYdVJTKirLL2sCCgzRWjU= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f h1:sxBPgtGeqJ3h3+JgF6N3wwr4xgy9wLbBIjFVVn6mMCs= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834 h1:pTf4xdcmiWBqWZ6rTy2RMTDBzhHk89VC1pM7jXKQztI= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 10966712ce..0a387288cd 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -384,7 +384,7 @@ require ( github.com/shirou/gopsutil/v3 v3.24.3 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240718160222-2dc0c8136bfa // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index ee80bbdad4..84d5d816dc 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1392,8 +1392,8 @@ github.com/smartcontractkit/chain-selectors v1.0.21 h1:KCR9SA7PhOexaBzFieHoLv1Wo github.com/smartcontractkit/chain-selectors v1.0.21/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 h1:XKEmg6dOkCsyNcW3R+IhhrUYdVJTKirLL2sCCgzRWjU= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f h1:sxBPgtGeqJ3h3+JgF6N3wwr4xgy9wLbBIjFVVn6mMCs= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834 h1:pTf4xdcmiWBqWZ6rTy2RMTDBzhHk89VC1pM7jXKQztI= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 7345baa146..5a1bd062a4 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -40,7 +40,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 // indirect k8s.io/apimachinery v0.30.2 // indirect ) diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 78db125a98..7912c3abf4 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1374,8 +1374,8 @@ github.com/smartcontractkit/chain-selectors v1.0.21 h1:KCR9SA7PhOexaBzFieHoLv1Wo github.com/smartcontractkit/chain-selectors v1.0.21/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422 h1:XKEmg6dOkCsyNcW3R+IhhrUYdVJTKirLL2sCCgzRWjU= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240812165928-f1cc95338422/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f h1:sxBPgtGeqJ3h3+JgF6N3wwr4xgy9wLbBIjFVVn6mMCs= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240813153644-0117f0e6569f/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834 h1:pTf4xdcmiWBqWZ6rTy2RMTDBzhHk89VC1pM7jXKQztI= github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0=