diff --git a/integration-tests/actions/automationv2/actions.go b/integration-tests/actions/automationv2/actions.go index 5dca6b045b0..6190e0f0c52 100644 --- a/integration-tests/actions/automationv2/actions.go +++ b/integration-tests/actions/automationv2/actions.go @@ -589,12 +589,18 @@ func (r registrationResult) GetResult() common.Hash { return r.txHash } -func (a *AutomationTest) RegisterUpkeeps(upkeepConfigs []UpkeepConfig) ([]common.Hash, error) { +func (a *AutomationTest) RegisterUpkeeps(upkeepConfigs []UpkeepConfig, maxConcurrency int) ([]common.Hash, error) { concurrency, err := actions_seth.GetAndAssertCorrectConcurrency(a.ChainClient, 1) if err != nil { return nil, err } + if concurrency > maxConcurrency { + concurrency = maxConcurrency + a.Logger.Debug(). + Msgf("Concurrency is higher than max concurrency, setting concurrency to %d", concurrency) + } + var registerUpkeep = func(resultCh chan registrationResult, errorCh chan error, executorNum int, upkeepConfig UpkeepConfig) { keyNum := executorNum + 1 // key 0 is the root key var registrationRequest []byte @@ -684,12 +690,18 @@ func (c confirmationResult) GetResult() UpkeepId { return c.upkeepID } -func (a *AutomationTest) ConfirmUpkeepsRegistered(registrationTxHashes []common.Hash) ([]*big.Int, error) { +func (a *AutomationTest) ConfirmUpkeepsRegistered(registrationTxHashes []common.Hash, maxConcurrency int) ([]*big.Int, error) { concurrency, err := actions_seth.GetAndAssertCorrectConcurrency(a.ChainClient, 1) if err != nil { return nil, err } + if concurrency > maxConcurrency { + concurrency = maxConcurrency + a.Logger.Debug(). + Msgf("Concurrency is higher than max concurrency, setting concurrency to %d", concurrency) + } + var confirmUpkeep = func(resultCh chan confirmationResult, errorCh chan error, _ int, txHash common.Hash) { receipt, err := a.ChainClient.Client.TransactionReceipt(context.Background(), txHash) if err != nil { diff --git a/integration-tests/load/automationv2_1/automationv2_1_test.go b/integration-tests/load/automationv2_1/automationv2_1_test.go index 6ab73ead0f2..8f158d8001e 100644 --- a/integration-tests/load/automationv2_1/automationv2_1_test.go +++ b/integration-tests/load/automationv2_1/automationv2_1_test.go @@ -423,8 +423,10 @@ Load Config: expectedTotalUpkeepCount += *u.NumberOfUpkeeps } + maxDeploymentConcurrency := 100 + for _, u := range loadedTestConfig.Automation.Load { - deploymentData, err := deployConsumerAndTriggerContracts(l, u, a.ChainClient, multicallAddress, automationDefaultLinkFunds, a.LinkToken) + deploymentData, err := deployConsumerAndTriggerContracts(l, u, a.ChainClient, multicallAddress, maxDeploymentConcurrency, automationDefaultLinkFunds, a.LinkToken) require.NoError(t, err, "Error deploying consumer and trigger contracts") consumerContracts = append(consumerContracts, deploymentData.ConsumerContracts...) @@ -480,10 +482,10 @@ Load Config: } require.Equal(t, expectedTotalUpkeepCount, len(upkeepConfigs), "Incorrect number of upkeep configs created") - registrationTxHashes, err := a.RegisterUpkeeps(upkeepConfigs) + registrationTxHashes, err := a.RegisterUpkeeps(upkeepConfigs, maxDeploymentConcurrency) require.NoError(t, err, "Error registering upkeeps") - upkeepIds, err := a.ConfirmUpkeepsRegistered(registrationTxHashes) + upkeepIds, err := a.ConfirmUpkeepsRegistered(registrationTxHashes, maxDeploymentConcurrency) require.NoError(t, err, "Error confirming upkeeps registered") require.Equal(t, expectedTotalUpkeepCount, len(upkeepIds), "Incorrect number of upkeeps registered") diff --git a/integration-tests/load/automationv2_1/gun.go b/integration-tests/load/automationv2_1/gun.go index 85418a0ff03..461824d86e4 100644 --- a/integration-tests/load/automationv2_1/gun.go +++ b/integration-tests/load/automationv2_1/gun.go @@ -89,19 +89,35 @@ func (m *LogTriggerGun) Call(_ *wasp.Generator) *wasp.Response { dividedData = append(dividedData, d[i:end]) } + resultCh := make(chan *wasp.Response, len(dividedData)) + for _, a := range dividedData { wg.Add(1) - go func(a [][]byte, m *LogTriggerGun) *wasp.Response { + go func(a [][]byte, m *LogTriggerGun) { defer wg.Done() _, err := contracts.MultiCallLogTriggerLoadGen(m.client, m.multiCallAddress, m.addresses, a) if err != nil { m.logger.Error().Err(err).Msg("Error calling MultiCallLogTriggerLoadGen") - return &wasp.Response{Error: err.Error(), Failed: true} + resultCh <- &wasp.Response{Error: err.Error(), Failed: true} + return } - return &wasp.Response{} + resultCh <- &wasp.Response{} }(a, m) } wg.Wait() - return &wasp.Response{} + + r := &wasp.Response{} + for result := range resultCh { + if result.Failed { + r.Failed = true + if r.Error != "" { + r.Error += "; " + result.Error + } else { + r.Error = result.Error + } + } + } + + return r } diff --git a/integration-tests/load/automationv2_1/helpers.go b/integration-tests/load/automationv2_1/helpers.go index cd229eb075d..4fa13149d77 100644 --- a/integration-tests/load/automationv2_1/helpers.go +++ b/integration-tests/load/automationv2_1/helpers.go @@ -94,7 +94,7 @@ type task struct { deployTrigger bool } -func deployConsumerAndTriggerContracts(l zerolog.Logger, loadConfig aconfig.Load, chainClient *seth.Client, multicallAddress common.Address, automationDefaultLinkFunds *big.Int, linkToken contracts.LinkToken) (DeploymentData, error) { +func deployConsumerAndTriggerContracts(l zerolog.Logger, loadConfig aconfig.Load, chainClient *seth.Client, multicallAddress common.Address, maxConcurrency int, automationDefaultLinkFunds *big.Int, linkToken contracts.LinkToken) (DeploymentData, error) { data := DeploymentData{} concurrency, err := actions_seth.GetAndAssertCorrectConcurrency(chainClient, 1) @@ -102,6 +102,12 @@ func deployConsumerAndTriggerContracts(l zerolog.Logger, loadConfig aconfig.Load return DeploymentData{}, err } + if concurrency > maxConcurrency { + concurrency = maxConcurrency + l.Debug(). + Msgf("Concurrency is higher than max concurrency, setting concurrency to %d", concurrency) + } + l.Debug(). Int("Number of Upkeeps", *loadConfig.NumberOfUpkeeps). Int("Concurrency", concurrency).