Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAPPL-399] Syncer limits #16234

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft

[CAPPL-399] Syncer limits #16234

wants to merge 3 commits into from

Conversation

agparadiso
Copy link
Contributor

@agparadiso agparadiso commented Feb 5, 2025

Description

This pr adds the following limits:

  • number of engines the syncer can host (global count limit)
  • number of workflows an owner can create (per owner limit)

CAPPL-399

Requires

Supports

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

Copy link
Contributor

github-actions bot commented Feb 5, 2025

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Scheduled Run Frequency , Core Tests (go_core_tests) , GolangCI Lint (.) , Core Tests (go_core_tests_integration) , Core Tests (go_core_ccip_deployment_tests) , Core Tests (go_core_fuzz) , Core Tests (go_core_race_tests) , test-scripts , lint , SonarQube Scan

1. Test output mismatch: go_core_tests_integration

Source of Error:
--- stdout
+++ out.txt
@@ -305,8 +305,6 @@
MaxBinarySize = '20.00mb'
MaxEncryptedSecretsSize = '26.40kb'
MaxConfigSize = '50.00kb'
-GlobalCountLimit = 0
-WorkflowsPerOwnerLimit = 0
**Why**: The test failed because the expected output (`stdout`) did not match the actual output (`out.txt`). Specifically, the lines `GlobalCountLimit = 0` and `WorkflowsPerOwnerLimit = 0` were missing in the actual output.

Suggested fix: Ensure that the configuration output includes the GlobalCountLimit and WorkflowsPerOwnerLimit parameters or update the expected output to match the actual configuration if these parameters are no longer relevant.

2. Multiple commands with --config or --secrets flags: go_core_tests_integration

Source of Error:
Error running app: multiple commands with --config or --secrets flags. only one command may specify these flags. when secrets are used, they must be specific together in the same command
**Why**: The error occurred because multiple commands were specified with `--config` or `--secrets` flags, which is not allowed. Only one command may specify these flags, and when secrets are used, they must be specified together in the same command.

Suggested fix: Combine the commands that use --config and --secrets flags into a single command to ensure they are specified together.

3. Error return value not checked: GolangCI Lint (.)

Source of Error:
core/services/workflows/syncer/handler_test.go:498:25: Error return value of `h.engineRegistry.Add` is not checked (errcheck)
h.engineRegistry.Add(prevWFIDEncoded, me)
^
**Why**: The error return value of the `h.engineRegistry.Add` function call is not checked, which can lead to unhandled errors.

Suggested fix: Add error handling for the h.engineRegistry.Add function call to ensure any errors are properly managed.

4. Integer overflow conversion uint -> int: GolangCI Lint (.)

Source of Error:
core/services/workflows/syncer/engine_registry.go:54:27: G115: integer overflow conversion uint -> int (gosec)
if len(r.engines)+1 > int(r.globalCountLimit) {
^
**Why**: The code is performing an unsafe conversion from `uint` to `int`, which can lead to integer overflow issues.

Suggested fix: Ensure that the conversion from uint to int is safe by adding appropriate checks or using a type that can safely hold the value.

5. Integer overflow conversion uint -> int: GolangCI Lint (.)

Source of Error:
core/services/workflows/syncer/handler.go:485:31: G115: integer overflow conversion uint -> int (gosec)
if len(ownerWorkflows) >= int(h.workflowsPerOwnerLimit) {
^
**Why**: The code is performing an unsafe conversion from `uint` to `int`, which can lead to integer overflow issues.

Suggested fix: Ensure that the conversion from uint to int is safe by adding appropriate checks or using a type that can safely hold the value.

6. Ineffectual assignment to err: GolangCI Lint (.)

Source of Error:
core/services/workflows/syncer/handler_test.go:538:5: ineffectual assignment to err (ineffassign)
err = h.workflowRegisteredEvent(ctx, WorkflowRegistryWorkflowRegisteredV1{
^
**Why**: The variable `err` is assigned a value but never used, which is considered ineffectual.

Suggested fix: Either use the err variable or remove the assignment if it is not needed.

7. Test output mismatch: go_core_tests

Source of Error:
--- Expected
+++ Actual
@@ -286,2 +286,4 @@
MaxConfigSize = '50.00kb'
+GlobalCountLimit = 0
+WorkflowsPerOwnerLimit = 0
**Why**: The test failed because the expected output did not include the `GlobalCountLimit` and `WorkflowsPerOwnerLimit` parameters, which were present in the actual output.

Suggested fix: Update the expected output to include the GlobalCountLimit and WorkflowsPerOwnerLimit parameters if they are now part of the configuration.

8. Test output mismatch: TestResolver_ConfigV2

Source of Error:
testing.go:82: got: {"configv2":{"effective":"InsecureFastScrypt = false\nRootDir = '~/.chainlink'\nShutdownGracePeriod = '5s'\n\n[Feature]\nFeedsManager = true\nLogPoller = false\nUICSAKeys = false\nCCIP = true\nMultiFeedsManagers = false\n\n[Database]\nDefaultIdleInTxSessionTimeout = '1h0m0s'\nDefaultLockTimeout = '15s'\nDefaultQueryTimeout = '10s'\nLogQueries = false\nMaxIdleConns = 10\nMaxOpenConns = 100\nMigrateOnStartup = true\n\n[Database.Backup]\nDir = ''\nFrequency = '1h0m0s'\nMode = 'none'\nOnVersionUpgrade = true\n\n[Database.Listener]\nMaxReconnectDuration = '10m0s'\nMinReconnectInterval = '1m0s'\nFallbackPollInterval = '30s'\n\n[Database.Lock]\nEnabled = true\nLeaseDuration = '10s'\nLeaseRefreshInterval = '1s'\n\n[TelemetryIngress]\nUniConn = false\nLogging = false\nBufferSize = 100\nMaxBatchSize = 50\nSendInterval = '500ms'\nSendTimeout = '10s'\nUseBatchSend = true\n\n[AuditLogger]\nEnabled = false\nForwardToUrl = ''\nJsonWrapperKey = ''\nHeaders = []\n\n[Log]\nLevel = 'info'\nJSONConsole = false\nUnixTS = false\n\n[Log.File]\nDir = ''\nMaxSize = '5.12gb'\nMaxAgeDays = 0\nMaxBackups = 1\n\n[WebServer]\nAuthenticationMethod = 'local'\nAllowOrigins = 'http://localhost:3000,http://localhost:6688'\nBridgeResponseURL = ''\nBridgeCacheTTL = '0s'\nHTTPWriteTimeout = '10s'\nHTTPPort = 6688\nSecureCookies = true\nSessionTimeout = '15m0s'\nSessionReaperExpiration = '240h0m0s'\nHTTPMaxSize = '32.77kb'\nStartTimeout = '15s'\nListenIP = '0.0.0.0'\n\n[WebServer.LDAP]\nServerTLS = true\nSessionTimeout = '15m0s'\nQueryTimeout = '2m0s'\nBaseUserAttr = 'uid'\nBaseDN = ''\nUsersDN = 'ou=users'\nGroupsDN = 'ou=groups'\nActiveAttribute = ''\nActiveAttributeAllowedValue = ''\nAdminUserGroupCN = 'NodeAdmins'\nEditUserGroupCN = 'NodeEditors'\nRunUserGroupCN = 'NodeRunners'\nReadUserGroupCN = 'NodeReadOnly'\nUserApiTokenEnabled = false\nUserAPITokenDuration = '240h0m0s'\nUpstreamSyncInterval = '0s'\nUpstreamSyncRateLimit = '2m0s'\n\n[WebServer.MFA]\nRPID = ''\nRPOrigin = ''\n\n[WebServer.RateLimit]\nAuthenticated = 1000\nAuthenticatedPeriod = '1m0s'\nUnauthenticated = 5\nUnauthenticatedPeriod = '20s'\n\n[WebServer.TLS]\nCertPath = ''\nForceRedirect = false\nHost = ''\nHTTPSPort = 6689\nKeyPath = ''\nListenIP = '0.0.0.0'\n\n[JobPipeline]\nExternalInitiatorsEnabled = false\nMaxRunDuration = '10m0s'\nMaxSuccessfulRuns = 10000\nReaperInterval = '1h0m0s'\nReaperThreshold = '24h0m0s'\nResultWriteQueueDepth = 100\nVerboseLogging = true\n\n[JobPipeline.HTTPRequest]\nDefaultTimeout = '15s'\nMaxSize = '32.77kb'\n\n[FluxMonitor]\nDefaultTransactionQueueDepth = 1\nSimulateTransactions = false\n\n[OCR2]\nEnabled = false\nContractConfirmations = 3\nBlockchainTimeout = '20s'\nContractPollInterval = '1m0s'\nContractSubscribeInterval = '2m0s'\nContractTransmitterTransmitTimeout = '10s'\nDatabaseTimeout = '10s'\nKeyBundleID = '0000000000000000000000000000000000000000000000000000000000000000'\nCaptureEATelemetry = false\nCaptureAutomationCustomTelemetry = true\nAllowNoBootstrappers = false\nDefaultTransactionQueueDepth = 1\nSimulateTransactions = false\nTraceLogging = false\n\n[OCR]\nEnabled = false\nObservationTimeout = '5s'\nBlockchainTimeout = '20s'\nContractPollInterval = '1m0s'\nContractSubscribeInterval = '2m0s'\nDefaultTransactionQueueDepth = 1\nKeyBundleID = '0000000000000000000000000000000000000000000000000000000000000000'\nSimulateTransactions = false\nTransmitterAddress = ''\nCaptureEATelemetry = false\nTraceLogging = false\n\n[P2P]\nIncomingMessageBufferSize = 10\nOutgoingMessageBufferSize = 10\nPeerID = ''\nTraceLogging = false\n\n[P2P.V2]\nEnabled = true\nAnnounceAddresses = []\nDefaultBootstrappers = []\nDeltaDial = '15s'\nDeltaReconcile = '1m0s'\nListenAddresses = []\n\n[Keeper]\nDefaultTransactionQueueDepth = 1\nGasPriceBufferPercent = 20\nGasTipCapBufferPercent = 20\nBaseFeeBufferPercent = 20\nMaxGracePeriod = 100\nTurnLookBack = 1000\n\n[Keeper.Registry]\nCheckGasOverhead = 200000\nPerformGasOverhead = 300000\nMaxPerformDataSize = 5000\nSyncInterval = '30m0s'\nSyncUpkeepQueueSize = 10\n\n[AutoPprof]\nEnabled = false\nProfileRoot = ''\nPollInterval = '10s'\nGatherDuration = '10s'\nGatherTraceDuration = '5s'\nMaxProfileSize = '100.00mb'\nCPUProfileRate = 1\nMemProfileRate = 1\nBlockProfileRate = 1\nMutexProfileFraction = 1\nMemThreshold = '4.00gb'\nGoroutineThreshold = 5000\n\n[Pyroscope]\nServerAddress = ''\nEnvironment = 'mainnet'\n\n[Sentry]\nDebug = false\nDSN = ''\nEnvironment = ''\nRelease = ''\n\n[Insecure]\nDevWebServer = false\nOCRDevelopmentMode = false\nInfiniteDepthQueries = false\nDisableRateLimiting = false\n\n[Tracing]\nEnabled = false\nCollectorTarget = ''\nNodeID = ''\nSamplingRatio = 0.0\nMode = 'tls'\nTLSCertPath = ''\n\n[Mercury]\nVerboseLogging = false\n\n[Mercury.Cache]\nLatestReportTTL = '1s'\nMaxStaleAge = '1h0m0s'\nLatestReportDeadline = '5s'\n\n[Mercury.TLS]\nCertFile = ''\n\n[Mercury.Transmitter]\nProtocol = 'wsrpc'\nTransmitQueueMaxSize = 100000\nTransmitTimeout = '5s'\nTransmitConcurrency = 100\n\n[Capabilities]\n[Capabilities.RateLimit]\nGlobalRPS = 200.0\nGlobalBurst = 200\nPerSenderRPS = 100.0\nPerSenderBurst = 100\n\n[Capabilities.Peering]\nIncomingMessageBufferSize = 10\nOutgoingMessageBufferSize = 10\nPeerID = ''\nTraceLogging = false\n\n[Capabilities.Peering.V2]\nEnabled = false\nAnnounceAddresses = []\nDefaultBootstrappers = []\nDeltaDial = '15s'\nDeltaReconcile = '1m0s'\nListenAddresses = []\n\n[Capabilities.Dispatcher]\nSupportedVersion = 1\nReceiverBufferSize = 10000\n\n[Capabilities.Dispatcher.RateLimit]\nGlobalRPS = 800.0\nGlobalBurst = 1000\nPerSenderRPS = 10.0\nPerSenderBurst = 50\n\n[Capabilities.ExternalRegistry]\nAddress = ''\nNetworkID = 'evm'\nChainID = '1'\n\n[Capabilities.WorkflowRegistry]\nAddress = ''\nNetworkID = 'evm'\nChainID = '1'\nMaxBinarySize = '20.00mb'\nMaxEncryptedSecretsSize = '26.40kb'\nMaxConfigSize = '50.00kb'\nGlobalCountLimit = 0\nWorkflowsPerOwnerLimit = 0\n\n[Capabilities.GatewayConnector]\nChainIDForNodeKey = ''\nNodeAddress = ''\nDonID = ''\nWSHandshakeTimeoutMillis = 0\nAuthMinChallengeLen = 0\nAuthTimestampToleranceSec = 0\n\n[[Capabilities.GatewayConnector.Gateways]]\nID = ''\nURL = ''\n\n[Telemetry]\nEnabled = false\nCACertFile = ''\nEndpoint = ''\nInsecureConnection = false\nTraceSampleRatio = 0.01\nEmitterBatchProcessor = true\nEmitterExportTimeout = '1s'\n","user":""}}
**Why**: The test failed because the expected output did not match the actual output. The actual output included additional configuration parameters that were not present in the expected output.

Suggested fix: Update the expected output to include the additional configuration parameters present in the actual output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant