Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the home chain selector #14500

Merged
merged 12 commits into from
Sep 30, 2024
5 changes: 5 additions & 0 deletions .changeset/silver-plums-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#added Pass the home chain selector to the commit plugin factory
16 changes: 16 additions & 0 deletions core/capabilities/ccip/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ccip
import (
"context"
"fmt"
"strconv"
"time"

"github.com/smartcontractkit/chainlink-common/pkg/loop"
Expand All @@ -23,7 +24,11 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives"

chainsel "github.com/smartcontractkit/chain-selectors"

cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm"
"github.com/smartcontractkit/chainlink/v2/core/config"
kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry"
Expand Down Expand Up @@ -162,6 +167,16 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services
ccipConfigBinding,
)

// get the chain selector for the home chain
homeChainChainID, err := strconv.ParseUint(d.capabilityConfig.ExternalRegistry().RelayID().ChainID, 10, 64)
if err != nil {
return nil, fmt.Errorf("failed to parse chain ID %s: %w", d.capabilityConfig.ExternalRegistry().RelayID().ChainID, err)
}
homeChainChainSelector, err := chainsel.SelectorFromChainId(homeChainChainID)
if err != nil {
return nil, fmt.Errorf("failed to get chain selector from chain ID %d", homeChainChainID)
}

// if bootstrappers are provided we assume that the node is a plugin oracle.
// the reason for this is that bootstrap oracles do not need to be aware
// of other bootstrap oracles. however, plugin oracles, at least initially,
Expand All @@ -182,6 +197,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services
d.monitoringEndpointGen,
bootstrapperLocators,
hcr,
cciptypes.ChainSelector(homeChainChainSelector),
)
} else {
oracleCreator = oraclecreator.NewBootstrapOracleCreator(
Expand Down
4 changes: 4 additions & 0 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type pluginOracleCreator struct {
monitoringEndpointGen telemetry.MonitoringEndpointGenerator
bootstrapperLocators []commontypes.BootstrapperLocator
homeChainReader ccipreaderpkg.HomeChain
homeChainSelector cciptypes.ChainSelector
}

func NewPluginOracleCreator(
Expand All @@ -83,6 +84,7 @@ func NewPluginOracleCreator(
monitoringEndpointGen telemetry.MonitoringEndpointGenerator,
bootstrapperLocators []commontypes.BootstrapperLocator,
homeChainReader ccipreaderpkg.HomeChain,
homeChainSelector cciptypes.ChainSelector,
) cctypes.OracleCreator {
return &pluginOracleCreator{
ocrKeyBundles: ocrKeyBundles,
Expand All @@ -98,6 +100,7 @@ func NewPluginOracleCreator(
monitoringEndpointGen: monitoringEndpointGen,
bootstrapperLocators: bootstrapperLocators,
homeChainReader: homeChainReader,
homeChainSelector: homeChainSelector,
}
}

Expand Down Expand Up @@ -218,6 +221,7 @@ func (i *pluginOracleCreator) createFactoryAndTransmitter(
ccipevm.NewCommitPluginCodecV1(),
ccipevm.NewMessageHasherV1(),
i.homeChainReader,
i.homeChainSelector,
contractReaders,
chainWriters,
)
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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.20240918210534-564164004d06
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420
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
Expand Down Expand Up @@ -271,7 +271,7 @@
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/smartcontractkit/chain-selectors v1.0.23 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888 // indirect

Check failure on line 274 in core/scripts/go.mod

View workflow job for this annotation

GitHub Actions / Validate go.mod dependencies

[./core/scripts/go.mod] dependency github.com/smartcontractkit/chainlink-ccip@v0.0.0-20240919185124-2bbe88720888 // indirect not on default branch (main). Version(commit): 2bbe88720888 Tree: https://github.com/smartcontractkit/chainlink-ccip/tree/2bbe88720888 Commit: https://github.com/smartcontractkit/chainlink-ccip/commit/2bbe88720888
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f // indirect
Expand Down
8 changes: 4 additions & 4 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1081,10 +1081,10 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/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-20240917180332-5a68498d1612 h1:xPEM9XbfZmv8N3NjZ7AX5salonll/LdXrbb8JCbA4FE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06 h1:wqLXuPdiUkn7es/epKmOpB0Q0tKdA9FkYPNQZrZ+VJU=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888 h1:s7545Nj0JNV50bQM9+sPh1/wwjCyGzAxT8NvEKAwte8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420 h1:+xNnYYgkxzKUIkLCOfzfAKUxeLLtuxlalDI70kNJ8No=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
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=
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chain-selectors v1.0.23
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888

Check failure on line 77 in go.mod

View workflow job for this annotation

GitHub Actions / Validate go.mod dependencies

[./go.mod] dependency github.com/smartcontractkit/chainlink-ccip@v0.0.0-20240919185124-2bbe88720888 not on default branch (main). Version(commit): 2bbe88720888 Tree: https://github.com/smartcontractkit/chainlink-ccip/tree/2bbe88720888 Commit: https://github.com/smartcontractkit/chainlink-ccip/commit/2bbe88720888
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420
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
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,10 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/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-20240917180332-5a68498d1612 h1:xPEM9XbfZmv8N3NjZ7AX5salonll/LdXrbb8JCbA4FE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06 h1:wqLXuPdiUkn7es/epKmOpB0Q0tKdA9FkYPNQZrZ+VJU=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888 h1:s7545Nj0JNV50bQM9+sPh1/wwjCyGzAxT8NvEKAwte8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420 h1:+xNnYYgkxzKUIkLCOfzfAKUxeLLtuxlalDI70kNJ8No=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
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=
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240910151738-3f318badcfb5
github.com/smartcontractkit/chain-selectors v1.0.23
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420

Check failure on line 42 in integration-tests/go.mod

View workflow job for this annotation

GitHub Actions / Validate go.mod dependencies

[./integration-tests/go.mod] dependency github.com/smartcontractkit/chainlink-ccip@v0.0.0-20240919185124-2bbe88720888 not on default branch (main). Version(commit): 2bbe88720888 Tree: https://github.com/smartcontractkit/chainlink-ccip/tree/2bbe88720888 Commit: https://github.com/smartcontractkit/chainlink-ccip/commit/2bbe88720888
github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.6
github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1423,10 +1423,10 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/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-20240917180332-5a68498d1612 h1:xPEM9XbfZmv8N3NjZ7AX5salonll/LdXrbb8JCbA4FE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06 h1:wqLXuPdiUkn7es/epKmOpB0Q0tKdA9FkYPNQZrZ+VJU=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888 h1:s7545Nj0JNV50bQM9+sPh1/wwjCyGzAxT8NvEKAwte8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420 h1:+xNnYYgkxzKUIkLCOfzfAKUxeLLtuxlalDI70kNJ8No=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
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=
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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.20240918210534-564164004d06
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.6
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0
Expand Down Expand Up @@ -386,7 +386,7 @@
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/chain-selectors v1.0.23 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888 // indirect

Check failure on line 389 in integration-tests/load/go.mod

View workflow job for this annotation

GitHub Actions / Validate go.mod dependencies

[./integration-tests/load/go.mod] dependency github.com/smartcontractkit/chainlink-ccip@v0.0.0-20240919185124-2bbe88720888 // indirect not on default branch (main). Version(commit): 2bbe88720888 Tree: https://github.com/smartcontractkit/chainlink-ccip/tree/2bbe88720888 Commit: https://github.com/smartcontractkit/chainlink-ccip/commit/2bbe88720888
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f // indirect
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1397,10 +1397,10 @@ github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnj
github.com/smartcontractkit/chain-selectors v1.0.23/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-20240917180332-5a68498d1612 h1:xPEM9XbfZmv8N3NjZ7AX5salonll/LdXrbb8JCbA4FE=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917180332-5a68498d1612/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06 h1:wqLXuPdiUkn7es/epKmOpB0Q0tKdA9FkYPNQZrZ+VJU=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240918210534-564164004d06/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888 h1:s7545Nj0JNV50bQM9+sPh1/wwjCyGzAxT8NvEKAwte8=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240919185124-2bbe88720888/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420 h1:+xNnYYgkxzKUIkLCOfzfAKUxeLLtuxlalDI70kNJ8No=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420/go.mod h1:zm+l8gN4LQS1+YvwQDhRz/njirVeWGNiDJKIhCGwaoQ=
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=
Expand Down
Loading