From bdd9fb12614637ab769d484642481d63172bd227 Mon Sep 17 00:00:00 2001 From: Roman Vaseev <4833306+Filter94@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:07:51 +0200 Subject: [PATCH 1/2] Added a test for traces v2 config (#166) * Added a test for traces v2 config --- ...ator-docker-traces-v2-override.config.toml | 9 +- .../app/config/CoordinatorConfigTest.kt | 92 +++++++++++++++++++ 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/config/coordinator/coordinator-docker-traces-v2-override.config.toml b/config/coordinator/coordinator-docker-traces-v2-override.config.toml index 30177d7ef..a2f15d525 100644 --- a/config/coordinator/coordinator-docker-traces-v2-override.config.toml +++ b/config/coordinator/coordinator-docker-traces-v2-override.config.toml @@ -18,13 +18,11 @@ expected-traces-api-version-v2="v0.8.0-rc3" [traces.counters-v2] endpoints=["http://traces-node-v2:8545/"] request-limit-per-endpoint=20 -request-retry.max-retries=4 request-retry.backoff-delay="PT1S" request-retry.failures-warning-threshold=2 [traces.conflation-v2] endpoints=["http://traces-node-v2:8545/"] request-limit-per-endpoint=2 -request-retry.max-retries=4 request-retry.backoff-delay="PT1S" request-retry.failures-warning-threshold=2 @@ -32,3 +30,10 @@ request-retry.failures-warning-threshold=2 geth-gas-price-update-recipients=[ "http://l2-node:8545/" ] + +[l2-network-gas-pricing.legacy.sample-transaction-gas-pricing] +plain-transfer-cost-multiplier=1.0 +# Ratio of 350 / 29400 is based on data from Mainnet. Only 0.3% of transactions are less profitable than this +# Meaning 99.7% of transactions will be includable if priced using eth_gasPrice +compressed-tx-size=350 +expected-gas=29400 diff --git a/coordinator/app/src/test/kotlin/net/consensys/zkevm/coordinator/app/config/CoordinatorConfigTest.kt b/coordinator/app/src/test/kotlin/net/consensys/zkevm/coordinator/app/config/CoordinatorConfigTest.kt index 6581cf7a5..56e43b539 100644 --- a/coordinator/app/src/test/kotlin/net/consensys/zkevm/coordinator/app/config/CoordinatorConfigTest.kt +++ b/coordinator/app/src/test/kotlin/net/consensys/zkevm/coordinator/app/config/CoordinatorConfigTest.kt @@ -777,6 +777,98 @@ class CoordinatorConfigTest { } } + @Test + fun parsesValidTracesV2ConfigOverride() { + val smartContractErrorCodes: SmartContractErrors = + CoordinatorAppCli.loadConfigsOrError( + listOf(File("../../config/common/smart-contract-errors.toml")) + ).get()!!.smartContractErrors + val timeOfDayMultipliers = + CoordinatorAppCli.loadConfigsOrError( + listOf(File("../../config/common/gas-price-cap-time-of-day-multipliers.toml")) + ) + val tracesLimitsConfigs = + CoordinatorAppCli.loadConfigsOrError( + listOf(File("../../config/common/traces-limits-v1.toml")) + ) + val tracesLimitsV2Configs = + CoordinatorAppCli.loadConfigsOrError( + listOf(File("../../config/common/traces-limits-v2.toml")) + ) + + CoordinatorAppCli.loadConfigsOrError( + listOf( + File("../../config/coordinator/coordinator-docker.config.toml"), + File("../../config/coordinator/coordinator-docker-traces-v2-override.config.toml") + ) + ) + .onFailure { error: String -> fail(error) } + .onSuccess { + val configs = it.copy( + conflation = it.conflation.copy( + _tracesLimitsV1 = tracesLimitsConfigs.get()?.tracesLimits?.let { TracesCountersV1(it) }, + _tracesLimitsV2 = tracesLimitsV2Configs.get()?.tracesLimits?.let { TracesCountersV2(it) }, + _smartContractErrors = smartContractErrorCodes + ), + l1DynamicGasPriceCapService = it.l1DynamicGasPriceCapService.copy( + gasPriceCapCalculation = it.l1DynamicGasPriceCapService.gasPriceCapCalculation.copy( + timeOfDayMultipliers = timeOfDayMultipliers.get()?.gasPriceCapTimeOfDayMultipliers + ) + ) + ) + + val expectedConfig = + coordinatorConfig.copy( + zkTraces = zkTracesConfig.copy(ethApi = URI("http://traces-node-v2:8545").toURL()), + l2NetworkGasPricingService = l2NetworkGasPricingServiceConfig.copy( + legacy = + l2NetworkGasPricingServiceConfig.legacy.copy( + transactionCostCalculatorConfig = + l2NetworkGasPricingServiceConfig.legacy.transactionCostCalculatorConfig?.copy( + compressedTxSize = 350, + expectedGas = 29400 + ) + ) + ), + traces = tracesConfig.copy( + switchToLineaBesu = true, + expectedTracesApiVersionV2 = "v0.8.0-rc3", + conflationV2 = tracesConfig.conflation.copy( + endpoints = listOf(URI("http://traces-node-v2:8545/").toURL()) + ), + countersV2 = TracesConfig.FunctionalityEndpoint( + listOf( + URI("http://traces-node-v2:8545/").toURL() + ), + requestLimitPerEndpoint = 20U, + requestRetry = RequestRetryConfigTomlFriendly( + backoffDelay = Duration.parse("PT1S"), + failuresWarningThreshold = 2 + ) + ) + ), + proversConfig = proversConfig.copy( + proverA = proversConfig.proverA.copy( + execution = proversConfig.proverA.execution.copy( + requestsDirectory = Path.of("/data/prover/v3/execution/requests"), + responsesDirectory = Path.of("/data/prover/v3/execution/responses") + ), + blobCompression = proversConfig.proverA.blobCompression.copy( + requestsDirectory = Path.of("/data/prover/v3/compression/requests"), + responsesDirectory = Path.of("/data/prover/v3/compression/responses") + ), + proofAggregation = proversConfig.proverA.proofAggregation.copy( + requestsDirectory = Path.of("/data/prover/v3/aggregation/requests"), + responsesDirectory = Path.of("/data/prover/v3/aggregation/responses") + ) + ) + ) + ) + + assertEquals(expectedConfig, configs.reified()) + } + } + @Test fun invalidConfigReturnsErrorResult() { val configs = From c186d663e5d15c05319d324fb7a67787de684cd0 Mon Sep 17 00:00:00 2001 From: Bradley Bown Date: Mon, 14 Oct 2024 17:17:20 +0100 Subject: [PATCH 2/2] GHA - Single deployment for manual environment (#175) * New step for manual environment deployment, build and e2e tests need this job * Give manual-docker-build-and-e2e-tests job a step * Change ubuntu version to 20.04 * Remove environment from e2e test reusable workflow --------- Signed-off-by: Bradley Bown --- .../workflows/coordinator-build-and-publish.yml | 1 - .github/workflows/main.yml | 15 ++++++++++++--- .github/workflows/postman-build-and-publish.yml | 1 - .github/workflows/prover-build-and-publish.yml | 1 - .github/workflows/reuse-run-e2e-tests.yml | 1 - .../traces-api-facade-build-and-publish.yml | 1 - 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coordinator-build-and-publish.yml b/.github/workflows/coordinator-build-and-publish.yml index 022bddd1d..02a4f4bce 100644 --- a/.github/workflows/coordinator-build-and-publish.yml +++ b/.github/workflows/coordinator-build-and-publish.yml @@ -35,7 +35,6 @@ jobs: build-and-publish: runs-on: [self-hosted, ubuntu-20.04, X64, small] name: Coordinator build - environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }} env: COMMIT_TAG: ${{ inputs.commit_tag }} DEVELOP_TAG: ${{ inputs.develop_tag }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 97815b0bb..ba84d7b30 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -109,8 +109,17 @@ jobs: traces_api_facade_changed: ${{ needs.filter-commit-changes.outputs.traces-api-facade }} secrets: inherit - docker-build: + manual-docker-build-and-e2e-tests: + runs-on: [self-hosted, ubuntu-20.04, X64, small] needs: [ store-image-name-and-tags, filter-commit-changes, check-and-tag-images ] + environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }} + steps: + - name: Deploy environment + run: | + echo "Build and e2e test environment deployed" + + docker-build: + needs: [ store-image-name-and-tags, filter-commit-changes, check-and-tag-images, manual-docker-build-and-e2e-tests ] uses: ./.github/workflows/build-and-publish.yml with: commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }} @@ -153,7 +162,7 @@ jobs: secrets: inherit run-e2e-tests-geth-tracing: - needs: [ store-image-name-and-tags, docker-build ] + needs: [ store-image-name-and-tags, docker-build, manual-docker-build-and-e2e-tests ] if: ${{ always() && needs.docker-build.result == 'success' }} concurrency: group: run-e2e-tests-geth-tracing-${{ github.workflow }}-${{ github.ref }} @@ -167,7 +176,7 @@ jobs: secrets: inherit run-e2e-tests: - needs: [ store-image-name-and-tags, docker-build ] + needs: [ store-image-name-and-tags, docker-build, manual-docker-build-and-e2e-tests ] if: ${{ always() && needs.docker-build.result == 'success' }} concurrency: group: run-e2e-tests-${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/postman-build-and-publish.yml b/.github/workflows/postman-build-and-publish.yml index 114829d09..b72388022 100644 --- a/.github/workflows/postman-build-and-publish.yml +++ b/.github/workflows/postman-build-and-publish.yml @@ -35,7 +35,6 @@ jobs: build-and-publish: runs-on: [self-hosted, ubuntu-20.04, X64, small] name: Postman build - environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }} env: COMMIT_TAG: ${{ inputs.commit_tag }} DEVELOP_TAG: ${{ inputs.develop_tag }} diff --git a/.github/workflows/prover-build-and-publish.yml b/.github/workflows/prover-build-and-publish.yml index 353719b22..bae07ab60 100644 --- a/.github/workflows/prover-build-and-publish.yml +++ b/.github/workflows/prover-build-and-publish.yml @@ -38,7 +38,6 @@ jobs: build-and-publish: runs-on: [self-hosted, ubuntu-20.04, X64, small] name: Prover build - environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }} env: COMMIT_TAG: ${{ inputs.commit_tag }} DEVELOP_TAG: ${{ inputs.develop_tag }} diff --git a/.github/workflows/reuse-run-e2e-tests.yml b/.github/workflows/reuse-run-e2e-tests.yml index c646e9053..4df31eae4 100644 --- a/.github/workflows/reuse-run-e2e-tests.yml +++ b/.github/workflows/reuse-run-e2e-tests.yml @@ -76,7 +76,6 @@ jobs: outputs: tests_outcome: ${{ steps.run_e2e_tests.outcome }} runs-on: [self-hosted, ubuntu-22.04, X64, large] - environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }} steps: - name: Setup upterm session if: ${{ inputs.e2e-tests-with-ssh }} diff --git a/.github/workflows/traces-api-facade-build-and-publish.yml b/.github/workflows/traces-api-facade-build-and-publish.yml index f9079b454..e2dd28bbd 100644 --- a/.github/workflows/traces-api-facade-build-and-publish.yml +++ b/.github/workflows/traces-api-facade-build-and-publish.yml @@ -35,7 +35,6 @@ jobs: build-and-publish: runs-on: [self-hosted, ubuntu-20.04, X64, small] name: Traces api facade build - environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }} env: COMMIT_TAG: ${{ inputs.commit_tag }} DEVELOP_TAG: ${{ inputs.develop_tag }}