diff --git a/.github/e2e-tests.yml b/.github/e2e-tests.yml index 3b394293378..d40d375f860 100644 --- a/.github/e2e-tests.yml +++ b/.github/e2e-tests.yml @@ -948,45 +948,6 @@ runner-test-matrix: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 E2E_JD_VERSION: 0.6.0 - - id: smoke/ccip/ccip_token_transfer_test.go:* - path: integration-tests/smoke/ccip/ccip_token_transfer_test.go - test_env_type: docker - runs_on: ubuntu-latest - triggers: - - PR E2E Core Tests - - Nightly E2E Tests - test_cmd: cd integration-tests/ && go test smoke/ccip/ccip_token_transfer_test.go -timeout 16m -test.parallel=1 -count=1 -json - pyroscope_env: ci-smoke-ccipv1_6-evm-simulated - test_env_vars: - E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 - E2E_JD_VERSION: 0.6.0 - - - id: smoke/ccip/ccip_ooo_execution_test.go:* - path: integration-tests/smoke/ccip/ccip_ooo_execution_test.go - test_env_type: docker - runs_on: ubuntu-latest - triggers: - - PR E2E Core Tests - - Nightly E2E Tests - test_cmd: cd integration-tests/ && go test smoke/ccip/ccip_ooo_execution_test.go -timeout 16m -test.parallel=1 -count=1 -json - pyroscope_env: ci-smoke-ccipv1_6-evm-simulated - test_env_vars: - E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 - E2E_JD_VERSION: 0.6.0 - - - id: smoke/ccip/ccip_usdc_test.go:* - path: integration-tests/smoke/ccip/ccip_usdc_test.go - test_env_type: docker - runs_on: ubuntu-latest - triggers: - - PR E2E Core Tests - - Nightly E2E Tests - test_cmd: cd integration-tests/smoke/ccip && go test ccip_usdc_test.go -timeout 18m -test.parallel=1 -count=1 -json - pyroscope_env: ci-smoke-ccipv1_6-evm-simulated - test_env_vars: - E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2,SIMULATED_3 - E2E_JD_VERSION: 0.6.0 - - id: smoke/ccip/ccip_message_limitations_test.go:* path: integration-tests/smoke/ccip/ccip_message_limitations_test.go test_env_type: docker diff --git a/.github/integration-in-memory-tests.yml b/.github/integration-in-memory-tests.yml index 4b4fd71258d..b7522274d85 100644 --- a/.github/integration-in-memory-tests.yml +++ b/.github/integration-in-memory-tests.yml @@ -48,4 +48,28 @@ runner-test-matrix: - PR Integration CCIP Tests test_cmd: cd integration-tests/contracts && go test ccipreader_test.go -timeout 5m -test.parallel=1 -count=1 -json + - id: smoke/ccip/ccip_usdc_test.go:* + path: integration-tests/smoke/ccip/ccip_usdc_test.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_usdc_test.go -timeout 18m -test.parallel=1 -count=1 -json + + - id: smoke/ccip/ccip_ooo_execution_test.go:* + path: integration-tests/smoke/ccip/ccip_ooo_execution_test.go + test_env_type: in-memory + runs_on: ubuntu-latest + triggers: + - PR Integration CCIP Tests + test_cmd: cd integration-tests/ && go test smoke/ccip/ccip_ooo_execution_test.go -timeout 16m -test.parallel=1 -count=1 -json + + - id: smoke/ccip/ccip_token_transfer_test.go:* + path: integration-tests/smoke/ccip/ccip_token_transfer_test.go + test_env_type: in-memory + runs_on: ubuntu-latest + triggers: + - PR Integration CCIP Tests + test_cmd: cd integration-tests/ && go test smoke/ccip/ccip_token_transfer_test.go -timeout 16m -test.parallel=1 -count=1 -json + # END: CCIP tests diff --git a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go index 6a3a6b869cd..ee28aa0a47f 100644 --- a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go +++ b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go @@ -14,7 +14,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" + "github.com/smartcontractkit/chainlink/deployment/environment/memory" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -36,9 +36,11 @@ func Test_OutOfOrderExecution(t *testing.T) { IsUSDC: true, IsUSDCAttestationMissing: true, } - tenv, _, _ := testsetups.NewLocalDevEnvironmentWithDefaultPrice(t, lggr, config) - // Inmemory setup used for debugging and development, use instead of docker when needed - //tenv := changeset.NewMemoryEnvironmentWithJobsAndContracts(t, lggr, 2, 4, config) + tenv := changeset.NewMemoryEnvironmentWithJobsAndContracts(t, logger.TestLogger(t), memory.MemoryEnvironmentConfig{ + Chains: 2, + Nodes: 4, + Bootstraps: 1, + }, config) e := tenv.Env state, err := changeset.LoadOnchainState(e) diff --git a/integration-tests/smoke/ccip/ccip_token_transfer_test.go b/integration-tests/smoke/ccip/ccip_token_transfer_test.go index 979a6b13695..13abe33fe7c 100644 --- a/integration-tests/smoke/ccip/ccip_token_transfer_test.go +++ b/integration-tests/smoke/ccip/ccip_token_transfer_test.go @@ -1,56 +1,50 @@ package smoke import ( - "context" "math/big" "testing" "golang.org/x/exp/maps" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" - sel "github.com/smartcontractkit/chain-selectors" - "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" - "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" + "github.com/smartcontractkit/chainlink/deployment/environment/memory" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" "github.com/smartcontractkit/chainlink/v2/core/logger" ) func TestTokenTransfer(t *testing.T) { - t.Skip("need to deflake and optimize") lggr := logger.TestLogger(t) ctx := tests.Context(t) config := &changeset.TestConfigs{} - tenv, _, _ := testsetups.NewLocalDevEnvironmentWithDefaultPrice(t, lggr, config) - inMemoryEnv := false - // use this if you are testing locally in memory - // tenv := changeset.NewMemoryEnvironmentWithJobsAndContracts(t, lggr, 2, 4, config) - // inMemoryEnv := true + tenv := changeset.NewMemoryEnvironmentWithJobsAndContracts(t, logger.TestLogger(t), memory.MemoryEnvironmentConfig{ + Chains: 2, + Nodes: 4, + Bootstraps: 1, + NumOfUsersPerChain: 3, + }, config) e := tenv.Env state, err := changeset.LoadOnchainState(e) require.NoError(t, err) + require.GreaterOrEqual(t, len(e.Chains), 2) allChainSelectors := maps.Keys(e.Chains) sourceChain, destChain := allChainSelectors[0], allChainSelectors[1] ownerSourceChain := e.Chains[sourceChain].DeployerKey ownerDestChain := e.Chains[destChain].DeployerKey - oneE18 := new(big.Int).SetUint64(1e18) - funds := new(big.Int).Mul(oneE18, new(big.Int).SetUint64(10)) + require.GreaterOrEqual(t, len(tenv.Users[sourceChain]), 2) + require.GreaterOrEqual(t, len(tenv.Users[destChain]), 2) + selfServeSrcTokenPoolDeployer := tenv.Users[sourceChain][1] + selfServeDestTokenPoolDeployer := tenv.Users[destChain][1] - // Deploy and fund self-serve actors - selfServeSrcTokenPoolDeployer := createAndFundSelfServeActor(ctx, t, ownerSourceChain, e.Chains[sourceChain], funds, inMemoryEnv) - selfServeDestTokenPoolDeployer := createAndFundSelfServeActor(ctx, t, ownerDestChain, e.Chains[destChain], funds, inMemoryEnv) + oneE18 := new(big.Int).SetUint64(1e18) // Deploy tokens and pool by CCIP Owner srcToken, _, destToken, _, err := changeset.DeployTransferableToken( @@ -227,53 +221,3 @@ func TestTokenTransfer(t *testing.T) { changeset.WaitForTokenBalances(ctx, t, e.Chains, expectedTokenBalances) } - -func createAndFundSelfServeActor( - ctx context.Context, - t *testing.T, - deployer *bind.TransactOpts, - chain deployment.Chain, - amountToFund *big.Int, - isInMemory bool, -) *bind.TransactOpts { - key, err := crypto.GenerateKey() - require.NoError(t, err) - - // Simulated backend sets chainID to 1337 always - chainID := big.NewInt(1337) - if !isInMemory { - // Docker environment runs real geth so chainID has to be set accordingly - stringChainID, err1 := sel.GetChainIDFromSelector(chain.Selector) - require.NoError(t, err1) - chainID, _ = new(big.Int).SetString(stringChainID, 10) - } - - actor, err := bind.NewKeyedTransactorWithChainID(key, chainID) - require.NoError(t, err) - - nonce, err := chain.Client.PendingNonceAt(ctx, deployer.From) - require.NoError(t, err) - - gasPrice, err := chain.Client.SuggestGasPrice(ctx) - require.NoError(t, err) - - tx := types.NewTx(&types.LegacyTx{ - Nonce: nonce, - To: &actor.From, - Value: amountToFund, - Gas: uint64(21000), - GasPrice: gasPrice, - Data: nil, - }) - - signedTx, err := deployer.Signer(deployer.From, tx) - require.NoError(t, err) - - err = chain.Client.SendTransaction(ctx, signedTx) - require.NoError(t, err) - - _, err = chain.Confirm(signedTx) - require.NoError(t, err) - - return actor -} diff --git a/integration-tests/smoke/ccip/ccip_usdc_test.go b/integration-tests/smoke/ccip/ccip_usdc_test.go index eacf03df926..2dae3f3c48e 100644 --- a/integration-tests/smoke/ccip/ccip_usdc_test.go +++ b/integration-tests/smoke/ccip/ccip_usdc_test.go @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" + "github.com/smartcontractkit/chainlink/deployment/environment/memory" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/burn_mint_erc677" @@ -34,13 +34,12 @@ func TestUSDCTokenTransfer(t *testing.T) { config := &changeset.TestConfigs{ IsUSDC: true, } - tenv, _, _ := testsetups.NewLocalDevEnvironmentWithDefaultPrice(t, lggr, config) - //tenv := changeset.NewMemoryEnvironmentWithJobsAndContracts(t, lggr, memory.MemoryEnvironmentConfig{ - // Chains: 3, - // NumOfUsersPerChain: 3, - // Nodes: 5, - // Bootstraps: 1, - //}, config) + tenv := changeset.NewMemoryEnvironmentWithJobsAndContracts(t, lggr, memory.MemoryEnvironmentConfig{ + Chains: 3, + NumOfUsersPerChain: 3, + Nodes: 4, + Bootstraps: 1, + }, config) e := tenv.Env state, err := changeset.LoadOnchainState(e)