diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b64294a14f..fd82c3a9b5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,7 +3,7 @@ # Please define less specific codeowner paths before more specific codeowner paths in order for the more specific rule to have priority # Root -* @smartcontractkit/foundations +* @smartcontractkit/ccip # Chains /common @smartcontractkit/bix-framework diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 670bfb046a..73a2f8c60b 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-20240718144623-dad238eb17c1 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 // 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 6e61619cf1..bc1a7b6325 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1070,8 +1070,8 @@ github.com/smartcontractkit/chain-selectors v1.0.19 h1:y82TyWaOA6gSvi26bbyDYgfZv github.com/smartcontractkit/chain-selectors v1.0.19/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-20240718144623-dad238eb17c1 h1:YGfq0GHxuDR/gAmd6OZiW/Oxo9lyE7S8zi2MEL96bdE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240718144623-dad238eb17c1/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 h1:eYe/NS0b97yJV5ffLB+v6ww6R9FcUZV1k07tuArhCdY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= 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/core/services/ccipcapability/oraclecreator/inprocess.go b/core/services/ccipcapability/oraclecreator/inprocess.go index c07aed6039..0eaef462b5 100644 --- a/core/services/ccipcapability/oraclecreator/inprocess.go +++ b/core/services/ccipcapability/oraclecreator/inprocess.go @@ -257,6 +257,7 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp i.lggr. Named("CCIPCommitPlugin"). Named(destRelayID.String()). + Named(fmt.Sprintf("%d", config.Config.ChainSelector)). Named(hexutil.Encode(config.Config.OfframpAddress)), ccipreaderpkg.OCR3ConfigWithMeta(config), ccipevm.NewCommitPluginCodecV1(), diff --git a/core/services/ocr3/plugins/ccip_integration_tests/helpers.go b/core/services/ocr3/plugins/ccip_integration_tests/helpers.go index 18c4c2d17a..3e86d87ea0 100644 --- a/core/services/ocr3/plugins/ccip_integration_tests/helpers.go +++ b/core/services/ocr3/plugins/ccip_integration_tests/helpers.go @@ -626,6 +626,15 @@ func wireOffRamp(t *testing.T, uni onchainUniverse, universes map[uint64]onchain _, err := uni.offramp.ApplySourceChainConfigUpdates(owner, offrampSourceChainConfigArgs) require.NoErrorf(t, err, "failed to apply source chain config updates on offramp on chain id %d", uni.chainID) uni.backend.Commit() + for remoteChainID, remoteUniverse := range universes { + if remoteChainID == uni.chainID { + continue + } + sourceCfg, err2 := uni.offramp.GetSourceChainConfig(&bind.CallOpts{}, getSelector(remoteChainID)) + require.NoError(t, err2) + require.True(t, sourceCfg.IsEnabled, "source chain config should be enabled") + require.Equal(t, remoteUniverse.onramp.Address(), common.BytesToAddress(sourceCfg.OnRamp), "source chain config onRamp address mismatch") + } } func getSelector(chainID uint64) uint64 { 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 f74be8e563..484ca82c29 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 @@ -3,6 +3,7 @@ package ccip_integration_tests import ( "fmt" "math/big" + "sync" "testing" "time" @@ -10,6 +11,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/hashicorp/consul/sdk/freeport" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/ping_pong_demo" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_multi_offramp" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" @@ -23,8 +26,6 @@ import ( ) func TestIntegration_OCR3Nodes(t *testing.T) { - t.Skip("Currently failing, will fix in follow-ups") - numChains := 3 homeChainUni, universes := createUniverses(t, numChains) numNodes := 4 @@ -136,6 +137,58 @@ func TestIntegration_OCR3Nodes(t *testing.T) { // map[uint64] chainID, blocks var replayBlocks = make(map[uint64]uint64) pingPongs := initializePingPongContracts(t, universes) + + sendPingPong(t, universes, pingPongs, messageIDs, replayBlocks, 1) + // HACK: wait for the oracles to come up. + // Need some data driven way to do this. + time.Sleep(30 * time.Second) + + // replay the log poller on all the chains so that the logs are in the db. + // otherwise the plugins won't pick them up. + // TODO: this is happening too early, we need to wait for the chain readers to get their config + // and register the LP filters before this has any effect. + for _, node := range nodes { + for chainID, replayBlock := range replayBlocks { + t.Logf("Replaying logs for chain %d from block %d", chainID, replayBlock) + require.NoError(t, node.app.ReplayFromBlock(big.NewInt(int64(chainID)), replayBlock, false), "failed to replay logs") + } + } + + numUnis := len(universes) + var wg sync.WaitGroup + for _, uni := range universes { + wg.Add(1) + go func(uni onchainUniverse) { + defer wg.Done() + waitForCommit(t, uni, numUnis, nil) + }(uni) + } + + t.Log("waiting for commit reports") + wg.Wait() + + var preRequestBlocks = make(map[uint64]uint64) + for _, uni := range universes { + preRequestBlocks[uni.chainID] = uni.backend.Blockchain().CurrentBlock().Number.Uint64() + } + + t.Log("PingPong AGAIN") + sendPingPong(t, universes, pingPongs, messageIDs, replayBlocks, 2) + + for _, uni := range universes { + startBlock := preRequestBlocks[uni.chainID] + wg.Add(1) + go func(uni onchainUniverse, startBlock *uint64) { + defer wg.Done() + waitForCommit(t, uni, numUnis, startBlock) + }(uni, &startBlock) + } + + t.Log("waiting for second batch of commit reports") + wg.Wait() +} + +func sendPingPong(t *testing.T, universes map[uint64]onchainUniverse, pingPongs map[uint64]map[uint64]*ping_pong_demo.PingPongDemo, messageIDs map[uint64]map[uint64][32]byte, replayBlocks map[uint64]uint64, expectedSeqNum uint64) { for chainID, uni := range universes { var replayBlock uint64 for otherChain, pingPong := range pingPongs[chainID] { @@ -143,7 +196,7 @@ func TestIntegration_OCR3Nodes(t *testing.T) { expNextSeqNr, err1 := uni.onramp.GetExpectedNextSequenceNumber(&bind.CallOpts{}, getSelector(otherChain)) require.NoError(t, err1) - require.Equal(t, uint64(1), expNextSeqNr, "expected next sequence number should be 1") + require.Equal(t, expectedSeqNum, expNextSeqNr, "expected next sequence number should be 1") uni.backend.Commit() @@ -193,30 +246,14 @@ func TestIntegration_OCR3Nodes(t *testing.T) { } replayBlocks[chainID] = replayBlock } - - // HACK: wait for the oracles to come up. - // Need some data driven way to do this. - time.Sleep(30 * time.Second) - - // replay the log poller on all the chains so that the logs are in the db. - // otherwise the plugins won't pick them up. - // TODO: this is happening too early, we need to wait for the chain readers to get their config - // and register the LP filters before this has any effect. - for _, node := range nodes { - for chainID, replayBlock := range replayBlocks { - t.Logf("Replaying logs for chain %d from block %d", chainID, replayBlock) - require.NoError(t, node.app.ReplayFromBlock(big.NewInt(int64(chainID)), replayBlock, false), "failed to replay logs") - } - } - - for _, uni := range universes { - waitForCommit(t, uni) - } } -func waitForCommit(t *testing.T, uni onchainUniverse) { +func waitForCommit(t *testing.T, uni onchainUniverse, numUnis int, startBlock *uint64) { sink := make(chan *evm_2_evm_multi_offramp.EVM2EVMMultiOffRampCommitReportAccepted) - subscipriton, err := uni.offramp.WatchCommitReportAccepted(&bind.WatchOpts{}, sink) + subscipriton, err := uni.offramp.WatchCommitReportAccepted(&bind.WatchOpts{ + Start: startBlock, + Context: testutils.Context(t), + }, sink) require.NoError(t, err) for { @@ -227,11 +264,15 @@ func waitForCommit(t *testing.T, uni onchainUniverse) { t.Fatalf("Subscription error: %+v", subErr) case report := <-sink: if len(report.Report.MerkleRoots) > 0 { - t.Logf("Received commit report with merkle roots: %+v", report) + if len(report.Report.MerkleRoots) == numUnis-1 { + t.Logf("Received commit report with %d merkle roots on chain id %d (selector %d): %+v", + len(report.Report.MerkleRoots), uni.chainID, getSelector(uni.chainID), report) + return + } + t.Fatalf("Received commit report with %d merkle roots, expected %d", len(report.Report.MerkleRoots), numUnis) } else { - t.Logf("Received commit report without merkle roots: %+v", report) + t.Logf("Received commit report without merkle roots on chain id %d (selector %d): %+v", uni.chainID, getSelector(uni.chainID), report) } - return } } } diff --git a/go.mod b/go.mod index b9d64e697a..9d2aafa2ca 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.19 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240718144623-dad238eb17c1 + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 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 62b7a542f8..0e4fa7e870 100644 --- a/go.sum +++ b/go.sum @@ -1027,8 +1027,8 @@ github.com/smartcontractkit/chain-selectors v1.0.19 h1:y82TyWaOA6gSvi26bbyDYgfZv github.com/smartcontractkit/chain-selectors v1.0.19/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-20240718144623-dad238eb17c1 h1:YGfq0GHxuDR/gAmd6OZiW/Oxo9lyE7S8zi2MEL96bdE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240718144623-dad238eb17c1/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 h1:eYe/NS0b97yJV5ffLB+v6ww6R9FcUZV1k07tuArhCdY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= 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 cbbdff2d70..3f62303fb8 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-20240718144623-dad238eb17c1 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 // 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 8eb7368e18..3aa9a190d0 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1392,8 +1392,8 @@ github.com/smartcontractkit/chain-selectors v1.0.19 h1:y82TyWaOA6gSvi26bbyDYgfZv github.com/smartcontractkit/chain-selectors v1.0.19/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-20240718144623-dad238eb17c1 h1:YGfq0GHxuDR/gAmd6OZiW/Oxo9lyE7S8zi2MEL96bdE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240718144623-dad238eb17c1/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 h1:eYe/NS0b97yJV5ffLB+v6ww6R9FcUZV1k07tuArhCdY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= 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 140b00028d..ecd62ed8e7 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-20240718144623-dad238eb17c1 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 // 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 129f0971e8..92546ccc86 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1374,8 +1374,8 @@ github.com/smartcontractkit/chain-selectors v1.0.19 h1:y82TyWaOA6gSvi26bbyDYgfZv github.com/smartcontractkit/chain-selectors v1.0.19/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-20240718144623-dad238eb17c1 h1:YGfq0GHxuDR/gAmd6OZiW/Oxo9lyE7S8zi2MEL96bdE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240718144623-dad238eb17c1/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 h1:eYe/NS0b97yJV5ffLB+v6ww6R9FcUZV1k07tuArhCdY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM= 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=