Skip to content

Commit

Permalink
bump chainlink-ccip, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
makramkd committed Aug 13, 2024
1 parent 03ae3bb commit 133a2fe
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()) })

Expand Down
41 changes: 21 additions & 20 deletions core/capabilities/ccip/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -241,55 +242,55 @@ 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
err = reader.GetLatestValue(ctx, consts.ContractNameCapabilitiesRegistry, consts.MethodNameGetCapability, primitives.Unconfirmed, map[string]any{
"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
}
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 133a2fe

Please sign in to comment.