From 5f67540cb2b5fd8085f5fc602664e67bbcc04ca1 Mon Sep 17 00:00:00 2001 From: asoliman Date: Mon, 15 Jul 2024 22:30:09 +0400 Subject: [PATCH] Enable Capabilities --- .../ccip_integration_tests/ocr3_node_test.go | 5 +++-- .../ccip_integration_tests/ocr_node_helper.go | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/services/ocr3/plugins/ccip_integration_tests/ocr3_node_test.go b/core/services/ocr3/plugins/ccip_integration_tests/ocr3_node_test.go index dc2c554f88..584244b800 100644 --- a/core/services/ocr3/plugins/ccip_integration_tests/ocr3_node_test.go +++ b/core/services/ocr3/plugins/ccip_integration_tests/ocr3_node_test.go @@ -38,9 +38,10 @@ func TestIntegration_OCR3Nodes(t *testing.T) { bootstrappers []commontypes.BootstrapperLocator ) - ports := freeport.GetN(t, numNodes) + // Need double the ports, one for p2pV and another for 2capabilities peering v2 + ports := freeport.GetN(t, numNodes*2) for i := 0; i < numNodes; i++ { - node := setupNodeOCR3(t, ports[i], bootstrappers, universes) + node := setupNodeOCR3(t, ports[i], ports[i+1], bootstrappers, universes, homeChainUni, i > 0) apps = append(apps, node.app) for chainID, transmitter := range node.transmitters { diff --git a/core/services/ocr3/plugins/ccip_integration_tests/ocr_node_helper.go b/core/services/ocr3/plugins/ccip_integration_tests/ocr_node_helper.go index a29c7dc108..4598fe23c4 100644 --- a/core/services/ocr3/plugins/ccip_integration_tests/ocr_node_helper.go +++ b/core/services/ocr3/plugins/ccip_integration_tests/ocr_node_helper.go @@ -5,6 +5,7 @@ import ( "fmt" "math/big" "net/http" + "strconv" "sync" "testing" "time" @@ -13,12 +14,11 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" gethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/jmoiron/sqlx" - "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox" + "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" @@ -54,8 +54,11 @@ type ocr3Node struct { func setupNodeOCR3( t *testing.T, port int, + capabilitiesPort int, p2pV2Bootstrappers []commontypes.BootstrapperLocator, universes map[uint64]onchainUniverse, + homeChainUniverse homeChain, + capabilityEnabled bool, ) *ocr3Node { // Do not want to load fixtures as they contain a dummy chainID. cfg, db := heavyweight.FullTestDBNoFixturesV2(t, func(c *chainlink.Config, s *chainlink.Secrets) { @@ -72,6 +75,14 @@ func setupNodeOCR3( c.P2P.V2.DefaultBootstrappers = &p2pV2Bootstrappers } + // Enable Capabilities, This is a pre-requisite for registrySyncer to work. + // Same values as P2P.V2 except for the listen address. + c.Capabilities.Peering.V2 = c.P2P.V2 + c.Capabilities.Peering.V2.ListenAddresses = &[]string{fmt.Sprintf("127.0.0.1:%d", capabilitiesPort)} + c.Capabilities.ExternalRegistry.NetworkID = ptr(relay.NetworkEVM) + c.Capabilities.ExternalRegistry.ChainID = ptr(strconv.FormatUint(homeChainUniverse.chainID, 10)) + c.Capabilities.ExternalRegistry.Address = ptr(homeChainUniverse.capabilityRegistry.Address().String()) + // OCR configs c.OCR.Enabled = ptr(false) c.OCR.DefaultTransactionQueueDepth = ptr(uint32(200)) @@ -152,7 +163,6 @@ func setupNodeOCR3( require.NoError(t, err) require.Len(t, p2pIDs, 1) peerID := p2pIDs[0].PeerID() - // create a transmitter for each chain transmitters := make(map[uint64]common.Address) for chainID, uni := range universes {