diff --git a/deployment/ccip/changeset/cs_active_candidate_test.go b/deployment/ccip/changeset/cs_active_candidate_test.go index b4fe31424f2..a3a0505b950 100644 --- a/deployment/ccip/changeset/cs_active_candidate_test.go +++ b/deployment/ccip/changeset/cs_active_candidate_test.go @@ -29,7 +29,6 @@ func Test_ActiveCandidate(t *testing.T) { // and then setup a candidate instance. The candidate instance // should not be able to transmit anything until we make it active. tenv, _ := testhelpers.NewMemoryEnvironment(t, - testhelpers.WithMineBlocks(), testhelpers.WithNumOfChains(2), testhelpers.WithNumOfNodes(4)) state, err := changeset.LoadOnchainState(tenv.Env) diff --git a/deployment/ccip/changeset/cs_add_lane_test.go b/deployment/ccip/changeset/cs_add_lane_test.go index 844f9051650..18f86d98a68 100644 --- a/deployment/ccip/changeset/cs_add_lane_test.go +++ b/deployment/ccip/changeset/cs_add_lane_test.go @@ -15,7 +15,7 @@ import ( func TestAddLanesWithTestRouter(t *testing.T) { t.Parallel() - e, _ := testhelpers.NewMemoryEnvironment(t, testhelpers.WithMineBlocks()) + e, _ := testhelpers.NewMemoryEnvironment(t) // Here we have CR + nodes set up, but no CCIP contracts deployed. state, err := changeset.LoadOnchainState(e.Env) require.NoError(t, err) diff --git a/deployment/ccip/changeset/testhelpers/test_environment.go b/deployment/ccip/changeset/testhelpers/test_environment.go index 6de13022683..152c41c82f1 100644 --- a/deployment/ccip/changeset/testhelpers/test_environment.go +++ b/deployment/ccip/changeset/testhelpers/test_environment.go @@ -60,7 +60,7 @@ type TestConfigs struct { NumOfRMNNodes int LinkPrice *big.Int WethPrice *big.Int - MineBlocks bool + BlockTime time.Duration } func (tc *TestConfigs) Validate() error { @@ -99,14 +99,15 @@ func DefaultTestConfigs() *TestConfigs { LinkPrice: changeset.MockLinkPrice, WethPrice: changeset.MockWethPrice, CreateJobAndContracts: true, + BlockTime: 2 * time.Second, } } type TestOps func(testCfg *TestConfigs) -func WithMineBlocks() TestOps { +func WithBlockTime(blockTime time.Duration) TestOps { return func(testCfg *TestConfigs) { - testCfg.MineBlocks = true + testCfg.BlockTime = blockTime } } @@ -347,8 +348,7 @@ func mineBlocks(backend *memory.Backend, blockTime time.Duration) (stopMining fu } } -func (m *MemoryEnvironment) MineBlocks(t *testing.T) { - blockTime := 2 * time.Second +func (m *MemoryEnvironment) MineBlocks(t *testing.T, blockTime time.Duration) { for _, chain := range m.Chains { if backend, ok := chain.Client.(*memory.Backend); ok { stopMining := mineBlocks(backend, blockTime) @@ -379,8 +379,8 @@ func NewMemoryEnvironment(t *testing.T, opts ...TestOps) (DeployedEnv, TestEnvir dEnv = NewEnvironment(t, env) } env.UpdateDeployedEnvironment(dEnv) - if testCfg.MineBlocks { - env.MineBlocks(t) + if testCfg.BlockTime > 0 { + env.MineBlocks(t, testCfg.BlockTime) } return dEnv, env } diff --git a/deployment/ccip/changeset/v1_5/e2e_test.go b/deployment/ccip/changeset/v1_5/e2e_test.go index ca277fdd737..8911dcc8bf4 100644 --- a/deployment/ccip/changeset/v1_5/e2e_test.go +++ b/deployment/ccip/changeset/v1_5/e2e_test.go @@ -23,7 +23,6 @@ import ( func TestE2ELegacy(t *testing.T) { e, _ := testhelpers.NewMemoryEnvironment( t, - testhelpers.WithMineBlocks(), testhelpers.WithPrerequisiteDeploymentOnly(&changeset.V1_5DeploymentConfig{ PriceRegStalenessThreshold: 60 * 60 * 24 * 14, // two weeks RMNConfig: &rmn_contract.RMNConfig{ diff --git a/integration-tests/smoke/ccip/ccip_add_chain_test.go b/integration-tests/smoke/ccip/ccip_add_chain_test.go index 40429b05ba3..0d729b34371 100644 --- a/integration-tests/smoke/ccip/ccip_add_chain_test.go +++ b/integration-tests/smoke/ccip/ccip_add_chain_test.go @@ -31,7 +31,6 @@ func Test_AddChain(t *testing.T) { // only deploy and configure 3 of them. e, tEnv := testhelpers.NewMemoryEnvironment( t, - testhelpers.WithMineBlocks(), testhelpers.WithNumOfChains(numChains), testhelpers.WithNumOfNodes(4), testhelpers.WithPrerequisiteDeploymentOnly(nil), diff --git a/integration-tests/smoke/ccip/ccip_batching_test.go b/integration-tests/smoke/ccip/ccip_batching_test.go index c0ff715c434..8284fcd2823 100644 --- a/integration-tests/smoke/ccip/ccip_batching_test.go +++ b/integration-tests/smoke/ccip/ccip_batching_test.go @@ -42,7 +42,6 @@ func newBatchTestSetup(t *testing.T) batchTestSetup { // Setup 3 chains, with 2 lanes going to the dest. e, _, _ := testsetups.NewIntegrationEnvironment( t, - testhelpers.WithMineBlocks(), testhelpers.WithMultiCall3(), testhelpers.WithNumOfChains(3), testhelpers.WithNumOfUsersPerChain(2), diff --git a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go index 9f4e78e9695..dbe929fe322 100644 --- a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go +++ b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go @@ -37,7 +37,6 @@ var ( func Test_CCIPFeeBoosting(t *testing.T) { e, _, _ := testsetups.NewIntegrationEnvironment( t, - testhelpers.WithMineBlocks(), testhelpers.WithOCRConfigOverride(func(params *changeset.CCIPOCRParams) { params.ExecuteOffChainConfig.RelativeBoostPerWaitHour = 1 // Disable token price updates diff --git a/integration-tests/smoke/ccip/ccip_fees_test.go b/integration-tests/smoke/ccip/ccip_fees_test.go index e71f063b0da..f5b74791bfa 100644 --- a/integration-tests/smoke/ccip/ccip_fees_test.go +++ b/integration-tests/smoke/ccip/ccip_fees_test.go @@ -104,7 +104,6 @@ func Test_CCIPFees(t *testing.T) { t.Parallel() tenv, _, _ := testsetups.NewIntegrationEnvironment( t, - testhelpers.WithMineBlocks(), testhelpers.WithMultiCall3(), ) e := tenv.Env 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 b28e25033d2..42fcacc58f3 100644 --- a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go @@ -28,7 +28,6 @@ func Test_CCIPGasPriceUpdates(t *testing.T) { var gasPriceExpiry = 5 * time.Second e, _, _ := testsetups.NewIntegrationEnvironment(t, - testhelpers.WithMineBlocks(), testhelpers.WithOCRConfigOverride(func(params *changeset.CCIPOCRParams) { params.CommitOffChainConfig.RemoteGasPriceBatchWriteFrequency = *config.MustNewDuration(gasPriceExpiry) }), diff --git a/integration-tests/smoke/ccip/ccip_message_limitations_test.go b/integration-tests/smoke/ccip/ccip_message_limitations_test.go index a18a1c3cd90..ea775e5445d 100644 --- a/integration-tests/smoke/ccip/ccip_message_limitations_test.go +++ b/integration-tests/smoke/ccip/ccip_message_limitations_test.go @@ -24,7 +24,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { ctx := testcontext.Get(t) callOpts := &bind.CallOpts{Context: ctx} - testEnv, _, _ := testsetups.NewIntegrationEnvironment(t, testhelpers.WithMineBlocks()) + 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 9c96b752f56..69900b29322 100644 --- a/integration-tests/smoke/ccip/ccip_messaging_test.go +++ b/integration-tests/smoke/ccip/ccip_messaging_test.go @@ -50,7 +50,7 @@ type messagingTestCaseOutput struct { func Test_CCIPMessaging(t *testing.T) { // Setup 2 chains and a single lane. ctx := testhelpers.Context(t) - e, _, _ := testsetups.NewIntegrationEnvironment(t, testhelpers.WithMineBlocks()) + 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 index d39416e50c3..96af87d248a 100644 --- 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 @@ -45,7 +45,6 @@ func TestMigrateFromV1_5ToV1_6(t *testing.T) { }, }, }), - testhelpers.WithMineBlocks(), testhelpers.WithNumOfChains(3), testhelpers.WithNumOfUsersPerChain(2), // for in-memory test it is important to set the dest chain id as 1337 otherwise the config digest will not match diff --git a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go index daa76ac5be8..a3c1204099c 100644 --- a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go +++ b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go @@ -36,7 +36,6 @@ func Test_OutOfOrderExecution(t *testing.T) { ctx := tests.Context(t) tenv, _, _ := testsetups.NewIntegrationEnvironment( t, - testhelpers.WithMineBlocks(), testhelpers.WithUSDC(), testhelpers.WithUSDCAttestationMissing(), testhelpers.WithNumOfUsersPerChain(2), diff --git a/integration-tests/smoke/ccip/ccip_reader_test.go b/integration-tests/smoke/ccip/ccip_reader_test.go index bbc3949d16c..4345bd4d894 100644 --- a/integration-tests/smoke/ccip/ccip_reader_test.go +++ b/integration-tests/smoke/ccip/ccip_reader_test.go @@ -593,7 +593,7 @@ func TestCCIPReader_GetExpectedNextSequenceNumber(t *testing.T) { t.Parallel() ctx := tests.Context(t) //env := NewMemoryEnvironmentContractsOnly(t, logger.TestLogger(t), 2, 4, nil) - env, _ := testhelpers.NewMemoryEnvironment(t, testhelpers.WithMineBlocks()) + env, _ := testhelpers.NewMemoryEnvironment(t) state, err := changeset.LoadOnchainState(env.Env) require.NoError(t, err) diff --git a/integration-tests/smoke/ccip/ccip_rmn_test.go b/integration-tests/smoke/ccip/ccip_rmn_test.go index fb121e49c07..9a33abc844d 100644 --- a/integration-tests/smoke/ccip/ccip_rmn_test.go +++ b/integration-tests/smoke/ccip/ccip_rmn_test.go @@ -244,7 +244,6 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { t.Logf("Running RMN test case: %s", tc.name) envWithRMN, rmnCluster, _ := testsetups.NewIntegrationEnvironment(t, - testhelpers.WithMineBlocks(), testhelpers.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 1b409c6d492..8498417a6b6 100644 --- a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go @@ -30,7 +30,6 @@ func Test_CCIPTokenPriceUpdates(t *testing.T) { var tokenPriceExpiry = 5 * time.Second e, _, _ := testsetups.NewIntegrationEnvironment(t, - testhelpers.WithMineBlocks(), testhelpers.WithOCRConfigOverride(func(params *changeset.CCIPOCRParams) { params.CommitOffChainConfig.TokenPriceBatchWriteFrequency = *config.MustNewDuration(tokenPriceExpiry) })) diff --git a/integration-tests/smoke/ccip/ccip_token_transfer_test.go b/integration-tests/smoke/ccip/ccip_token_transfer_test.go index f42d94e75b7..f612cba523f 100644 --- a/integration-tests/smoke/ccip/ccip_token_transfer_test.go +++ b/integration-tests/smoke/ccip/ccip_token_transfer_test.go @@ -24,7 +24,6 @@ func TestTokenTransfer(t *testing.T) { ctx := tests.Context(t) tenv, _, _ := testsetups.NewIntegrationEnvironment(t, - testhelpers.WithMineBlocks(), testhelpers.WithNumOfUsersPerChain(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 1189d2f670f..acbca534b8f 100644 --- a/integration-tests/smoke/ccip/ccip_usdc_test.go +++ b/integration-tests/smoke/ccip/ccip_usdc_test.go @@ -34,7 +34,6 @@ func TestUSDCTokenTransfer(t *testing.T) { lggr := logger.TestLogger(t) ctx := tests.Context(t) tenv, _, _ := testsetups.NewIntegrationEnvironment(t, - testhelpers.WithMineBlocks(), testhelpers.WithNumOfUsersPerChain(3), testhelpers.WithNumOfChains(3), testhelpers.WithUSDC(),