diff --git a/.github/integration-in-memory-tests.yml b/.github/integration-in-memory-tests.yml index 9550d74f21f..ef0bf95c596 100644 --- a/.github/integration-in-memory-tests.yml +++ b/.github/integration-in-memory-tests.yml @@ -7,6 +7,13 @@ # runner-test-matrix: # START: CCIPv1.6 tests + - id: smoke/ccip/ccip_migration_to_v_1_6_test.go:* + path: integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go.go + test_env_type: in-memory + runs_on: ubuntu-latest + triggers: + - PR Integration CCIP Tests + test_cmd: cd integration-tests/smoke/ccip && go test ccip_migration_to_v_1_6_test.go -timeout 12m -test.parallel=1 -count=1 -json - id: smoke/ccip/ccip_fees_test.go:* path: integration-tests/smoke/ccip/ccip_fees_test.go diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 7d32653538d..b86baf9a203 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -306,7 +306,7 @@ require ( github.com/shirou/gopsutil/v3 v3.24.3 // indirect github.com/smartcontractkit/ccip-owner-contracts v0.0.0-salt-fix // indirect github.com/smartcontractkit/chain-selectors v1.0.36 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 // indirect github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b // indirect github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e // indirect github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 6494f578fdf..7cb29867b3a 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1158,8 +1158,8 @@ github.com/smartcontractkit/chain-selectors v1.0.36 h1:KSpO8I+JOiuyN4FuXsV471sPo github.com/smartcontractkit/chain-selectors v1.0.36/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba h1:gisAer1YxKKui6LhxDgfuZ3OyrHVjHm/oK/0idusFeI= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 h1:TeWnxdgSO2cYCKcBMwdkRcs/YdhSvXoWqqw7QWz/KeI= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b h1:UBXi9Yj8YSMHDDaxQLu273x1fWjyEL9xP58nuJsqZfg= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60= github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e h1:8BStiP1F4W8AvjBRga0TYtjvAtkwN8oHYnHJztAlSF4= diff --git a/core/services/ocr2/plugins/ccip/testhelpers/integration/jobspec.go b/core/services/ocr2/plugins/ccip/testhelpers/integration/jobspec.go index 41fbc76cd7f..2a70ea0edd6 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/integration/jobspec.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/integration/jobspec.go @@ -156,7 +156,7 @@ type JobType string const ( Commit JobType = "commit" Execution JobType = "exec" - Boostrap JobType = "bootstrap" + Bootstrap JobType = "bootstrap" ) func JobName(jobType JobType, source string, destination, version string) string { @@ -329,7 +329,7 @@ func (params CCIPJobSpecParams) BootstrapJob(contractID string) *OCR2TaskJobSpec }, } return &OCR2TaskJobSpec{ - Name: fmt.Sprintf("%s-%s", Boostrap, params.DestChainName), + Name: fmt.Sprintf("%s-%s-%s", Bootstrap, params.SourceChainName, params.DestChainName), JobType: "bootstrap", OCR2OracleSpec: bootstrapSpec, } diff --git a/deployment/ccip/changeset/accept_ownership_test.go b/deployment/ccip/changeset/accept_ownership_test.go index f74556b6600..dc3b0ba33b3 100644 --- a/deployment/ccip/changeset/accept_ownership_test.go +++ b/deployment/ccip/changeset/accept_ownership_test.go @@ -14,7 +14,7 @@ import ( func Test_NewAcceptOwnershipChangeset(t *testing.T) { t.Parallel() - e := NewMemoryEnvironment(t) + e, _ := NewMemoryEnvironment(t) state, err := LoadOnchainState(e.Env) require.NoError(t, err) diff --git a/deployment/ccip/changeset/cs_active_candidate_test.go b/deployment/ccip/changeset/cs_active_candidate_test.go index 92e3e825620..6016b06884b 100644 --- a/deployment/ccip/changeset/cs_active_candidate_test.go +++ b/deployment/ccip/changeset/cs_active_candidate_test.go @@ -9,6 +9,7 @@ import ( "golang.org/x/exp/maps" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal" commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" @@ -25,7 +26,7 @@ func Test_ActiveCandidate(t *testing.T) { // We want to have the active instance execute a few messages // and then setup a candidate instance. The candidate instance // should not be able to transmit anything until we make it active. - tenv := NewMemoryEnvironment(t, + tenv, _ := NewMemoryEnvironment(t, WithChains(2), WithNodes(4)) state, err := LoadOnchainState(tenv.Env) diff --git a/deployment/ccip/changeset/cs_add_lane_test.go b/deployment/ccip/changeset/cs_add_lane_test.go index e793c1866d9..4b9f1f8641f 100644 --- a/deployment/ccip/changeset/cs_add_lane_test.go +++ b/deployment/ccip/changeset/cs_add_lane_test.go @@ -1,7 +1,6 @@ package changeset import ( - "math/big" "testing" "github.com/ethereum/go-ethereum/common" @@ -9,98 +8,19 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" ) func TestAddLanesWithTestRouter(t *testing.T) { t.Parallel() - e := NewMemoryEnvironment(t) + e, _ := NewMemoryEnvironment(t) // Here we have CR + nodes set up, but no CCIP contracts deployed. state, err := LoadOnchainState(e.Env) require.NoError(t, err) selectors := e.Env.AllChainSelectors() chain1, chain2 := selectors[0], selectors[1] - - stateChain1 := state.Chains[chain1] - e.Env, err = commoncs.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commoncs.ChangesetApplication{ - { - Changeset: commoncs.WrapChangeSet(UpdateOnRampsDests), - Config: UpdateOnRampDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]OnRampDestinationUpdate{ - chain1: { - chain2: { - IsEnabled: true, - TestRouter: true, - AllowListEnabled: false, - }, - }, - }, - }, - }, - { - Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterPricesCS), - Config: UpdateFeeQuoterPricesConfig{ - PricesByChain: map[uint64]FeeQuoterPriceUpdatePerSource{ - chain1: { - TokenPrices: map[common.Address]*big.Int{ - stateChain1.LinkToken.Address(): DefaultLinkPrice, - stateChain1.Weth9.Address(): DefaultWethPrice, - }, - GasPrices: map[uint64]*big.Int{ - chain2: DefaultGasPrice, - }, - }, - }, - }, - }, - { - Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterDests), - Config: UpdateFeeQuoterDestsConfig{ - UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ - chain1: { - chain2: DefaultFeeQuoterDestChainConfig(), - }, - }, - }, - }, - { - Changeset: commoncs.WrapChangeSet(UpdateOffRampSources), - Config: UpdateOffRampSourcesConfig{ - UpdatesByChain: map[uint64]map[uint64]OffRampSourceUpdate{ - chain2: { - chain1: { - IsEnabled: true, - TestRouter: true, - }, - }, - }, - }, - }, - { - Changeset: commoncs.WrapChangeSet(UpdateRouterRamps), - Config: UpdateRouterRampsConfig{ - TestRouter: true, - UpdatesByChain: map[uint64]RouterUpdates{ - // onRamp update on source chain - chain1: { - OnRampUpdates: map[uint64]bool{ - chain2: true, - }, - }, - // offramp update on dest chain - chain2: { - OffRampUpdates: map[uint64]bool{ - chain1: true, - }, - }, - }, - }, - }, - }) - require.NoError(t, err) + AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, chain1, chain2, true) // Need to keep track of the block number for each chain so that event subscription can be done from that block. startBlocks := make(map[uint64]*uint64) // Send a message from each chain to every other chain. diff --git a/deployment/ccip/changeset/cs_ccip_home_test.go b/deployment/ccip/changeset/cs_ccip_home_test.go index eb22f05a703..884a501ce48 100644 --- a/deployment/ccip/changeset/cs_ccip_home_test.go +++ b/deployment/ccip/changeset/cs_ccip_home_test.go @@ -38,7 +38,7 @@ func Test_PromoteCandidate(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { ctx := testcontext.Get(t) - tenv := NewMemoryEnvironment(t, + tenv, _ := NewMemoryEnvironment(t, WithChains(2), WithNodes(4)) state, err := LoadOnchainState(tenv.Env) @@ -130,7 +130,7 @@ func Test_SetCandidate(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { ctx := testcontext.Get(t) - tenv := NewMemoryEnvironment(t, + tenv, _ := NewMemoryEnvironment(t, WithChains(2), WithNodes(4)) state, err := LoadOnchainState(tenv.Env) @@ -251,7 +251,7 @@ func Test_RevokeCandidate(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { ctx := testcontext.Get(t) - tenv := NewMemoryEnvironment(t, + tenv, _ := NewMemoryEnvironment(t, WithChains(2), WithNodes(4)) state, err := LoadOnchainState(tenv.Env) @@ -442,7 +442,7 @@ func Test_UpdateChainConfigs(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - tenv := NewMemoryEnvironment(t, WithChains(3)) + tenv, _ := NewMemoryEnvironment(t, WithChains(3)) state, err := LoadOnchainState(tenv.Env) require.NoError(t, err) diff --git a/deployment/ccip/changeset/cs_chain_contracts.go b/deployment/ccip/changeset/cs_chain_contracts.go index e87e66e06b5..196de01124b 100644 --- a/deployment/ccip/changeset/cs_chain_contracts.go +++ b/deployment/ccip/changeset/cs_chain_contracts.go @@ -792,8 +792,14 @@ func (cfg UpdateRouterRampsConfig) Validate(e deployment.Environment) error { if chainState.OffRamp == nil { return fmt.Errorf("missing onramp onramp for chain %d", chainSel) } - if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, chainState.Timelock.Address(), chainState.Router); err != nil { - return err + if cfg.TestRouter { + if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, chainState.Timelock.Address(), chainState.TestRouter); err != nil { + return err + } + } else { + if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, chainState.Timelock.Address(), chainState.Router); err != nil { + return err + } } for source := range update.OffRampUpdates { diff --git a/deployment/ccip/changeset/cs_chain_contracts_test.go b/deployment/ccip/changeset/cs_chain_contracts_test.go index adbcc078373..544362a1b1e 100644 --- a/deployment/ccip/changeset/cs_chain_contracts_test.go +++ b/deployment/ccip/changeset/cs_chain_contracts_test.go @@ -32,7 +32,7 @@ func TestUpdateOnRampsDests(t *testing.T) { ctx := testcontext.Get(t) // Default env just has 2 chains with all contracts // deployed but no lanes. - tenv := NewMemoryEnvironment(t) + tenv, _ := NewMemoryEnvironment(t) state, err := LoadOnchainState(tenv.Env) require.NoError(t, err) @@ -106,7 +106,7 @@ func TestUpdateOffRampsSources(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { ctx := testcontext.Get(t) - tenv := NewMemoryEnvironment(t) + tenv, _ := NewMemoryEnvironment(t) state, err := LoadOnchainState(tenv.Env) require.NoError(t, err) @@ -176,7 +176,7 @@ func TestUpdateFQDests(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { ctx := testcontext.Get(t) - tenv := NewMemoryEnvironment(t) + tenv, _ := NewMemoryEnvironment(t) state, err := LoadOnchainState(tenv.Env) require.NoError(t, err) @@ -244,7 +244,7 @@ func TestUpdateRouterRamps(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { ctx := testcontext.Get(t) - tenv := NewMemoryEnvironment(t) + tenv, _ := NewMemoryEnvironment(t) state, err := LoadOnchainState(tenv.Env) require.NoError(t, err) @@ -320,7 +320,7 @@ func TestUpdateNonceManagersCS(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - tenv := NewMemoryEnvironment(t) + tenv, _ := NewMemoryEnvironment(t) state, err := LoadOnchainState(tenv.Env) require.NoError(t, err) diff --git a/deployment/ccip/changeset/cs_deploy_chain_test.go b/deployment/ccip/changeset/cs_deploy_chain_test.go index a72b1b1568b..1f77be3ca5a 100644 --- a/deployment/ccip/changeset/cs_deploy_chain_test.go +++ b/deployment/ccip/changeset/cs_deploy_chain_test.go @@ -101,7 +101,7 @@ func TestDeployChainContractsChangeset(t *testing.T) { func TestDeployCCIPContracts(t *testing.T) { t.Parallel() - e := NewMemoryEnvironment(t) + e, _ := NewMemoryEnvironment(t) // Deploy all the CCIP contracts. state, err := LoadOnchainState(e.Env) require.NoError(t, err) diff --git a/deployment/ccip/changeset/cs_home_chain_test.go b/deployment/ccip/changeset/cs_home_chain_test.go index e96cd878305..135e60f4eb1 100644 --- a/deployment/ccip/changeset/cs_home_chain_test.go +++ b/deployment/ccip/changeset/cs_home_chain_test.go @@ -62,7 +62,7 @@ func TestDeployHomeChain(t *testing.T) { } func TestRemoveDonsValidate(t *testing.T) { - e := NewMemoryEnvironment(t) + e, _ := NewMemoryEnvironment(t) s, err := LoadOnchainState(e.Env) require.NoError(t, err) homeChain := s.Chains[e.HomeChainSel] @@ -117,7 +117,7 @@ func TestRemoveDonsValidate(t *testing.T) { } func TestRemoveDons(t *testing.T) { - e := NewMemoryEnvironment(t) + e, _ := NewMemoryEnvironment(t) s, err := LoadOnchainState(e.Env) require.NoError(t, err) homeChain := s.Chains[e.HomeChainSel] diff --git a/deployment/ccip/changeset/cs_update_rmn_config_test.go b/deployment/ccip/changeset/cs_update_rmn_config_test.go index e7543e22cb7..093fc9e337d 100644 --- a/deployment/ccip/changeset/cs_update_rmn_config_test.go +++ b/deployment/ccip/changeset/cs_update_rmn_config_test.go @@ -65,7 +65,7 @@ func TestUpdateRMNConfig(t *testing.T) { } func updateRMNConfig(t *testing.T, tc updateRMNConfigTestCase) { - e := NewMemoryEnvironment(t) + e, _ := NewMemoryEnvironment(t) state, err := LoadOnchainState(e.Env) require.NoError(t, err) @@ -220,7 +220,7 @@ func buildRMNRemoteAddressPerChain(e deployment.Environment, state CCIPOnChainSt func TestSetRMNRemoteOnRMNProxy(t *testing.T) { t.Parallel() - e := NewMemoryEnvironment(t, WithNoJobsAndContracts()) + e, _ := NewMemoryEnvironment(t, WithNoJobsAndContracts()) allChains := e.Env.AllChainSelectors() mcmsCfg := make(map[uint64]commontypes.MCMSWithTimelockConfig) var err error @@ -265,6 +265,8 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) { CallProxy: state.Chains[chain].CallProxy, } } + envNodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain) + require.NoError(t, err) e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, timelockContractsPerChain, []commonchangeset.ChangesetApplication{ // transfer ownership of RMNProxy to timelock { @@ -274,6 +276,19 @@ func TestSetRMNRemoteOnRMNProxy(t *testing.T) { MinDelay: 0, }, }, + + { + Changeset: commonchangeset.WrapChangeSet(DeployHomeChain), + Config: DeployHomeChainConfig{ + HomeChainSel: e.HomeChainSel, + RMNDynamicConfig: NewTestRMNDynamicConfig(), + RMNStaticConfig: NewTestRMNStaticConfig(), + NodeOperators: NewTestNodeOperator(e.Env.Chains[e.HomeChainSel].DeployerKey.From), + NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{ + "NodeOperator": envNodes.NonBootstraps().PeerIDs(), + }, + }, + }, { Changeset: commonchangeset.WrapChangeSet(DeployChainContracts), Config: DeployChainContractsConfig{ diff --git a/deployment/ccip/changeset/state_test.go b/deployment/ccip/changeset/state_test.go index 3587332fff2..f7d06efa66d 100644 --- a/deployment/ccip/changeset/state_test.go +++ b/deployment/ccip/changeset/state_test.go @@ -7,7 +7,7 @@ import ( ) func TestSmokeState(t *testing.T) { - tenv := NewMemoryEnvironment(t, WithChains(3)) + tenv, _ := NewMemoryEnvironment(t, WithChains(3)) state, err := LoadOnchainState(tenv.Env) require.NoError(t, err) _, err = state.View(tenv.Env.AllChainSelectors()) diff --git a/deployment/ccip/changeset/test_environment.go b/deployment/ccip/changeset/test_environment.go index a1307d9820b..3e23f356857 100644 --- a/deployment/ccip/changeset/test_environment.go +++ b/deployment/ccip/changeset/test_environment.go @@ -42,21 +42,21 @@ type TestConfigs struct { Type EnvType // set by env var CCIP_V16_TEST_ENV, defaults to Memory CreateJob bool // TODO: This should be CreateContracts so the booleans make sense? - CreateJobAndContracts bool - LegacyDeployment bool - Chains int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input - ChainIDs []uint64 // only used in memory mode, for docker mode, this is determined by the integration-test config toml input - NumOfUsersPerChain int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input - Nodes int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input - Bootstraps int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input - IsUSDC bool - IsUSDCAttestationMissing bool - IsMultiCall3 bool - OCRConfigOverride func(CCIPOCRParams) CCIPOCRParams - RMNEnabled bool - NumOfRMNNodes int - LinkPrice *big.Int - WethPrice *big.Int + CreateJobAndContracts bool + PrerequisiteDeploymentOnly bool + Chains int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input + ChainIDs []uint64 // only used in memory mode, for docker mode, this is determined by the integration-test config toml input + NumOfUsersPerChain int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input + Nodes int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input + Bootstraps int // only used in memory mode, for docker mode, this is determined by the integration-test config toml input + IsUSDC bool + IsUSDCAttestationMissing bool + IsMultiCall3 bool + OCRConfigOverride func(CCIPOCRParams) CCIPOCRParams + RMNEnabled bool + NumOfRMNNodes int + LinkPrice *big.Int + WethPrice *big.Int } func (tc *TestConfigs) Validate() error { @@ -106,9 +106,9 @@ func WithMultiCall3() TestOps { } } -func WithLegacyDeployment() TestOps { +func WithPrerequisiteDeployment() TestOps { return func(testCfg *TestConfigs) { - testCfg.LegacyDeployment = true + testCfg.PrerequisiteDeploymentOnly = true } } @@ -183,9 +183,11 @@ func WithBootstraps(numBootstraps int) TestOps { type TestEnvironment interface { SetupJobs(t *testing.T) - StartNodes(t *testing.T, tc *TestConfigs, crConfig deployment.CapabilityRegistryConfig) - StartChains(t *testing.T, tc *TestConfigs) + StartNodes(t *testing.T, crConfig deployment.CapabilityRegistryConfig) + StartChains(t *testing.T) + TestConfigs() *TestConfigs DeployedEnvironment() DeployedEnv + UpdateDeployedEnvironment(env DeployedEnv) MockUSDCAttestationServer(t *testing.T, isUSDCAttestationMissing bool) string } @@ -233,15 +235,25 @@ func (d *DeployedEnv) SetupJobs(t *testing.T) { type MemoryEnvironment struct { DeployedEnv - Chains map[uint64]deployment.Chain + TestConfig *TestConfigs + Chains map[uint64]deployment.Chain +} + +func (m *MemoryEnvironment) TestConfigs() *TestConfigs { + return m.TestConfig } func (m *MemoryEnvironment) DeployedEnvironment() DeployedEnv { return m.DeployedEnv } -func (m *MemoryEnvironment) StartChains(t *testing.T, tc *TestConfigs) { +func (m *MemoryEnvironment) UpdateDeployedEnvironment(env DeployedEnv) { + m.DeployedEnv = env +} + +func (m *MemoryEnvironment) StartChains(t *testing.T) { ctx := testcontext.Get(t) + tc := m.TestConfig var chains map[uint64]deployment.Chain var users map[uint64][]*bind.TransactOpts if len(tc.ChainIDs) > 0 { @@ -273,9 +285,10 @@ func (m *MemoryEnvironment) StartChains(t *testing.T, tc *TestConfigs) { } } -func (m *MemoryEnvironment) StartNodes(t *testing.T, tc *TestConfigs, crConfig deployment.CapabilityRegistryConfig) { +func (m *MemoryEnvironment) StartNodes(t *testing.T, crConfig deployment.CapabilityRegistryConfig) { require.NotNil(t, m.Chains, "start chains first, chains are empty") require.NotNil(t, m.DeployedEnv, "start chains and initiate deployed env first before starting nodes") + tc := m.TestConfig nodes := memory.NewNodes(t, zapcore.InfoLevel, m.Chains, tc.Nodes, tc.Bootstraps, crConfig) ctx := testcontext.Get(t) lggr := logger.Test(t) @@ -298,32 +311,39 @@ func (m *MemoryEnvironment) MockUSDCAttestationServer(t *testing.T, isUSDCAttest } // NewMemoryEnvironment creates an in-memory environment based on the testconfig requested -func NewMemoryEnvironment(t *testing.T, opts ...TestOps) DeployedEnv { +func NewMemoryEnvironment(t *testing.T, opts ...TestOps) (DeployedEnv, TestEnvironment) { testCfg := DefaultTestConfigs() for _, opt := range opts { opt(testCfg) } require.NoError(t, testCfg.Validate(), "invalid test config") - env := &MemoryEnvironment{} - if testCfg.LegacyDeployment { - return NewLegacyEnvironment(t, testCfg, env) + env := &MemoryEnvironment{ + TestConfig: testCfg, + } + if testCfg.PrerequisiteDeploymentOnly { + dEnv := NewEnvironmentWithPrerequisitesContracts(t, env) + env.UpdateDeployedEnvironment(dEnv) + return dEnv, env } if testCfg.CreateJobAndContracts { - return NewEnvironmentWithJobsAndContracts(t, testCfg, env) + dEnv := NewEnvironmentWithJobsAndContracts(t, env) + env.UpdateDeployedEnvironment(dEnv) + return dEnv, env } if testCfg.CreateJob { - return NewEnvironmentWithJobs(t, testCfg, env) + dEnv := NewEnvironmentWithJobs(t, env) + env.UpdateDeployedEnvironment(dEnv) + return dEnv, env } - return NewEnvironment(t, testCfg, env) + dEnv := NewEnvironment(t, env) + env.UpdateDeployedEnvironment(dEnv) + return dEnv, env } -func NewLegacyEnvironment(t *testing.T, tc *TestConfigs, tEnv TestEnvironment) DeployedEnv { +func NewEnvironmentWithPrerequisitesContracts(t *testing.T, tEnv TestEnvironment) DeployedEnv { var err error - tEnv.StartChains(t, tc) - e := tEnv.DeployedEnvironment() - require.NotEmpty(t, e.Env.Chains) - tEnv.StartNodes(t, tc, deployment.CapabilityRegistryConfig{}) - e = tEnv.DeployedEnvironment() + tc := tEnv.TestConfigs() + e := NewEnvironment(t, tEnv) allChains := e.Env.AllChainSelectors() mcmsCfg := make(map[uint64]commontypes.MCMSWithTimelockConfig) @@ -341,6 +361,7 @@ func NewLegacyEnvironment(t *testing.T, tc *TestConfigs, tEnv TestEnvironment) D opts = append(opts, WithMultiCall3Enabled()) } } + // no RMNConfig will ensure that mock RMN is deployed opts = append(opts, WithLegacyDeploymentEnabled(LegacyDeploymentConfig{ PriceRegStalenessThreshold: 60 * 60 * 24 * 14, // two weeks })) @@ -367,40 +388,30 @@ func NewLegacyEnvironment(t *testing.T, tc *TestConfigs, tEnv TestEnvironment) D }, }) require.NoError(t, err) + tEnv.UpdateDeployedEnvironment(e) return e } -func NewEnvironment(t *testing.T, tc *TestConfigs, tEnv TestEnvironment) DeployedEnv { +func NewEnvironment(t *testing.T, tEnv TestEnvironment) DeployedEnv { lggr := logger.Test(t) - tEnv.StartChains(t, tc) + tc := tEnv.TestConfigs() + tEnv.StartChains(t) dEnv := tEnv.DeployedEnvironment() require.NotEmpty(t, dEnv.FeedChainSel) require.NotEmpty(t, dEnv.HomeChainSel) require.NotEmpty(t, dEnv.Env.Chains) ab := deployment.NewMemoryAddressBook() crConfig := DeployTestContracts(t, lggr, ab, dEnv.HomeChainSel, dEnv.FeedChainSel, dEnv.Env.Chains, tc.LinkPrice, tc.WethPrice) - tEnv.StartNodes(t, tc, crConfig) + tEnv.StartNodes(t, crConfig) dEnv = tEnv.DeployedEnvironment() - // TODO: Should use ApplyChangesets here. - envNodes, err := deployment.NodeInfo(dEnv.Env.NodeIDs, dEnv.Env.Offchain) - require.NoError(t, err) dEnv.Env.ExistingAddresses = ab - _, err = deployHomeChain(lggr, dEnv.Env, dEnv.Env.ExistingAddresses, dEnv.Env.Chains[dEnv.HomeChainSel], - NewTestRMNStaticConfig(), - NewTestRMNDynamicConfig(), - NewTestNodeOperator(dEnv.Env.Chains[dEnv.HomeChainSel].DeployerKey.From), - map[string][][32]byte{ - "NodeOperator": envNodes.NonBootstraps().PeerIDs(), - }, - ) - require.NoError(t, err) - return dEnv } -func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv TestEnvironment) DeployedEnv { +func NewEnvironmentWithJobsAndContracts(t *testing.T, tEnv TestEnvironment) DeployedEnv { var err error - e := NewEnvironment(t, tc, tEnv) + tc := tEnv.TestConfigs() + e := NewEnvironment(t, tEnv) allChains := e.Env.AllChainSelectors() mcmsCfg := make(map[uint64]commontypes.MCMSWithTimelockConfig) @@ -441,6 +452,43 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test Changeset: commonchangeset.WrapChangeSet(commonchangeset.DeployMCMSWithTimelock), Config: mcmsCfg, }, + }) + require.NoError(t, err) + tEnv.UpdateDeployedEnvironment(e) + e = AddCCIPContractsToEnvironment(t, e.Env.AllChainSelectors(), tEnv) + // now we update RMNProxy to point to RMNRemote + e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, nil, []commonchangeset.ChangesetApplication{ + { + Changeset: commonchangeset.WrapChangeSet(SetRMNRemoteOnRMNProxy), + Config: SetRMNRemoteOnRMNProxyConfig{ + ChainSelectors: allChains, + }, + }, + }) + require.NoError(t, err) + return e +} + +func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEnvironment) DeployedEnv { + tc := tEnv.TestConfigs() + e := tEnv.DeployedEnvironment() + envNodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain) + require.NoError(t, err) + // Need to deploy prerequisites first so that we can form the USDC config + // no proposals to be made, timelock can be passed as nil here + e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, nil, []commonchangeset.ChangesetApplication{ + { + Changeset: commonchangeset.WrapChangeSet(DeployHomeChain), + Config: DeployHomeChainConfig{ + HomeChainSel: e.HomeChainSel, + RMNDynamicConfig: NewTestRMNDynamicConfig(), + RMNStaticConfig: NewTestRMNStaticConfig(), + NodeOperators: NewTestNodeOperator(e.Env.Chains[e.HomeChainSel].DeployerKey.From), + NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{ + TestNodeOperator: envNodes.NonBootstraps().PeerIDs(), + }, + }, + }, { Changeset: commonchangeset.WrapChangeSet(DeployChainContracts), Config: DeployChainContractsConfig{ @@ -448,12 +496,6 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test HomeChainSelector: e.HomeChainSel, }, }, - { - Changeset: commonchangeset.WrapChangeSet(SetRMNRemoteOnRMNProxy), - Config: SetRMNRemoteOnRMNProxyConfig{ - ChainSelectors: allChains, - }, - }, }) require.NoError(t, err) @@ -600,13 +642,14 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test require.NotNil(t, state.Chains[chain].OffRamp) require.NotNil(t, state.Chains[chain].OnRamp) } + tEnv.UpdateDeployedEnvironment(e) return e } // NewEnvironmentWithJobs creates a new CCIP environment // with capreg, fee tokens, feeds, nodes and jobs set up. -func NewEnvironmentWithJobs(t *testing.T, tc *TestConfigs, tEnv TestEnvironment) DeployedEnv { - e := NewEnvironment(t, tc, tEnv) +func NewEnvironmentWithJobs(t *testing.T, tEnv TestEnvironment) DeployedEnv { + e := NewEnvironment(t, tEnv) e.SetupJobs(t) return e } diff --git a/deployment/ccip/changeset/test_params.go b/deployment/ccip/changeset/test_params.go index a76a610a178..90331b50675 100644 --- a/deployment/ccip/changeset/test_params.go +++ b/deployment/ccip/changeset/test_params.go @@ -7,6 +7,10 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" ) +const ( + TestNodeOperator = "NodeOperator" +) + func NewTestRMNStaticConfig() rmn_home.RMNHomeStaticConfig { return rmn_home.RMNHomeStaticConfig{ Nodes: []rmn_home.RMNHomeNode{}, @@ -25,7 +29,7 @@ func NewTestNodeOperator(admin common.Address) []capabilities_registry.Capabilit return []capabilities_registry.CapabilitiesRegistryNodeOperator{ { Admin: admin, - Name: "NodeOperator", + Name: TestNodeOperator, }, } } diff --git a/deployment/ccip/changeset/v1_5/e2e_test.go b/deployment/ccip/changeset/v1_5/e2e_test.go index 11bb566c641..2019758b179 100644 --- a/deployment/ccip/changeset/v1_5/e2e_test.go +++ b/deployment/ccip/changeset/v1_5/e2e_test.go @@ -15,9 +15,9 @@ import ( // This test only works if the destination chain id is 1337 // Otherwise it shows error for offchain and onchain config digest mismatch func TestE2ELegacy(t *testing.T) { - e := changeset.NewMemoryEnvironment( + e, _ := changeset.NewMemoryEnvironment( t, - changeset.WithLegacyDeployment(), + changeset.WithPrerequisiteDeployment(), changeset.WithChains(3), changeset.WithChainIds([]uint64{chainselectors.GETH_TESTNET.EvmChainID})) state, err := changeset.LoadOnchainState(e.Env) diff --git a/deployment/ccip/changeset/view_test.go b/deployment/ccip/changeset/view_test.go index 35193979849..16d1f8a0dfc 100644 --- a/deployment/ccip/changeset/view_test.go +++ b/deployment/ccip/changeset/view_test.go @@ -8,7 +8,7 @@ import ( func TestSmokeView(t *testing.T) { t.Parallel() - tenv := NewMemoryEnvironment(t, WithChains(3)) + tenv, _ := NewMemoryEnvironment(t, WithChains(3)) _, err := ViewCCIP(tenv.Env) require.NoError(t, err) } diff --git a/deployment/common/changeset/transfer_to_mcms_with_timelock.go b/deployment/common/changeset/transfer_to_mcms_with_timelock.go index ab0883cc9a7..da932a95b01 100644 --- a/deployment/common/changeset/transfer_to_mcms_with_timelock.go +++ b/deployment/common/changeset/transfer_to_mcms_with_timelock.go @@ -40,7 +40,7 @@ func LoadOwnableContract(addr common.Address, client bind.ContractBackend) (comm } owner, err := c.Owner(nil) if err != nil { - return common.Address{}, nil, fmt.Errorf("failed to get owner of contract: %w", err) + return common.Address{}, nil, fmt.Errorf("failed to get owner of contract %s: %w", c.Address(), err) } return owner, c, nil } diff --git a/deployment/go.mod b/deployment/go.mod index 9595794978c..2daefd78f11 100644 --- a/deployment/go.mod +++ b/deployment/go.mod @@ -29,7 +29,7 @@ require ( github.com/sethvargo/go-retry v0.2.4 github.com/smartcontractkit/ccip-owner-contracts v0.0.0-salt-fix github.com/smartcontractkit/chain-selectors v1.0.36 - github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba + github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 diff --git a/deployment/go.sum b/deployment/go.sum index 4800155620c..5e7d0ad9ced 100644 --- a/deployment/go.sum +++ b/deployment/go.sum @@ -1384,8 +1384,8 @@ github.com/smartcontractkit/chain-selectors v1.0.36 h1:KSpO8I+JOiuyN4FuXsV471sPo github.com/smartcontractkit/chain-selectors v1.0.36/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba h1:gisAer1YxKKui6LhxDgfuZ3OyrHVjHm/oK/0idusFeI= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 h1:TeWnxdgSO2cYCKcBMwdkRcs/YdhSvXoWqqw7QWz/KeI= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b h1:UBXi9Yj8YSMHDDaxQLu273x1fWjyEL9xP58nuJsqZfg= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60= github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e h1:8BStiP1F4W8AvjBRga0TYtjvAtkwN8oHYnHJztAlSF4= diff --git a/go.mod b/go.mod index ccedade99b3..3d4c747034e 100644 --- a/go.mod +++ b/go.mod @@ -78,7 +78,7 @@ require ( github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chain-selectors v1.0.34 github.com/smartcontractkit/chainlink-automation v0.8.1 - github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba + github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 diff --git a/go.sum b/go.sum index 6e8c1b4b5f3..44fb07ef951 100644 --- a/go.sum +++ b/go.sum @@ -1150,8 +1150,8 @@ github.com/smartcontractkit/chain-selectors v1.0.34 h1:MJ17OGu8+jjl426pcKrJkCf3f github.com/smartcontractkit/chain-selectors v1.0.34/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba h1:gisAer1YxKKui6LhxDgfuZ3OyrHVjHm/oK/0idusFeI= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 h1:TeWnxdgSO2cYCKcBMwdkRcs/YdhSvXoWqqw7QWz/KeI= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e h1:8BStiP1F4W8AvjBRga0TYtjvAtkwN8oHYnHJztAlSF4= github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e h1:PRoeby6ZlTuTkv2f+7tVU4+zboTfRzI+beECynF4JQ0= diff --git a/integration-tests/contracts/ccipreader_test.go b/integration-tests/contracts/ccipreader_test.go index ace0783365c..b7ea027a568 100644 --- a/integration-tests/contracts/ccipreader_test.go +++ b/integration-tests/contracts/ccipreader_test.go @@ -590,7 +590,7 @@ func TestCCIPReader_GetExpectedNextSequenceNumber(t *testing.T) { t.Parallel() ctx := tests.Context(t) //env := NewMemoryEnvironmentContractsOnly(t, logger.TestLogger(t), 2, 4, nil) - env := changeset.NewMemoryEnvironment(t) + env, _ := changeset.NewMemoryEnvironment(t) state, err := changeset.LoadOnchainState(env.Env) require.NoError(t, err) @@ -700,7 +700,7 @@ func TestCCIPReader_Nonces(t *testing.T) { func Test_GetChainFeePriceUpdates(t *testing.T) { t.Parallel() ctx := tests.Context(t) - env := changeset.NewMemoryEnvironment(t) + env, _ := changeset.NewMemoryEnvironment(t) state, err := changeset.LoadOnchainState(env.Env) require.NoError(t, err) @@ -756,7 +756,7 @@ func Test_GetChainFeePriceUpdates(t *testing.T) { func Test_LinkPriceUSD(t *testing.T) { t.Parallel() ctx := tests.Context(t) - env := changeset.NewMemoryEnvironment(t) + env, _ := changeset.NewMemoryEnvironment(t) state, err := changeset.LoadOnchainState(env.Env) require.NoError(t, err) @@ -791,7 +791,7 @@ func Test_LinkPriceUSD(t *testing.T) { func Test_GetMedianDataAvailabilityGasConfig(t *testing.T) { t.Parallel() ctx := tests.Context(t) - env := changeset.NewMemoryEnvironment(t, changeset.WithChains(4)) + env, _ := changeset.NewMemoryEnvironment(t, changeset.WithChains(4)) state, err := changeset.LoadOnchainState(env.Env) require.NoError(t, err) @@ -850,7 +850,7 @@ func Test_GetMedianDataAvailabilityGasConfig(t *testing.T) { func Test_GetWrappedNativeTokenPriceUSD(t *testing.T) { t.Parallel() ctx := tests.Context(t) - env := changeset.NewMemoryEnvironment(t) + env, _ := changeset.NewMemoryEnvironment(t) state, err := changeset.LoadOnchainState(env.Env) require.NoError(t, err) diff --git a/integration-tests/go.mod b/integration-tests/go.mod index bb1952af8f3..cc161d6b92a 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -46,7 +46,7 @@ require ( github.com/slack-go/slack v0.15.0 github.com/smartcontractkit/chain-selectors v1.0.36 github.com/smartcontractkit/chainlink-automation v0.8.1 - github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba + github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 2377fe29ce3..52c0922d743 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1408,8 +1408,8 @@ github.com/smartcontractkit/chain-selectors v1.0.36 h1:KSpO8I+JOiuyN4FuXsV471sPo github.com/smartcontractkit/chain-selectors v1.0.36/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba h1:gisAer1YxKKui6LhxDgfuZ3OyrHVjHm/oK/0idusFeI= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 h1:TeWnxdgSO2cYCKcBMwdkRcs/YdhSvXoWqqw7QWz/KeI= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b h1:UBXi9Yj8YSMHDDaxQLu273x1fWjyEL9xP58nuJsqZfg= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60= github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e h1:8BStiP1F4W8AvjBRga0TYtjvAtkwN8oHYnHJztAlSF4= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 2c0703ed3b5..fbf204e160d 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -410,7 +410,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/chain-selectors v1.0.36 // indirect github.com/smartcontractkit/chainlink-automation v0.8.1 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 // indirect github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e // indirect github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 // indirect github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 036b3992aaf..0ed3bcbf368 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1397,8 +1397,8 @@ github.com/smartcontractkit/chain-selectors v1.0.36 h1:KSpO8I+JOiuyN4FuXsV471sPo github.com/smartcontractkit/chain-selectors v1.0.36/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba h1:gisAer1YxKKui6LhxDgfuZ3OyrHVjHm/oK/0idusFeI= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20250109124515-ff9d86b874ba/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103 h1:TeWnxdgSO2cYCKcBMwdkRcs/YdhSvXoWqqw7QWz/KeI= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20250110181647-9dba278f2103/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b h1:UBXi9Yj8YSMHDDaxQLu273x1fWjyEL9xP58nuJsqZfg= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250103152858-8973fd0c912b/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60= github.com/smartcontractkit/chainlink-common v0.4.1-0.20250108194320-2ebd63bbb16e h1:8BStiP1F4W8AvjBRga0TYtjvAtkwN8oHYnHJztAlSF4= diff --git a/integration-tests/smoke/ccip/ccip_batching_test.go b/integration-tests/smoke/ccip/ccip_batching_test.go index 3752faa4e6e..6c204fa45a3 100644 --- a/integration-tests/smoke/ccip/ccip_batching_test.go +++ b/integration-tests/smoke/ccip/ccip_batching_test.go @@ -39,7 +39,7 @@ type batchTestSetup struct { func newBatchTestSetup(t *testing.T) batchTestSetup { // Setup 3 chains, with 2 lanes going to the dest. - e, _ := testsetups.NewIntegrationEnvironment( + e, _, _ := testsetups.NewIntegrationEnvironment( t, changeset.WithMultiCall3(), changeset.WithChains(3), diff --git a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go index 3b0ebf22455..49f603a39f4 100644 --- a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go +++ b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go @@ -34,7 +34,7 @@ var ( ) func Test_CCIPFeeBoosting(t *testing.T) { - e, _ := testsetups.NewIntegrationEnvironment( + e, _, _ := testsetups.NewIntegrationEnvironment( t, changeset.WithOCRConfigOverride(func(params changeset.CCIPOCRParams) changeset.CCIPOCRParams { // Only 1 boost (=OCR round) is enough to cover the fee diff --git a/integration-tests/smoke/ccip/ccip_fees_test.go b/integration-tests/smoke/ccip/ccip_fees_test.go index 57a6bc58d82..d0f9cc71683 100644 --- a/integration-tests/smoke/ccip/ccip_fees_test.go +++ b/integration-tests/smoke/ccip/ccip_fees_test.go @@ -101,7 +101,7 @@ func setupTokens( func Test_CCIPFees(t *testing.T) { t.Parallel() - tenv, _ := testsetups.NewIntegrationEnvironment( + tenv, _, _ := testsetups.NewIntegrationEnvironment( t, changeset.WithMultiCall3(), ) diff --git a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go index 2c1d97f6c12..09023f1d321 100644 --- a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go @@ -26,7 +26,7 @@ func Test_CCIPGasPriceUpdates(t *testing.T) { callOpts := &bind.CallOpts{Context: ctx} var gasPriceExpiry = 5 * time.Second - e, _ := testsetups.NewIntegrationEnvironment(t, + e, _, _ := testsetups.NewIntegrationEnvironment(t, changeset.WithOCRConfigOverride(func(params changeset.CCIPOCRParams) changeset.CCIPOCRParams { params.CommitOffChainConfig.RemoteGasPriceBatchWriteFrequency = *config.MustNewDuration(gasPriceExpiry) return params diff --git a/integration-tests/smoke/ccip/ccip_legacy_test.go b/integration-tests/smoke/ccip/ccip_legacy_test.go deleted file mode 100644 index 2b5b6d77b58..00000000000 --- a/integration-tests/smoke/ccip/ccip_legacy_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package smoke - -import ( - "context" - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5" - testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" -) - -// This test does not run in CI, it is only written as an example of how to write a test for the legacy CCIP -func TestE2ELegacy(t *testing.T) { - e, _ := testsetups.NewIntegrationEnvironment(t, changeset.WithLegacyDeployment()) - state, err := changeset.LoadOnchainState(e.Env) - require.NoError(t, err) - allChains := e.Env.AllChainSelectors() - require.Len(t, allChains, 2) - src, dest := allChains[0], allChains[1] - srcChain := e.Env.Chains[src] - destChain := e.Env.Chains[dest] - pairs := []changeset.SourceDestPair{ - {SourceChainSelector: src, DestChainSelector: dest}, - } - e.Env = v1_5.AddLanes(t, e.Env, state, pairs) - // reload state after adding lanes - state, err = changeset.LoadOnchainState(e.Env) - require.NoError(t, err) - sentEvent, err := v1_5.SendRequest(t, e.Env, state, - changeset.WithSourceChain(src), - changeset.WithDestChain(dest), - changeset.WithTestRouter(false), - changeset.WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), - Data: []byte("hello"), - TokenAmounts: nil, - FeeToken: common.HexToAddress("0x0"), - ExtraArgs: nil, - }), - ) - require.NoError(t, err) - require.NotNil(t, sentEvent) - destStartBlock, err := destChain.Client.HeaderByNumber(context.Background(), nil) - require.NoError(t, err) - v1_5.WaitForCommit(t, srcChain, destChain, state.Chains[dest].CommitStore[src], sentEvent.Message.SequenceNumber) - v1_5.WaitForExecute(t, srcChain, destChain, state.Chains[dest].EVM2EVMOffRamp[src], []uint64{sentEvent.Message.SequenceNumber}, destStartBlock.Number.Uint64()) -} diff --git a/integration-tests/smoke/ccip/ccip_message_limitations_test.go b/integration-tests/smoke/ccip/ccip_message_limitations_test.go index f9299b735d0..2882a34af63 100644 --- a/integration-tests/smoke/ccip/ccip_message_limitations_test.go +++ b/integration-tests/smoke/ccip/ccip_message_limitations_test.go @@ -23,7 +23,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { ctx := testcontext.Get(t) callOpts := &bind.CallOpts{Context: ctx} - testEnv, _ := testsetups.NewIntegrationEnvironment(t) + testEnv, _, _ := testsetups.NewIntegrationEnvironment(t) chains := maps.Keys(testEnv.Env.Chains) onChainState, err := changeset.LoadOnchainState(testEnv.Env) diff --git a/integration-tests/smoke/ccip/ccip_messaging_test.go b/integration-tests/smoke/ccip/ccip_messaging_test.go index 8ee18a31918..f010bab5ee1 100644 --- a/integration-tests/smoke/ccip/ccip_messaging_test.go +++ b/integration-tests/smoke/ccip/ccip_messaging_test.go @@ -47,7 +47,7 @@ type messagingTestCaseOutput struct { func Test_CCIPMessaging(t *testing.T) { // Setup 2 chains and a single lane. ctx := changeset.Context(t) - e, _ := testsetups.NewIntegrationEnvironment(t) + e, _, _ := testsetups.NewIntegrationEnvironment(t) state, err := changeset.LoadOnchainState(e.Env) require.NoError(t, err) diff --git a/integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go b/integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go new file mode 100644 index 00000000000..0559054f2d6 --- /dev/null +++ b/integration-tests/smoke/ccip/ccip_migration_to_v_1_6_test.go @@ -0,0 +1,317 @@ +package smoke + +import ( + "context" + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + + chainselectors "github.com/smartcontractkit/chain-selectors" + + "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" + "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5" + commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" + testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" +) + +func TestMigrateFromV1_5ToV1_6(t *testing.T) { + // Deploy CCIP 1.5 with 3 chains and 4 nodes + 1 bootstrap + // Deploy 1.5 contracts (excluding pools and real RMN, use MockRMN to start, but including MCMS) . + e, _, tEnv := testsetups.NewIntegrationEnvironment( + t, + changeset.WithPrerequisiteDeployment(), + changeset.WithChains(3), + changeset.WithUsersPerChain(2), + // for in-memory test it is important to set the dest chain id as 1337 otherwise the config digest will not match + // between nodes' calculated digest and the digest set on the contract + changeset.WithChainIds([]uint64{chainselectors.GETH_TESTNET.EvmChainID}), + ) + state, err := changeset.LoadOnchainState(e.Env) + require.NoError(t, err) + allChainsExcept1337 := e.Env.AllChainSelectorsExcluding([]uint64{chainselectors.GETH_TESTNET.Selector}) + require.Contains(t, e.Env.AllChainSelectors(), chainselectors.GETH_TESTNET.Selector) + require.Len(t, allChainsExcept1337, 2) + src1, src2, dest := allChainsExcept1337[0], allChainsExcept1337[1], chainselectors.GETH_TESTNET.Selector + pairs := []changeset.SourceDestPair{ + // as mentioned in the comment above, the dest chain id should be 1337 + {SourceChainSelector: src1, DestChainSelector: dest}, + {SourceChainSelector: src2, DestChainSelector: dest}, + } + // wire up all lanes + // deploy onRamp, commit store, offramp , set ocr2config and send corresponding jobs + e.Env = v1_5.AddLanes(t, e.Env, state, pairs) + + // reload state after adding lanes + state, err = changeset.LoadOnchainState(e.Env) + require.NoError(t, err) + tEnv.UpdateDeployedEnvironment(e) + // ensure that all lanes are functional + for _, pair := range pairs { + sentEvent, err := v1_5.SendRequest(t, e.Env, state, + changeset.WithSourceChain(pair.SourceChainSelector), + changeset.WithDestChain(pair.DestChainSelector), + changeset.WithTestRouter(false), + changeset.WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ + Receiver: common.LeftPadBytes(state.Chains[pair.DestChainSelector].Receiver.Address().Bytes(), 32), + Data: []byte("hello"), + TokenAmounts: nil, + FeeToken: common.HexToAddress("0x0"), + ExtraArgs: nil, + }), + ) + require.NoError(t, err) + require.NotNil(t, sentEvent) + destChain := e.Env.Chains[pair.DestChainSelector] + destStartBlock, err := destChain.Client.HeaderByNumber(context.Background(), nil) + require.NoError(t, err) + v1_5.WaitForCommit(t, e.Env.Chains[pair.SourceChainSelector], destChain, state.Chains[dest].CommitStore[src1], sentEvent.Message.SequenceNumber) + v1_5.WaitForExecute(t, e.Env.Chains[pair.SourceChainSelector], destChain, state.Chains[dest].EVM2EVMOffRamp[src1], []uint64{sentEvent.Message.SequenceNumber}, destStartBlock.Number.Uint64()) + } + + // now that all 1.5 lanes work transfer ownership of the contracts to MCMS + contractsByChain := make(map[uint64][]common.Address) + for _, chain := range e.Env.AllChainSelectors() { + contractsByChain[chain] = []common.Address{ + state.Chains[chain].Router.Address(), + state.Chains[chain].RMNProxy.Address(), + state.Chains[chain].PriceRegistry.Address(), + state.Chains[chain].TokenAdminRegistry.Address(), + state.Chains[chain].MockRMN.Address(), + } + if state.Chains[chain].EVM2EVMOnRamp != nil { + for _, onRamp := range state.Chains[chain].EVM2EVMOnRamp { + contractsByChain[chain] = append(contractsByChain[chain], onRamp.Address()) + } + } + if state.Chains[chain].EVM2EVMOffRamp != nil { + for _, offRamp := range state.Chains[chain].EVM2EVMOffRamp { + contractsByChain[chain] = append(contractsByChain[chain], offRamp.Address()) + } + } + } + + e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commonchangeset.ChangesetApplication{ + { + Changeset: commonchangeset.WrapChangeSet(commonchangeset.TransferToMCMSWithTimelock), + Config: commonchangeset.TransferToMCMSWithTimelockConfig{ + ContractsByChain: contractsByChain, + MinDelay: 0, + }, + }, + }) + require.NoError(t, err) + // add 1.6 contracts to the environment and send 1.6 jobs + // First we need to deploy Homechain contracts and restart the nodes with updated cap registry + // in this test we have already deployed home chain contracts and the nodes are already running with the deployed cap registry. + e = changeset.AddCCIPContractsToEnvironment(t, e.Env.AllChainSelectors(), tEnv) + // Set RMNProxy to point to RMNRemote. + // nonce manager should point to 1.5 ramps + e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commonchangeset.ChangesetApplication{ + { + // as we have already transferred ownership for RMNProxy to MCMS, it needs to be done via MCMS proposal + Changeset: commonchangeset.WrapChangeSet(changeset.SetRMNRemoteOnRMNProxy), + Config: changeset.SetRMNRemoteOnRMNProxyConfig{ + ChainSelectors: e.Env.AllChainSelectors(), + MCMSConfig: &changeset.MCMSConfig{ + MinDelay: 0, + }, + }, + }, + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateNonceManagersCS), + Config: changeset.UpdateNonceManagerConfig{ + // we only have lanes between src1 --> dest + UpdatesByChain: map[uint64]changeset.NonceManagerUpdate{ + src1: { + PreviousRampsArgs: []changeset.PreviousRampCfg{ + { + RemoteChainSelector: dest, + EnableOnRamp: true, + }, + }, + }, + src2: { + PreviousRampsArgs: []changeset.PreviousRampCfg{ + { + RemoteChainSelector: dest, + EnableOnRamp: true, + }, + }, + }, + dest: { + PreviousRampsArgs: []changeset.PreviousRampCfg{ + { + RemoteChainSelector: src1, + EnableOffRamp: true, + }, + { + RemoteChainSelector: src2, + EnableOffRamp: true, + }, + }, + }, + }, + }, + }, + }) + require.NoError(t, err) + state, err = changeset.LoadOnchainState(e.Env) + require.NoError(t, err) + + // Enable a single 1.6 lane with test router + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, src1, dest, true) + require.GreaterOrEqual(t, len(e.Users[src1]), 2) + startBlocks := make(map[uint64]*uint64) + latesthdr, err := e.Env.Chains[dest].Client.HeaderByNumber(testcontext.Get(t), nil) + require.NoError(t, err) + block := latesthdr.Number.Uint64() + startBlocks[dest] = &block + expectedSeqNumExec := make(map[changeset.SourceDestPair][]uint64) + msgSentEvent, err := changeset.DoSendRequest( + t, e.Env, state, + changeset.WithSourceChain(src1), + changeset.WithDestChain(dest), + changeset.WithTestRouter(true), + // Send traffic across single 1.6 lane with a DIFFERENT ( very important to not mess with real sender nonce) sender + // from test router to ensure 1.6 is working. + changeset.WithSender(e.Users[src1][1]), + changeset.WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ + Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), + Data: []byte("hello"), + TokenAmounts: nil, + FeeToken: common.HexToAddress("0x0"), + ExtraArgs: nil, + })) + require.NoError(t, err) + + expectedSeqNumExec[changeset.SourceDestPair{ + SourceChainSelector: src1, + DestChainSelector: dest, + }] = []uint64{msgSentEvent.SequenceNumber} + + // Wait for all exec reports to land + changeset.ConfirmExecWithSeqNrsForAll(t, e.Env, state, expectedSeqNumExec, startBlocks) + + // send a message from real router, the send requested event should be received in 1.5 onRamp + // the request should get delivered to 1.5 offRamp + sentEventBeforeSwitch, err := v1_5.SendRequest(t, e.Env, state, + changeset.WithSourceChain(src1), + changeset.WithDestChain(dest), + changeset.WithTestRouter(false), + changeset.WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ + Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), + Data: []byte("hello"), + TokenAmounts: nil, + FeeToken: common.HexToAddress("0x0"), + ExtraArgs: nil, + }), + ) + require.NoError(t, err) + require.NotNil(t, sentEventBeforeSwitch) + + // now that the 1.6 lane is working, we can enable the real router + e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commonchangeset.ChangesetApplication{ + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateOnRampsDests), + Config: changeset.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{ + src1: { + dest: { + IsEnabled: true, + TestRouter: false, + AllowListEnabled: false, + }, + }, + }, + }, + }, + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateOffRampSources), + Config: changeset.UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]changeset.OffRampSourceUpdate{ + dest: { + src1: { + IsEnabled: true, + TestRouter: false, + }, + }, + }, + }, + }, + { + // this needs to be MCMS proposal as the router contract is owned by MCMS + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateRouterRamps), + Config: changeset.UpdateRouterRampsConfig{ + TestRouter: false, + MCMS: &changeset.MCMSConfig{ + MinDelay: 0, + }, + UpdatesByChain: map[uint64]changeset.RouterUpdates{ + // onRamp update on source chain + src1: { + OnRampUpdates: map[uint64]bool{ + dest: true, + }, + }, + // offramp update on dest chain + dest: { + OffRampUpdates: map[uint64]bool{ + src1: true, + }, + }, + }, + }, + }, + }) + require.NoError(t, err) + + // send a message from real router the send requested event should be received in 1.6 onRamp + // the request should get delivered to 1.6 offRamp + destStartBlock, err := e.Env.Chains[dest].Client.HeaderByNumber(context.Background(), nil) + require.NoError(t, err) + sentEventAfterSwitch, err := changeset.DoSendRequest( + t, e.Env, state, + changeset.WithSourceChain(src1), + changeset.WithDestChain(dest), + changeset.WithTestRouter(false), + changeset.WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ + Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), + Data: []byte("hello"), + TokenAmounts: nil, + FeeToken: common.HexToAddress("0x0"), + ExtraArgs: nil, + })) + require.NoError(t, err) + // verify that before switch message is received in 1.5 offRamp + v1_5.WaitForExecute(t, e.Env.Chains[src1], e.Env.Chains[dest], state.Chains[dest].EVM2EVMOffRamp[src1], + []uint64{sentEventBeforeSwitch.Message.SequenceNumber}, destStartBlock.Number.Uint64()) + + // verify that after switch message is received in 1.6 offRamp + expectedSeqNumExec[changeset.SourceDestPair{ + SourceChainSelector: src1, + DestChainSelector: dest, + }] = []uint64{sentEventAfterSwitch.SequenceNumber} + changeset.ConfirmExecWithSeqNrsForAll(t, e.Env, state, expectedSeqNumExec, startBlocks) + + // confirm that the other lane src2->dest is still working with v1.5 + sentEventOnOtherLane, err := v1_5.SendRequest(t, e.Env, state, + changeset.WithSourceChain(src2), + changeset.WithDestChain(dest), + changeset.WithTestRouter(false), + changeset.WithEvm2AnyMessage(router.ClientEVM2AnyMessage{ + Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32), + Data: []byte("hello"), + TokenAmounts: nil, + FeeToken: common.HexToAddress("0x0"), + ExtraArgs: nil, + }), + ) + require.NoError(t, err) + require.NotNil(t, sentEventOnOtherLane) + v1_5.WaitForExecute(t, e.Env.Chains[src2], e.Env.Chains[dest], state.Chains[dest].EVM2EVMOffRamp[src2], + []uint64{sentEventOnOtherLane.Message.SequenceNumber}, destStartBlock.Number.Uint64()) +} diff --git a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go index e3da473984d..272c87e9996 100644 --- a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go +++ b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go @@ -33,7 +33,7 @@ import ( func Test_OutOfOrderExecution(t *testing.T) { lggr := logger.TestLogger(t) ctx := tests.Context(t) - tenv, _ := testsetups.NewIntegrationEnvironment( + tenv, _, _ := testsetups.NewIntegrationEnvironment( t, changeset.WithUSDC(), changeset.WithUSDCAttestationMissing(), diff --git a/integration-tests/smoke/ccip/ccip_rmn_test.go b/integration-tests/smoke/ccip/ccip_rmn_test.go index 7036260d130..67f99cd5a7b 100644 --- a/integration-tests/smoke/ccip/ccip_rmn_test.go +++ b/integration-tests/smoke/ccip/ccip_rmn_test.go @@ -247,7 +247,7 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { ctx := testcontext.Get(t) t.Logf("Running RMN test case: %s", tc.name) - envWithRMN, rmnCluster := testsetups.NewIntegrationEnvironment(t, + envWithRMN, rmnCluster, _ := testsetups.NewIntegrationEnvironment(t, changeset.WithRMNEnabled(len(tc.rmnNodes)), ) t.Logf("envWithRmn: %#v", envWithRMN) diff --git a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go index fb7ddc847d4..e54790de24c 100644 --- a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go @@ -28,7 +28,7 @@ func Test_CCIPTokenPriceUpdates(t *testing.T) { callOpts := &bind.CallOpts{Context: ctx} var tokenPriceExpiry = 5 * time.Second - e, _ := testsetups.NewIntegrationEnvironment(t, + e, _, _ := testsetups.NewIntegrationEnvironment(t, changeset.WithOCRConfigOverride(func(params changeset.CCIPOCRParams) changeset.CCIPOCRParams { params.CommitOffChainConfig.TokenPriceBatchWriteFrequency = *config.MustNewDuration(tokenPriceExpiry) return params diff --git a/integration-tests/smoke/ccip/ccip_token_transfer_test.go b/integration-tests/smoke/ccip/ccip_token_transfer_test.go index c5cabfe63e4..7946d6f8c7c 100644 --- a/integration-tests/smoke/ccip/ccip_token_transfer_test.go +++ b/integration-tests/smoke/ccip/ccip_token_transfer_test.go @@ -22,7 +22,7 @@ func TestTokenTransfer(t *testing.T) { lggr := logger.TestLogger(t) ctx := tests.Context(t) - tenv, _ := testsetups.NewIntegrationEnvironment(t, + tenv, _, _ := testsetups.NewIntegrationEnvironment(t, changeset.WithUsersPerChain(3)) e := tenv.Env diff --git a/integration-tests/smoke/ccip/ccip_usdc_test.go b/integration-tests/smoke/ccip/ccip_usdc_test.go index 7bea68a9cbf..33af1570943 100644 --- a/integration-tests/smoke/ccip/ccip_usdc_test.go +++ b/integration-tests/smoke/ccip/ccip_usdc_test.go @@ -32,7 +32,7 @@ import ( func TestUSDCTokenTransfer(t *testing.T) { lggr := logger.TestLogger(t) ctx := tests.Context(t) - tenv, _ := testsetups.NewIntegrationEnvironment(t, + tenv, _, _ := testsetups.NewIntegrationEnvironment(t, changeset.WithUsersPerChain(3), changeset.WithChains(3), changeset.WithUSDC(), diff --git a/integration-tests/testsetups/ccip/test_helpers.go b/integration-tests/testsetups/ccip/test_helpers.go index 6725ac1df9b..889c6b1cdf5 100644 --- a/integration-tests/testsetups/ccip/test_helpers.go +++ b/integration-tests/testsetups/ccip/test_helpers.go @@ -53,17 +53,26 @@ import ( // DeployedLocalDevEnvironment is a helper struct for setting up a local dev environment with docker type DeployedLocalDevEnvironment struct { changeset.DeployedEnv - testEnv *test_env.CLClusterTestEnv - DON *devenv.DON - devEnvTestCfg tc.TestConfig - devEnvCfg *devenv.EnvironmentConfig + testEnv *test_env.CLClusterTestEnv + DON *devenv.DON + GenericTCConfig *changeset.TestConfigs + devEnvTestCfg tc.TestConfig + devEnvCfg *devenv.EnvironmentConfig } func (l *DeployedLocalDevEnvironment) DeployedEnvironment() changeset.DeployedEnv { return l.DeployedEnv } -func (l *DeployedLocalDevEnvironment) StartChains(t *testing.T, _ *changeset.TestConfigs) { +func (l *DeployedLocalDevEnvironment) UpdateDeployedEnvironment(env changeset.DeployedEnv) { + l.DeployedEnv = env +} + +func (l *DeployedLocalDevEnvironment) TestConfigs() *changeset.TestConfigs { + return l.GenericTCConfig +} + +func (l *DeployedLocalDevEnvironment) StartChains(t *testing.T) { lggr := logger.TestLogger(t) ctx := testcontext.Get(t) envConfig, testEnv, cfg := CreateDockerEnv(t) @@ -91,7 +100,7 @@ func (l *DeployedLocalDevEnvironment) StartChains(t *testing.T, _ *changeset.Tes l.DeployedEnv.ReplayBlocks = replayBlocks } -func (l *DeployedLocalDevEnvironment) StartNodes(t *testing.T, _ *changeset.TestConfigs, crConfig deployment.CapabilityRegistryConfig) { +func (l *DeployedLocalDevEnvironment) StartNodes(t *testing.T, crConfig deployment.CapabilityRegistryConfig) { require.NotNil(t, l.testEnv, "docker env is empty, start chains first") require.NotEmpty(t, l.devEnvTestCfg, "integration test config is empty, start chains first") require.NotNil(t, l.devEnvCfg, "dev environment config is empty, start chains first") @@ -143,7 +152,7 @@ func (l *DeployedLocalDevEnvironment) RestartChainlinkNodes(t *testing.T) error // if CCIP_V16_TEST_ENV is set to 'docker', it creates a docker environment with test config provided under testconfig/ccip/ccip.toml // It also creates a RMN cluster if the test config has RMN enabled // It returns the deployed environment and RMN cluster ( in case of RMN enabled) -func NewIntegrationEnvironment(t *testing.T, opts ...changeset.TestOps) (changeset.DeployedEnv, devenv.RMNCluster) { +func NewIntegrationEnvironment(t *testing.T, opts ...changeset.TestOps) (changeset.DeployedEnv, devenv.RMNCluster, changeset.TestEnvironment) { testCfg := changeset.DefaultTestConfigs() for _, opt := range opts { opt(testCfg) @@ -153,17 +162,20 @@ func NewIntegrationEnvironment(t *testing.T, opts ...changeset.TestOps) (changes require.NoError(t, testCfg.Validate(), "invalid test config") switch testCfg.Type { case changeset.Memory: - memEnv := changeset.NewMemoryEnvironment(t, opts...) - return memEnv, devenv.RMNCluster{} + dEnv, memEnv := changeset.NewMemoryEnvironment(t, opts...) + return dEnv, devenv.RMNCluster{}, memEnv case changeset.Docker: - dockerEnv := &DeployedLocalDevEnvironment{} - if testCfg.LegacyDeployment { - deployedEnv := changeset.NewLegacyEnvironment(t, testCfg, dockerEnv) + dockerEnv := &DeployedLocalDevEnvironment{ + GenericTCConfig: testCfg, + } + if testCfg.PrerequisiteDeploymentOnly { + deployedEnv := changeset.NewEnvironmentWithPrerequisitesContracts(t, dockerEnv) require.NotNil(t, dockerEnv.testEnv, "empty docker environment") - return deployedEnv, devenv.RMNCluster{} + dockerEnv.UpdateDeployedEnvironment(deployedEnv) + return deployedEnv, devenv.RMNCluster{}, dockerEnv } if testCfg.RMNEnabled { - deployedEnv := changeset.NewEnvironmentWithJobsAndContracts(t, testCfg, dockerEnv) + deployedEnv := changeset.NewEnvironmentWithJobsAndContracts(t, dockerEnv) l := logging.GetTestLogger(t) require.NotNil(t, dockerEnv.testEnv, "empty docker environment") config := GenerateTestRMNConfig(t, testCfg.NumOfRMNNodes, deployedEnv, MustNetworksToRPCMap(dockerEnv.testEnv.EVMNetworks)) @@ -178,25 +190,29 @@ func NewIntegrationEnvironment(t *testing.T, opts ...changeset.TestOps) (changes dockerEnv.devEnvTestCfg.CCIP.RMNConfig.GetAFN2ProxyVersion(), ) require.NoError(t, err) - return deployedEnv, *rmnCluster + dockerEnv.UpdateDeployedEnvironment(deployedEnv) + return deployedEnv, *rmnCluster, dockerEnv } if testCfg.CreateJobAndContracts { - deployedEnv := changeset.NewEnvironmentWithJobsAndContracts(t, testCfg, dockerEnv) + deployedEnv := changeset.NewEnvironmentWithJobsAndContracts(t, dockerEnv) require.NotNil(t, dockerEnv.testEnv, "empty docker environment") - return deployedEnv, devenv.RMNCluster{} + dockerEnv.UpdateDeployedEnvironment(deployedEnv) + return deployedEnv, devenv.RMNCluster{}, dockerEnv } if testCfg.CreateJob { - deployedEnv := changeset.NewEnvironmentWithJobs(t, testCfg, dockerEnv) + deployedEnv := changeset.NewEnvironmentWithJobs(t, dockerEnv) require.NotNil(t, dockerEnv.testEnv, "empty docker environment") - return deployedEnv, devenv.RMNCluster{} + dockerEnv.UpdateDeployedEnvironment(deployedEnv) + return deployedEnv, devenv.RMNCluster{}, dockerEnv } - deployedEnv := changeset.NewEnvironment(t, testCfg, dockerEnv) + deployedEnv := changeset.NewEnvironment(t, dockerEnv) require.NotNil(t, dockerEnv.testEnv, "empty docker environment") - return deployedEnv, devenv.RMNCluster{} + dockerEnv.UpdateDeployedEnvironment(deployedEnv) + return deployedEnv, devenv.RMNCluster{}, dockerEnv default: require.Failf(t, "Type %s not supported in integration tests choose between %s and %s", string(testCfg.Type), changeset.Memory, changeset.Docker) } - return changeset.DeployedEnv{}, devenv.RMNCluster{} + return changeset.DeployedEnv{}, devenv.RMNCluster{}, nil } func MustNetworksToRPCMap(evmNetworks []*blockchain.EVMNetwork) map[uint64]string {