From 99e2a65d7835384beb2b0148aa22d1410c2d7812 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 20 May 2024 14:30:49 +0200 Subject: [PATCH] [TT-1046] Add Chainlink node test config as TOML (#13142) * use latest Seth * move test config to CTF * use latest CTF that fixes eth2 genesis generation * use latest Seth * use tagged CTF version * WIP#1 * WIP#2 * add automation-specifc node configuration to TOML * add node TOML config for OCR forwarders smoke tests * add CL node TOML configuration for keeper tests * add CL node TOML config for log poller * add OCR1/2 TOML config * add VRF* CL node TOML config * remove functional options for setting CL node config in tests, use TOML instead * go mod tidy * fix go mod * fix test env builder * increase node funding in runlog test * increase vrf node funding * add on-demand keeper smoke tests workflow * run keeper smoke tests once * fix int tests yaml? * [TT-922, TT-943] Migrate automation and log poller tests to Seth (#12688) * WIP#1 * fix load test * lints * lints again * uncomment tests * fix logtrigger mercury test * set privilege before starting consumer * WIP#2 * WIP#2 - with high concurrency upkeep registration fails * more or less working * WIP#4 * small fixes * fix lints * use latest Seth * Migrated keeper benchmark, kind of * migrate keeper smoke tests * bunch of optimisation * migrate automation chaos test * migrate log poller tests to Seth * use anysynced key with log poller * fix some of failing smoke tests * fix go mod * use correct Seth version * better automation some test structure * better automation some test structure * go mod * fix issues with missing LINK funds * fix keeper test * fix automation test * clean up, comments, migrate keeper benchmark test * mend * use latest Seth * cleanups, comments, etc * clean ups, automation tests + keeper tests now always test multiple contracts * use newer action version * debug results when upkeeps fails * run automation tests with post-failure debug * run automation tests with post-failure debug * better staleness report * more debug for basic automation tests * more assertions * try with sleep * increase performance check timeout to 3m * separate config from consumer start * more debug for performance chcek * try with just 1 contract * one more clean up * run keeper tests in CI to test them * solve automation load test registration failures * subscribe to headers in benchmark test to observe upkeeps * centralised ephemeral keys on testnet check, fixed keeper smoke tests, added root key buffer check * do not fail, when on testnet and ephemeral keys are !=0, set them 0 instead * don't fail in test config, display warning if eph addresses are set and set them to 0 * fix possible nil pointer, remove block range timeout, mutex for error appending * update seth version * use buffered channel to read subscription headers from EVM node * benchmark test increase RR mem and set DEBUG log level * use CTF's concurrent executor to deploy contracts in parallel * change architecture so that we have only 1 subscription and then we fan out the header to all goroutines; use SafeEVMHeader * benchmark test increase geth disk and gaslimit * decrease log level, latest seth and ctf * update CTF dependency * use concurrent executor in automation load test * remove local replace * add header subscription reconnect handling * print return funds error * limit automation load test deployment concurrency * latest Seth + fix gun * do not run keeper smoke tests on each commit anymore * add one more error message * use tagged CTF * use latest Seth * use latest Seth * fix go.mod * forget about smart reconnect, just do it in a loop * use latest Seth * check if context has error before executing any of contract calling wrapper functions * prettify code + latest Seth * update Seth * optional retrying of read-only contract calls; used only by keeper benchmark test * update Seth, estimate gas for funds sending * fix new automation test, update Seth to v1.0.7 * increase timeout * fix max price smoke test * fix CreateOCRKeeperJobs for v2.0 * remove resolved TODO * code review changes * code review changes * code review changes vol 2 * use CTF release version * bump mod version --------- Co-authored-by: anirudhwarrier <12178754+anirudhwarrier@users.noreply.github.com> * fix issue introduced by merge conflict * adjust keeper & automation TOML configs * restore old integration-tests workflow that doesn't run keeper tests * fix double log stream shutdown * add back clNodeOpts * use tagged CTF version --------- Co-authored-by: Ilja Pavlovs Co-authored-by: anirudhwarrier <12178754+anirudhwarrier@users.noreply.github.com> --- .../on-demand-keeper-smoke-tests.yml | 292 ++++++++++++++++++ .../docker/test_env/test_env_builder.go | 133 ++++---- integration-tests/smoke/automation_test.go | 58 ++-- integration-tests/smoke/forwarder_ocr_test.go | 1 - .../smoke/forwarders_ocr2_test.go | 7 - integration-tests/smoke/keeper_test.go | 12 - integration-tests/smoke/log_poller_test.go | 4 +- integration-tests/smoke/ocr2_test.go | 8 +- integration-tests/smoke/ocr2vrf_test.go | 1 + integration-tests/smoke/runlog_test.go | 2 +- integration-tests/smoke/vrf_test.go | 2 +- .../testconfig/automation/automation.toml | 45 +++ .../testconfig/automation/example.toml | 75 +++++ integration-tests/testconfig/default.toml | 58 ++++ .../testconfig/forwarder_ocr/example.toml | 168 ++++++++++ .../forwarder_ocr/forwarder_ocr.toml | 57 ++++ .../testconfig/forwarder_ocr2/example.toml | 168 ++++++++++ .../forwarder_ocr2/forwarder_ocr2.toml | 53 ++++ .../testconfig/functions/example.toml | 75 +++++ .../testconfig/keeper/example.toml | 67 ++++ .../testconfig/keeper/keeper.toml | 37 +++ .../testconfig/log_poller/config.go | 17 +- .../testconfig/log_poller/example.toml | 82 +++++ .../testconfig/log_poller/log_poller.toml | 113 ++++++- integration-tests/testconfig/ocr/example.toml | 71 +++++ integration-tests/testconfig/ocr/ocr.toml | 41 +++ .../testconfig/ocr2/example.toml | 71 +++++ integration-tests/testconfig/ocr2/ocr2.toml | 41 +++ integration-tests/testconfig/testconfig.go | 3 - integration-tests/testconfig/vrf/vrf.toml | 40 +++ .../testconfig/vrfv2/example.toml | 71 +++++ integration-tests/testconfig/vrfv2/vrfv2.toml | 43 ++- .../testconfig/vrfv2plus/example.toml | 71 +++++ .../testconfig/vrfv2plus/vrfv2plus.toml | 44 ++- integration-tests/types/config/node/core.go | 188 +++++------ .../universal/log_poller/helpers.go | 77 +---- 36 files changed, 1962 insertions(+), 334 deletions(-) create mode 100644 .github/workflows/on-demand-keeper-smoke-tests.yml create mode 100644 integration-tests/testconfig/forwarder_ocr/example.toml create mode 100644 integration-tests/testconfig/forwarder_ocr/forwarder_ocr.toml create mode 100644 integration-tests/testconfig/forwarder_ocr2/example.toml create mode 100644 integration-tests/testconfig/forwarder_ocr2/forwarder_ocr2.toml create mode 100644 integration-tests/testconfig/vrf/vrf.toml diff --git a/.github/workflows/on-demand-keeper-smoke-tests.yml b/.github/workflows/on-demand-keeper-smoke-tests.yml new file mode 100644 index 00000000000..6fee8bfc505 --- /dev/null +++ b/.github/workflows/on-demand-keeper-smoke-tests.yml @@ -0,0 +1,292 @@ +name: On Demand Keeper Smoke Tests +run-name: On Demand Keeper Smoke Tests ${{ inputs.distinct_run_name && inputs.distinct_run_name || '' }} +on: + workflow_dispatch: + inputs: + distinct_run_name: + description: 'A unique identifier for this run, only use from other repos' + required: false + type: string + +# Only run 1 of this workflow at a time per PR +concurrency: + group: on-demand-keeper-smoke-tests-${{ github.ref }}-${{ inputs.distinct_run_name }} + cancel-in-progress: true + +env: + # for run-test variables and environment + ENV_JOB_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-tests:${{ inputs.evm-ref || github.sha }} + CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink + TEST_SUITE: smoke + TEST_ARGS: -test.timeout 12m + INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com + MOD_CACHE_VERSION: 2 + COLLECTION_ID: chainlink-e2e-tests + +jobs: + build-chainlink: + environment: integration + permissions: + id-token: write + contents: read + strategy: + matrix: + image: + - name: "" + dockerfile: core/chainlink.Dockerfile + tag-suffix: "" + name: Build Chainlink Image ${{ matrix.image.name }} + runs-on: ubuntu22.04-16cores-64GB + needs: [changes] + steps: + - name: Collect Metrics + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0 + with: + id: ${{ env.COLLECTION_ID }}-build-chainlink + org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} + this-job-name: Build Chainlink Image ${{ matrix.image.name }} + continue-on-error: true + - name: Checkout the repo + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + - name: Build Chainlink Image + uses: ./.github/actions/build-chainlink-image + with: + tag_suffix: ${{ matrix.image.tag-suffix }} + dockerfile: ${{ matrix.image.dockerfile }} + git_commit_sha: ${{ inputs.evm-ref || github.sha }} + AWS_REGION: ${{ secrets.QA_AWS_REGION }} + AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} + dep_evm_sha: ${{ inputs.evm-ref }} + + compare-tests: + runs-on: ubuntu-latest + name: Build Automation Test List + outputs: + automation-matrix: ${{ env.AUTOMATION_JOB_MATRIX_JSON }} + steps: + - name: Checkout the repo + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref }} + - name: Compare Test Lists + run: | + cd ./integration-tests + ./scripts/compareTestList.sh ./smoke/keeper_test.go + - name: Build Test Matrix Lists + id: build-test-matrix-list + run: | + cd ./integration-tests + KEEPER_JOB_MATRIX_JSON=$(./scripts/buildTestMatrixList.sh ./smoke/keeper_test.go keeper ubuntu-latest 1) + echo "AUTOMATION_JOB_MATRIX_JSON=${KEEPER_JOB_MATRIX_JSON}" >> $GITHUB_ENV + + eth-smoke-tests-matrix-automation: + if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') }} + environment: integration + permissions: + checks: write + pull-requests: write + id-token: write + contents: read + needs: + [build-chainlink, compare-tests] + env: + SELECTED_NETWORKS: SIMULATED,SIMULATED_1,SIMULATED_2 + CHAINLINK_COMMIT_SHA: ${{ inputs.evm-ref || github.sha }} + CHAINLINK_ENV_USER: ${{ github.actor }} + TEST_LOG_LEVEL: debug + strategy: + fail-fast: false + matrix: + product: ${{fromJson(needs.compare-tests.outputs.automation-matrix)}} + runs-on: ${{ matrix.product.os }} + name: ETH Smoke Tests ${{ matrix.product.name }} + steps: + - name: Collect Metrics + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0 + with: + id: ${{ env.COLLECTION_ID }}-matrix-${{ matrix.product.name }} + basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} + org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + this-job-name: ETH Smoke Tests ${{ matrix.product.name }} + test-results-file: '{"testType":"go","filePath":"/tmp/gotest.log"}' + continue-on-error: true + - name: Checkout the repo + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + - name: Build Go Test Command + id: build-go-test-command + run: | + # if the matrix.product.run is set, use it for a different command + if [ "${{ matrix.product.run }}" != "" ]; then + echo "run_command=${{ matrix.product.run }} ./smoke/${{ matrix.product.file }}_test.go" >> "$GITHUB_OUTPUT" + else + echo "run_command=./smoke/${{ matrix.product.name }}_test.go" >> "$GITHUB_OUTPUT" + fi + - name: Prepare Base64 TOML override + uses: ./.github/actions/setup-create-base64-config + with: + runId: ${{ github.run_id }} + testLogCollect: ${{ vars.TEST_LOG_COLLECT }} + selectedNetworks: ${{ env.SELECTED_NETWORKS }} + chainlinkImage: ${{ env.CHAINLINK_IMAGE }} + chainlinkVersion: ${{ inputs.evm-ref || github.sha }} + pyroscopeServer: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725 + pyroscopeEnvironment: ${{ matrix.product.pyroscope_env }} + pyroscopeKey: ${{ secrets.QA_PYROSCOPE_KEY }} + lokiEndpoint: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push + lokiTenantId: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + lokiBasicAuth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + logstreamLogTargets: ${{ vars.LOGSTREAM_LOG_TARGETS }} + grafanaUrl: ${{ vars.GRAFANA_URL }} + grafanaDashboardUrl: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" + + ## Run this step when changes that require tests to be run are made + - name: Run Tests + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@519851800779323566b7b7c22cc21bff95dbb639 + with: + test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.product.nodes }} ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage + test_download_vendor_packages_command: cd ./integration-tests && go mod download + cl_repo: ${{ env.CHAINLINK_IMAGE }} + cl_image_tag: ${{ inputs.evm-ref || github.sha }} + aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} + artifacts_name: ${{ matrix.product.name }}-test-logs + artifacts_location: | + ./integration-tests/smoke/logs/ + /tmp/gotest.log + publish_check_name: ${{ matrix.product.name }} + token: ${{ secrets.GITHUB_TOKEN }} + go_mod_path: ./integration-tests/go.mod + cache_key_id: core-e2e-${{ env.MOD_CACHE_VERSION }} + cache_restore_only: "true" + QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} + QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} + QA_KUBECONFIG: "" + should_tidy: "false" + go_coverage_src_dir: /var/tmp/go-coverage + go_coverage_dest_dir: ${{ github.workspace }}/.covdata + + - name: Upload Coverage Data + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: cl-node-coverage-data-${{ matrix.product.name }} + path: .covdata + retention-days: 1 + + - name: Print failed test summary + if: always() + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/show-test-summary@5dd916d08c03cb5f9a97304f4f174820421bb946 # v2.3.11 + + ### Used to check the required checks box when the matrix completes + eth-smoke-tests: + if: always() + runs-on: ubuntu-latest + name: ETH Smoke Tests + needs: [eth-smoke-tests-matrix-automation] + steps: + - name: Check smoke test matrix status + if: needs.eth-smoke-tests-matrix-automation.result != 'success' + run: | + echo "Automation: ${{ needs.eth-smoke-tests-matrix-automation.result }}" + exit 1 + - name: Collect Metrics + if: always() + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0 + with: + id: ${{ env.COLLECTION_ID }}-matrix-results + org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} + this-job-name: ETH Smoke Tests + matrix-aggregator-status: ${{ needs.eth-smoke-tests-matrix.result }} + continue-on-error: true + + cleanup: + name: Clean up integration environment deployments + if: always() + needs: [eth-smoke-tests] + runs-on: ubuntu-latest + steps: + - name: Checkout repo + if: ${{ github.event_name == 'pull_request' }} + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref }} + + - name: 🧼 Clean up Environment + if: ${{ github.event_name == 'pull_request' }} + uses: ./.github/actions/delete-deployments + with: + environment: integration + ref: ${{ github.head_ref }} # See https://github.com/github/docs/issues/15319#issuecomment-1476705663 + + - name: Collect Metrics + if: ${{ github.event_name == 'pull_request' }} + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0 + with: + id: ${{ env.COLLECTION_ID }}-env-cleanup + org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} + this-job-name: Clean up integration environment deployments + continue-on-error: true + + show-coverage: + name: Show Chainlink Node Go Coverage + if: always() + needs: [cleanup] + runs-on: ubuntu-latest + steps: + - name: Checkout the repo + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + - name: Download All Artifacts + uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6 + with: + path: cl-node-coverage-data + pattern: cl-node-coverage-data-* + merge-multiple: true + - name: Show Coverage + run: go run ./integration-tests/scripts/show_coverage.go "${{ github.workspace }}/cl-node-coverage-data/*/merged" + + # Run the setup if the matrix finishes but this time save the cache if we have a cache hit miss + # this will also only run if both of the matrix jobs pass + eth-smoke-go-mod-cache: + + environment: integration + needs: [eth-smoke-tests] + runs-on: ubuntu-latest + name: ETH Smoke Tests Go Mod Cache + continue-on-error: true + steps: + - name: Checkout the repo + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + - name: Run Setup + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@5dd916d08c03cb5f9a97304f4f174820421bb946 # v2.3.11 + with: + test_download_vendor_packages_command: | + cd ./integration-tests + go mod download + # force download of test dependencies + go test -run=NonExistentTest ./smoke/... || echo "ignore expected test failure" + go_mod_path: ./integration-tests/go.mod + cache_key_id: core-e2e-${{ env.MOD_CACHE_VERSION }} + cache_restore_only: "false" \ No newline at end of file diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index ebc8fb3f78e..ad3b75a3ca4 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -23,12 +23,12 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink-testing-framework/testreporters" "github.com/smartcontractkit/chainlink-testing-framework/utils/osutil" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" actions_seth "github.com/smartcontractkit/chainlink/integration-tests/actions/seth" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" + "github.com/smartcontractkit/chainlink/integration-tests/utils" ) type CleanUpType string @@ -48,7 +48,6 @@ type ChainlinkNodeLogScannerSettings struct { type CLTestEnvBuilder struct { hasLogStream bool hasKillgrave bool - hasForwarders bool hasSeth bool hasEVMClient bool clNodeConfig *chainlink.Config @@ -60,10 +59,9 @@ type CLTestEnvBuilder struct { l zerolog.Logger t *testing.T te *CLClusterTestEnv - isNonEVM bool + isEVM bool cleanUpType CleanUpType cleanUpCustomFn func() - chainOptionsFn []ChainOption evmNetworkOption []EVMNetworkOption privateEthereumNetworks []*ctf_config.EthereumNetworkConfig testConfig ctf_config.GlobalTestConfig @@ -98,6 +96,7 @@ func NewCLTestEnvBuilder() *CLTestEnvBuilder { l: log.Logger, hasLogStream: true, hasEVMClient: true, + isEVM: true, chainlinkNodeLogScannerSettings: &DefaultChainlinkNodeLogScannerSettings, } } @@ -171,11 +170,6 @@ func (b *CLTestEnvBuilder) WithCLNodeOptions(opt ...ClNodeOption) *CLTestEnvBuil return b } -func (b *CLTestEnvBuilder) WithForwarders() *CLTestEnvBuilder { - b.hasForwarders = true - return b -} - func (b *CLTestEnvBuilder) WithFunding(eth *big.Float) *CLTestEnvBuilder { b.ETHFunds = eth return b @@ -187,6 +181,12 @@ func (b *CLTestEnvBuilder) WithSeth() *CLTestEnvBuilder { return b } +func (b *CLTestEnvBuilder) WithoutEvmClients() *CLTestEnvBuilder { + b.hasSeth = false + b.hasEVMClient = false + return b +} + func (b *CLTestEnvBuilder) WithPrivateEthereumNetwork(en ctf_config.EthereumNetworkConfig) *CLTestEnvBuilder { b.privateEthereumNetworks = append(b.privateEthereumNetworks, &en) return b @@ -197,6 +197,7 @@ func (b *CLTestEnvBuilder) WithPrivateEthereumNetworks(ens []*ctf_config.Ethereu return b } +// Deprecated: Use TOML instead func (b *CLTestEnvBuilder) WithCLNodeConfig(cfg *chainlink.Config) *CLTestEnvBuilder { b.clNodeConfig = cfg return b @@ -214,7 +215,7 @@ func (b *CLTestEnvBuilder) WithMockAdapter() *CLTestEnvBuilder { // WithNonEVM sets the test environment to not use EVM when built. func (b *CLTestEnvBuilder) WithNonEVM() *CLTestEnvBuilder { - b.isNonEVM = true + b.isEVM = false return b } @@ -234,18 +235,12 @@ func (b *CLTestEnvBuilder) WithCustomCleanup(customFn func()) *CLTestEnvBuilder return b } -type ChainOption = func(*evmcfg.Chain) *evmcfg.Chain - -func (b *CLTestEnvBuilder) WithChainOptions(opts ...ChainOption) *CLTestEnvBuilder { - b.chainOptionsFn = make([]ChainOption, 0) - b.chainOptionsFn = append(b.chainOptionsFn, opts...) - - return b -} - type EVMNetworkOption = func(*blockchain.EVMNetwork) *blockchain.EVMNetwork -func (b *CLTestEnvBuilder) EVMNetworkOptions(opts ...EVMNetworkOption) *CLTestEnvBuilder { +// WithEVMNetworkOptions sets the options for the EVM network. This is especially useful for simulated networks, which +// by usually use default options, so if we want to change any of them before the configuration is passed to evm client +// or Chainlnik node, we can do it here. +func (b *CLTestEnvBuilder) WithEVMNetworkOptions(opts ...EVMNetworkOption) *CLTestEnvBuilder { b.evmNetworkOption = make([]EVMNetworkOption, 0) b.evmNetworkOption = append(b.evmNetworkOption, opts...) @@ -285,7 +280,7 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { } // this clean up has to be added as the FIRST one, because cleanup functions are executed in reverse order (LIFO) - if b.t != nil { + if b.t != nil && b.cleanUpType == CleanUpTypeStandard { b.t.Cleanup(func() { b.l.Info().Msg("Shutting down LogStream") logPath, err := osutil.GetAbsoluteFolderPath("logs") @@ -344,6 +339,8 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { scanClNodeLogs() } }) + } else { + b.l.Warn().Msg("LogStream won't be cleaned up, because test instance is not set or cleanup type is not standard") } } @@ -381,7 +378,7 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { } if b.te.LogStream != nil { - // this is not the cleanest way to do this, but when we originally build ethereum networks, we don't have the logstream reference + // this is not the cleanest way to do this, but when we originally build ethereum networks, we don't have the logstream reference, // so we need to rebuild them here and pass logstream to them for i := range b.privateEthereumNetworks { builder := test_env.NewEthereumNetworkBuilder() @@ -431,9 +428,26 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { b.te.rpcProviders[networkConfig.ChainID] = &rpcProvider b.te.EVMNetworks = append(b.te.EVMNetworks, &networkConfig) + } + dereferrencedEvms := make([]blockchain.EVMNetwork, 0) + for _, en := range b.te.EVMNetworks { + dereferrencedEvms = append(dereferrencedEvms, *en) } - err = b.te.StartClCluster(b.clNodeConfig, b.clNodesCount, b.secretsConfig, b.testConfig, b.clNodesOpts...) + + nodeConfigInToml := b.testConfig.GetNodeConfig() + + nodeConfig, _, err := node.BuildChainlinkNodeConfig( + dereferrencedEvms, + nodeConfigInToml.BaseConfigTOML, + nodeConfigInToml.CommonChainConfigTOML, + nodeConfigInToml.ChainConfigTOMLByChainID, + ) + if err != nil { + return nil, err + } + + err = b.te.StartClCluster(nodeConfig, b.clNodesCount, b.secretsConfig, b.testConfig, b.clNodesOpts...) if err != nil { return nil, err } @@ -473,18 +487,19 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { b.te.rpcProviders[networkConfig.ChainID] = &rpcProvider b.te.isSimulatedNetwork = false } + b.te.EVMNetworks = append(b.te.EVMNetworks, &networkConfig) } if !b.hasSeth && !b.hasEVMClient { - return nil, errors.New("you need to specify, which evm client to use: Seth or EVMClient") + log.Debug().Msg("No EVM client or SETH client specified, not starting any clients") } if b.hasSeth && b.hasEVMClient { return nil, errors.New("you can't use both Seth and EMVClient at the same time") } - if !b.isNonEVM { + if b.isEVM { if b.evmNetworkOption != nil && len(b.evmNetworkOption) > 0 { for _, fn := range b.evmNetworkOption { fn(&networkConfig) @@ -514,12 +529,21 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { if b.hasSeth { b.te.sethClients = make(map[int64]*seth.Client) - seth, err := actions_seth.GetChainClient(b.testConfig, networkConfig) + readSethCfg := b.testConfig.GetSethConfig() + sethCfg, err := utils.MergeSethAndEvmNetworkConfigs(networkConfig, *readSethCfg) + if err != nil { + return nil, err + } + err = utils.ValidateSethNetworkConfig(sethCfg.Network) + if err != nil { + return nil, err + } + sethClient, err := actions_seth.GetChainClient(b.testConfig, networkConfig) if err != nil { return nil, err } - b.te.sethClients[networkConfig.ChainID] = seth + b.te.sethClients[networkConfig.ChainID] = sethClient } } @@ -527,44 +551,33 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { // Start Chainlink Nodes if b.clNodesCount > 0 { - var cfg *chainlink.Config - if b.clNodeConfig != nil { - cfg = b.clNodeConfig - } else { - cfg = node.NewConfig(node.NewBaseConfig(), - node.WithOCR1(), - node.WithP2Pv2(), - ) - } - - if !b.isNonEVM { - var httpUrls []string - var wsUrls []string - rpcProvider, ok := b.te.rpcProviders[networkConfig.ChainID] - if !ok { - return nil, fmt.Errorf("rpc provider for chain %d not found", networkConfig.ChainID) - } - if networkConfig.Simulated { - httpUrls = rpcProvider.PrivateHttpUrls() - wsUrls = rpcProvider.PrivateWsUrsl() - } else { - httpUrls = networkConfig.HTTPURLs - wsUrls = networkConfig.URLs + dereferrencedEvms := make([]blockchain.EVMNetwork, 0) + for _, en := range b.te.EVMNetworks { + network := *en + if en.Simulated { + if rpcs, ok := b.te.rpcProviders[network.ChainID]; ok { + network.HTTPURLs = rpcs.PrivateHttpUrls() + network.URLs = rpcs.PrivateWsUrsl() + } else { + return nil, fmt.Errorf("rpc provider for chain %d not found", network.ChainID) + } } + dereferrencedEvms = append(dereferrencedEvms, network) + } - node.SetChainConfig(cfg, wsUrls, httpUrls, networkConfig, b.hasForwarders) + nodeConfigInToml := b.testConfig.GetNodeConfig() - if b.chainOptionsFn != nil && len(b.chainOptionsFn) > 0 { - for _, fn := range b.chainOptionsFn { - for _, evmCfg := range cfg.EVM { - chainCfg := evmCfg.Chain - fn(&chainCfg) - } - } - } + nodeConfig, _, err := node.BuildChainlinkNodeConfig( + dereferrencedEvms, + nodeConfigInToml.BaseConfigTOML, + nodeConfigInToml.CommonChainConfigTOML, + nodeConfigInToml.ChainConfigTOMLByChainID, + ) + if err != nil { + return nil, err } - err := b.te.StartClCluster(cfg, b.clNodesCount, b.secretsConfig, b.testConfig, b.clNodesOpts...) + err = b.te.StartClCluster(nodeConfig, b.clNodesCount, b.secretsConfig, b.testConfig, b.clNodesOpts...) if err != nil { return nil, err } diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 2c5295326bc..cafeea67c19 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -20,11 +20,9 @@ import ( ocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper" ocr2keepers30config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config" - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" ctfTestEnv "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" - "github.com/smartcontractkit/chainlink-testing-framework/utils/ptr" "github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -34,7 +32,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" "github.com/smartcontractkit/chainlink/integration-tests/types" - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" ac "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/automation_compatible_utils" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/gasprice" @@ -1353,17 +1350,6 @@ func setupAutomationTestDocker( registryConfig.RegistryVersion = registryVersion network := networks.MustGetSelectedNetworkConfig(automationTestConfig.GetNetworkConfig())[0] - // build the node config - clNodeConfig := node.NewConfig(node.NewBaseConfig()) - syncInterval := *commonconfig.MustNewDuration(5 * time.Minute) - clNodeConfig.Feature.LogPoller = ptr.Ptr[bool](true) - clNodeConfig.OCR2.Enabled = ptr.Ptr[bool](true) - clNodeConfig.Keeper.TurnLookBack = ptr.Ptr[int64](int64(0)) - clNodeConfig.Keeper.Registry.SyncInterval = &syncInterval - clNodeConfig.Keeper.Registry.PerformGasOverhead = ptr.Ptr[uint32](uint32(150000)) - clNodeConfig.P2P.V2.AnnounceAddresses = &[]string{"0.0.0.0:6690"} - clNodeConfig.P2P.V2.ListenAddresses = &[]string{"0.0.0.0:6690"} - //launch the environment var env *test_env.CLClusterTestEnv var err error @@ -1375,14 +1361,13 @@ func setupAutomationTestDocker( require.NoError(t, err, "Error building ethereum network config") if isMercuryV02 || isMercuryV03 { - env, err = test_env.NewCLTestEnvBuilder(). + // start mock adapter only + mockAdapterEnv, err := test_env.NewCLTestEnvBuilder(). WithTestInstance(t). WithTestConfig(automationTestConfig). - WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithMockAdapter(). - WithFunding(big.NewFloat(*automationTestConfig.GetCommonConfig().ChainlinkNodeFunding)). - WithStandardCleanup(). - WithSeth(). + WithoutEvmClients(). + WithoutCleanup(). Build() require.NoError(t, err, "Error deploying test environment for Mercury") @@ -1392,28 +1377,24 @@ func setupAutomationTestDocker( URL = '%s' Username = 'node' Password = 'nodepass'` - secretsConfig = fmt.Sprintf(secretsConfig, env.MockAdapter.InternalEndpoint, env.MockAdapter.InternalEndpoint) - - rpcProvider, err := env.GetRpcProvider(network.ChainID) - require.NoError(t, err, "Error getting rpc provider") - - var httpUrls []string - var wsUrls []string - if network.Simulated { - httpUrls = []string{rpcProvider.PrivateHttpUrls()[0]} - wsUrls = []string{rpcProvider.PrivateWsUrsl()[0]} - } else { - httpUrls = network.HTTPURLs - wsUrls = network.URLs - } + secretsConfig = fmt.Sprintf(secretsConfig, mockAdapterEnv.MockAdapter.InternalEndpoint, mockAdapterEnv.MockAdapter.InternalEndpoint) - node.SetChainConfig(clNodeConfig, wsUrls, httpUrls, network, false) + builder, err := test_env.NewCLTestEnvBuilder().WithTestEnv(mockAdapterEnv) + require.NoError(t, err, "Error building test environment for Mercury") - err = env.StartClCluster(clNodeConfig, clNodesCount, secretsConfig, automationTestConfig) - require.NoError(t, err, "Error starting CL nodes test environment for Mercury") - err = env.FundChainlinkNodes(big.NewFloat(*automationTestConfig.GetCommonConfig().ChainlinkNodeFunding)) - require.NoError(t, err, "Error funding CL nodes") + env, err = builder. + WithTestInstance(t). + WithTestConfig(automationTestConfig). + WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). + WithSecretsConfig(secretsConfig). + WithCLNodes(clNodesCount). + WithFunding(big.NewFloat(*automationTestConfig.GetCommonConfig().ChainlinkNodeFunding)). + WithStandardCleanup(). + WithSeth(). + Build() + require.NoError(t, err, "Error deploying test environment for Mercury") + env.MockAdapter = mockAdapterEnv.MockAdapter } else { env, err = test_env.NewCLTestEnvBuilder(). WithTestInstance(t). @@ -1421,7 +1402,6 @@ func setupAutomationTestDocker( WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithMockAdapter(). WithCLNodes(clNodesCount). - WithCLNodeConfig(clNodeConfig). WithFunding(big.NewFloat(*automationTestConfig.GetCommonConfig().ChainlinkNodeFunding)). WithStandardCleanup(). WithSeth(). diff --git a/integration-tests/smoke/forwarder_ocr_test.go b/integration-tests/smoke/forwarder_ocr_test.go index 0446254362a..2cae2ec3f45 100644 --- a/integration-tests/smoke/forwarder_ocr_test.go +++ b/integration-tests/smoke/forwarder_ocr_test.go @@ -37,7 +37,6 @@ func TestForwarderOCRBasic(t *testing.T) { WithTestConfig(&config). WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithMockAdapter(). - WithForwarders(). WithCLNodes(6). WithFunding(big.NewFloat(.1)). WithStandardCleanup(). diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index 00fd3583ea6..a8d0e1987fe 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -18,8 +18,6 @@ import ( actions_seth "github.com/smartcontractkit/chainlink/integration-tests/actions/seth" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" ) @@ -40,11 +38,6 @@ func TestForwarderOCR2Basic(t *testing.T) { WithTestConfig(&config). WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithMockAdapter(). - WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), - node.WithOCR2(), - node.WithP2Pv2(), - )). - WithForwarders(). WithCLNodes(6). WithFunding(big.NewFloat(.1)). WithStandardCleanup(). diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index 00e45256cea..99817562c62 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -14,7 +14,6 @@ import ( "github.com/smartcontractkit/seth" "github.com/stretchr/testify/require" - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext" @@ -25,8 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" ) @@ -1231,14 +1228,6 @@ func setupKeeperTest(l zerolog.Logger, t *testing.T, config *tc.TestConfig) ( contracts.LinkToken, *test_env.CLClusterTestEnv, ) { - clNodeConfig := node.NewConfig(node.NewBaseConfig(), node.WithP2Pv2()) - turnLookBack := int64(0) - syncInterval := *commonconfig.MustNewDuration(5 * time.Second) - performGasOverhead := uint32(150000) - clNodeConfig.Keeper.TurnLookBack = &turnLookBack - clNodeConfig.Keeper.Registry.SyncInterval = &syncInterval - clNodeConfig.Keeper.Registry.PerformGasOverhead = &performGasOverhead - privateNetwork, err := actions.EthereumNetworkConfigFromConfig(l, config) require.NoError(t, err, "Error building ethereum network config") @@ -1247,7 +1236,6 @@ func setupKeeperTest(l zerolog.Logger, t *testing.T, config *tc.TestConfig) ( WithTestConfig(config). WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithCLNodes(5). - WithCLNodeConfig(clNodeConfig). WithFunding(big.NewFloat(.5)). WithStandardCleanup(). WithSeth(). diff --git a/integration-tests/smoke/log_poller_test.go b/integration-tests/smoke/log_poller_test.go index 04327471e7f..4ddffab30a6 100644 --- a/integration-tests/smoke/log_poller_test.go +++ b/integration-tests/smoke/log_poller_test.go @@ -211,7 +211,7 @@ func executeLogPollerReplay(t *testing.T, consistencyTimeout string) { eb, err := sethClient.Client.BlockNumber(testcontext.Get(t)) require.NoError(t, err, "Error getting latest block number") - endBlock, err := logpoller.GetEndBlockToWaitFor(int64(eb), sethClient.ChainID, cfg) + endBlock, err := logpoller.GetEndBlockToWaitFor(int64(eb), network, cfg) require.NoError(t, err, "Error getting end block to wait for") l.Info().Int64("Ending Block", endBlock).Int("Total logs emitted", totalLogsEmitted).Int64("Expected total logs emitted", expectedLogsEmitted).Str("Duration", fmt.Sprintf("%d sec", duration)).Str("LPS", fmt.Sprintf("%d/sec", totalLogsEmitted/duration)).Msg("FINISHED EVENT EMISSION") @@ -292,8 +292,6 @@ func prepareEnvironment(l zerolog.Logger, t *testing.T, testConfig *tc.TestConfi ethereum.RegistryVersion_2_1, logpoller.DefaultOCRRegistryConfig, upKeepsNeeded, - cfg.General.LogPollInterval.Duration, - *cfg.General.BackupLogPollerBlockDelay, *cfg.General.UseFinalityTag, testConfig, logScannerSettings, diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index ba9cb5f5775..0e1a5c96633 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -24,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" ) type ocr2test struct { @@ -154,13 +153,8 @@ func prepareORCv2SmokeTestEnv(t *testing.T, testData ocr2test, l zerolog.Logger, WithTestConfig(&config). WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithMockAdapter(). - WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), - node.WithOCR2(), - node.WithP2Pv2(), - node.WithTracing(), - )). - WithCLNodeOptions(test_env.WithNodeEnvVars(testData.env)). WithCLNodes(clNodeCount). + WithCLNodeOptions(test_env.WithNodeEnvVars(testData.env)). WithFunding(big.NewFloat(.1)). WithStandardCleanup(). WithSeth(). diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go index bf4f5804e99..83b96828444 100644 --- a/integration-tests/smoke/ocr2vrf_test.go +++ b/integration-tests/smoke/ocr2vrf_test.go @@ -33,6 +33,7 @@ var ocr2vrfSmokeConfig *testconfig.TestConfig func TestOCR2VRFRedeemModel(t *testing.T) { t.Parallel() + // remember to add TOML config for Chainlink node before trying to run this test in future t.Skip("VRFv3 is on pause, skipping") l := logging.GetTestLogger(t) config, err := testconfig.GetConfig("Smoke", testconfig.OCR2) diff --git a/integration-tests/smoke/runlog_test.go b/integration-tests/smoke/runlog_test.go index b01c5a019b1..3e806fc690b 100644 --- a/integration-tests/smoke/runlog_test.go +++ b/integration-tests/smoke/runlog_test.go @@ -39,7 +39,7 @@ func TestRunLogBasic(t *testing.T) { WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithMockAdapter(). WithCLNodes(1). - WithFunding(big.NewFloat(.1)). + WithFunding(big.NewFloat(.5)). WithStandardCleanup(). WithSeth(). Build() diff --git a/integration-tests/smoke/vrf_test.go b/integration-tests/smoke/vrf_test.go index 70911e8de66..1cc7bf73d69 100644 --- a/integration-tests/smoke/vrf_test.go +++ b/integration-tests/smoke/vrf_test.go @@ -196,7 +196,7 @@ func prepareVRFtestEnv(t *testing.T, l zerolog.Logger) (*test_env.CLClusterTestE WithTestConfig(&config). WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithCLNodes(1). - WithFunding(big.NewFloat(.1)). + WithFunding(big.NewFloat(.5)). WithStandardCleanup(). WithSeth(). Build() diff --git a/integration-tests/testconfig/automation/automation.toml b/integration-tests/testconfig/automation/automation.toml index 4df2cbebc52..86eb279de39 100644 --- a/integration-tests/testconfig/automation/automation.toml +++ b/integration-tests/testconfig/automation/automation.toml @@ -2,6 +2,51 @@ [Common] chainlink_node_funding = 0.5 +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true + +[P2P] +[P2P.V2] +Enabled = true +ListenAddresses = ['0.0.0.0:6690'] +AnnounceAddresses = ['0.0.0.0:6690'] +DeltaDial = '500ms' +DeltaReconcile = '5s' +""" + # smoke test specific overrodes [Smoke.Automation.AutomationConfig] use_log_buffer_v1=false diff --git a/integration-tests/testconfig/automation/example.toml b/integration-tests/testconfig/automation/example.toml index 7a3d33951ba..56d84cceeef 100644 --- a/integration-tests/testconfig/automation/example.toml +++ b/integration-tests/testconfig/automation/example.toml @@ -69,6 +69,81 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true + +[P2P] +[P2P.V2] +Enabled = true +ListenAddresses = ['0.0.0.0:6690'] +AnnounceAddresses = ['0.0.0.0:6690'] +DeltaDial = '500ms' +DeltaReconcile = '5s' +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # Common [Common] chainlink_node_funding = 0.5 diff --git a/integration-tests/testconfig/default.toml b/integration-tests/testconfig/default.toml index 6ca5d4aec28..07017bc140d 100644 --- a/integration-tests/testconfig/default.toml +++ b/integration-tests/testconfig/default.toml @@ -29,6 +29,64 @@ addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] [PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] Deneb=500 +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true +DefaultTransactionQueueDepth = 0 + +[P2P] +[P2P.V2] +Enabled = true +ListenAddresses = ['0.0.0.0:6690'] +AnnounceAddresses = ['0.0.0.0:6690'] +DeltaDial = '500ms' +DeltaReconcile = '5s' +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + [Seth] # controls which transactions are decoded/traced. Possbile values are: none, all, reverted (default). # if transaction level doesn't match, then calling Decode() does nothing. It's advised to keep it set diff --git a/integration-tests/testconfig/forwarder_ocr/example.toml b/integration-tests/testconfig/forwarder_ocr/example.toml new file mode 100644 index 00000000000..469b765b1db --- /dev/null +++ b/integration-tests/testconfig/forwarder_ocr/example.toml @@ -0,0 +1,168 @@ +# Example of full config with all fields +# General part +[ChainlinkImage] +image="public.ecr.aws/chainlink/chainlink" +version="2.7.0" + +[Logging] +# if set to true will save logs even if test did not fail +test_log_collect=false + +[Logging.LogStream] +# supported targets: file, loki, in-memory. if empty no logs will be persistet +log_targets=["file"] +# context timeout for starting log producer and also time-frame for requesting logs +log_producer_timeout="10s" +# number of retries before log producer gives up and stops listening to logs +log_producer_retry_limit=10 + +[Logging.Loki] +tenant_id="tenant_id" +# full URL of Loki ingest endpoint +endpoint="https://loki.url/api/v3/push" +# currently only needed when using public instance +basic_auth_secret="loki-basic-auth" +# only needed for cloud grafana +bearer_token_secret="bearer_token" + +# LogStream will try to shorten Grafana URLs by default (if all 3 variables are set) +[Logging.Grafana] +# grafana url (trailing "/" will be stripped) +base_url="http://grafana.url" +# url of your grafana dashboard (prefix and suffix "/" are stirpped), example: /d/ad61652-2712-1722/my-dashboard +dashboard_url="/d/your-dashboard" +bearer_token_secret="my-awesome-token" + +# if you want to use polygon_mumbial +[Network] +selected_networks=["polygon_mumbai"] + +[Network.RpcHttpUrls] +polygon_mumbai = ["https://my-rpc-endpoint.io"] + +[Network.RpcWsUrls] +polygon_mumbai = ["https://my-rpc-endpoint.io"] + +[Network.WalletKeys] +polygon_mumbai = ["change-me-to-your-PK"] + +[PrivateEthereumNetwork] +# pos or pow +consensus_type="pos" +# only prysm supported currently +consensus_layer="prysm" +# geth, besu, nethermind or erigon +execution_layer="geth" +# if true after env started it will wait for at least 1 epoch to be finalised before continuing +wait_for_finalization=false + +[PrivateEthereumNetwork.EthereumChainConfig] +# duration of single slot, lower => faster block production, must be >= 4 +seconds_per_slot=12 +# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 +slots_per_epoch=6 +# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts +genesis_delay=15 +# number of validators in the network +validator_count=8 +chain_id=1337 +# list of addresses to be prefunded in genesis +addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] + +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true +DefaultTransactionQueueDepth = 0 + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + +# load test specific configuration +[Load.OCR] +[Load.OCR.Common] +eth_funds = 3 + +[Load.OCR.Load] +test_duration = "3m" +rate_limit_unit_duration = "1m" +rate = 3 +verification_interval = "5s" +verification_timeout = "3m" +ea_change_interval = "5s" + +# soak test specific configuration +[Soak.Common] +chainlink_node_funding = 100 + +[Soak.OCR] +[Soak.OCR.Common] +test_duration="15m" + +[Soak.OCR.Soak] +ocr_version="1" +number_of_contracts=2 +time_between_rounds="1m" \ No newline at end of file diff --git a/integration-tests/testconfig/forwarder_ocr/forwarder_ocr.toml b/integration-tests/testconfig/forwarder_ocr/forwarder_ocr.toml new file mode 100644 index 00000000000..f38cb4f5c4b --- /dev/null +++ b/integration-tests/testconfig/forwarder_ocr/forwarder_ocr.toml @@ -0,0 +1,57 @@ +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true +DefaultTransactionQueueDepth = 0 + +[P2P] +[P2P.V2] +Enabled = true +ListenAddresses = ['0.0.0.0:6690'] +AnnounceAddresses = ['0.0.0.0:6690'] +DeltaDial = '500ms' +DeltaReconcile = '5s' +""" + +[NodeConfig.ChainConfigTOMLByChainID] +1337 = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[Transactions] +ForwardersEnabled = true + """ + + diff --git a/integration-tests/testconfig/forwarder_ocr2/example.toml b/integration-tests/testconfig/forwarder_ocr2/example.toml new file mode 100644 index 00000000000..2bd03827506 --- /dev/null +++ b/integration-tests/testconfig/forwarder_ocr2/example.toml @@ -0,0 +1,168 @@ +# Example of full config with all fields +# General part +[ChainlinkImage] +image="public.ecr.aws/chainlink/chainlink" +version="2.7.0" + +[Logging] +# if set to true will save logs even if test did not fail +test_log_collect=false + +[Logging.LogStream] +# supported targets: file, loki, in-memory. if empty no logs will be persistet +log_targets=["file"] +# context timeout for starting log producer and also time-frame for requesting logs +log_producer_timeout="10s" +# number of retries before log producer gives up and stops listening to logs +log_producer_retry_limit=10 + +[Logging.Loki] +tenant_id="tenant_id" +# full URL of Loki ingest endpoint +endpoint="https://loki.url/api/v3/push" +# currently only needed when using public instance +basic_auth_secret="loki-basic-auth" +# only needed for cloud grafana +bearer_token_secret="bearer_token" + +# LogStream will try to shorten Grafana URLs by default (if all 3 variables are set) +[Logging.Grafana] +# grafana url (trailing "/" will be stripped) +base_url="http://grafana.url" +# url of your grafana dashboard (prefix and suffix "/" are stirpped), example: /d/ad61652-2712-1722/my-dashboard +dashboard_url="/d/your-dashboard" +bearer_token_secret="my-awesome-token" + +# if you want to use polygon_mumbial +[Network] +selected_networks=["polygon_mumbai"] + +[Network.RpcHttpUrls] +polygon_mumbai = ["https://my-rpc-endpoint.io"] + +[Network.RpcWsUrls] +polygon_mumbai = ["https://my-rpc-endpoint.io"] + +[Network.WalletKeys] +polygon_mumbai = ["change-me-to-your-PK"] + +[PrivateEthereumNetwork] +# pos or pow +consensus_type="pos" +# only prysm supported currently +consensus_layer="prysm" +# geth, besu, nethermind or erigon +execution_layer="geth" +# if true after env started it will wait for at least 1 epoch to be finalised before continuing +wait_for_finalization=false + +[PrivateEthereumNetwork.EthereumChainConfig] +# duration of single slot, lower => faster block production, must be >= 4 +seconds_per_slot=12 +# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 +slots_per_epoch=6 +# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts +genesis_delay=15 +# number of validators in the network +validator_count=8 +chain_id=1337 +# list of addresses to be prefunded in genesis +addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] + +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true +DefaultTransactionQueueDepth = 0 + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + +# load test specific configuration +[Load.OCR] +[Load.OCR.Common] +eth_funds = 3 + +[Load.OCR.Load] +test_duration = "3m" +rate_limit_unit_duration = "1m" +rate = 3 +verification_interval = "5s" +verification_timeout = "3m" +ea_change_interval = "5s" + +# soak test specific configuration +[Soak.Common] +chainlink_node_funding = 100 + +[Soak.OCR] +[Soak.OCR.Common] +test_duration="15m" + +[Soak.OCR.Soak] +ocr_version="1" +number_of_contracts=2 +time_between_rounds="1m" \ No newline at end of file diff --git a/integration-tests/testconfig/forwarder_ocr2/forwarder_ocr2.toml b/integration-tests/testconfig/forwarder_ocr2/forwarder_ocr2.toml new file mode 100644 index 00000000000..7ce658935f8 --- /dev/null +++ b/integration-tests/testconfig/forwarder_ocr2/forwarder_ocr2.toml @@ -0,0 +1,53 @@ +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true +DefaultTransactionQueueDepth = 0 + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + +[NodeConfig.ChainConfigTOMLByChainID] +1337 = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[Transactions] +ForwardersEnabled = true + """ + + diff --git a/integration-tests/testconfig/functions/example.toml b/integration-tests/testconfig/functions/example.toml index b96b39b0409..7cd875d4c8d 100644 --- a/integration-tests/testconfig/functions/example.toml +++ b/integration-tests/testconfig/functions/example.toml @@ -69,6 +69,81 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true + +[P2P] +[P2P.V2] +Enabled = true +ListenAddresses = ['0.0.0.0:6690'] +AnnounceAddresses = ['0.0.0.0:6690'] +DeltaDial = '500ms' +DeltaReconcile = '5s' +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # Common [Common] chainlink_node_funding = 0.5 diff --git a/integration-tests/testconfig/keeper/example.toml b/integration-tests/testconfig/keeper/example.toml index 0bda9982988..87cf2045feb 100644 --- a/integration-tests/testconfig/keeper/example.toml +++ b/integration-tests/testconfig/keeper/example.toml @@ -69,6 +69,73 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[Keeper] +TurnLookBack = 0 +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # Product part [Common] chainlink_node_funding = 0.5 diff --git a/integration-tests/testconfig/keeper/keeper.toml b/integration-tests/testconfig/keeper/keeper.toml index 228ea077bd3..b3b0869e7c5 100644 --- a/integration-tests/testconfig/keeper/keeper.toml +++ b/integration-tests/testconfig/keeper/keeper.toml @@ -2,6 +2,43 @@ [Common] chainlink_node_funding = 0.5 +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[Keeper] +TurnLookBack = 0 +""" + [Keeper.Common] registry_to_test = "2_1" number_of_registries = 1 diff --git a/integration-tests/testconfig/log_poller/config.go b/integration-tests/testconfig/log_poller/config.go index 890c33f26c9..f6e3249432a 100644 --- a/integration-tests/testconfig/log_poller/config.go +++ b/integration-tests/testconfig/log_poller/config.go @@ -8,11 +8,6 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ) -const ( - ErrReadPerfConfig = "failed to read TOML config for performance tests" - ErrUnmarshalPerfConfig = "failed to unmarshal TOML config for performance tests" -) - type GeneratorType = string const ( @@ -90,13 +85,11 @@ func (l *LoopedConfig) Validate() error { } type General struct { - Generator *string `toml:"generator"` - EventsToEmit []abi.Event `toml:"-"` - Contracts *int `toml:"contracts"` - EventsPerTx *int `toml:"events_per_tx"` - UseFinalityTag *bool `toml:"use_finality_tag"` - BackupLogPollerBlockDelay *uint64 `toml:"backup_log_poller_block_delay"` - LogPollInterval *blockchain.StrDuration `toml:"log_poll_interval"` + Generator *string `toml:"generator"` + EventsToEmit []abi.Event `toml:"-"` + Contracts *int `toml:"contracts"` + EventsPerTx *int `toml:"events_per_tx"` + UseFinalityTag *bool `toml:"use_finality_tag"` } func (g *General) Validate() error { diff --git a/integration-tests/testconfig/log_poller/example.toml b/integration-tests/testconfig/log_poller/example.toml index 88922e3fedb..a41433b1d06 100644 --- a/integration-tests/testconfig/log_poller/example.toml +++ b/integration-tests/testconfig/log_poller/example.toml @@ -69,6 +69,88 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true + +[Keeper] +TurnLookBack = 0 + +[Keeper.Registry] +PerformGasOverhead = 150000 +SyncInterval = '5m0s' + +[P2P] +[P2P.V2] +Enabled = true +ListenAddresses = ['0.0.0.0:6690'] +AnnounceAddresses = ['0.0.0.0:6690'] +DeltaDial = '500ms' +DeltaReconcile = '5s' +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # Common [Common] chainlink_node_funding = 0.5 diff --git a/integration-tests/testconfig/log_poller/log_poller.toml b/integration-tests/testconfig/log_poller/log_poller.toml index 0e87c0e1e01..2f34bf3863d 100644 --- a/integration-tests/testconfig/log_poller/log_poller.toml +++ b/integration-tests/testconfig/log_poller/log_poller.toml @@ -6,6 +6,68 @@ consensus_layer="prysm" seconds_per_slot=4 slots_per_epoch=2 +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true + +[Keeper] +TurnLookBack = 0 + +[Keeper.Registry] +PerformGasOverhead = 150000 +SyncInterval = '5m0s' + +[P2P] +[P2P.V2] +Enabled = true +ListenAddresses = ['0.0.0.0:6690'] +AnnounceAddresses = ['0.0.0.0:6690'] +DeltaDial = '500ms' +DeltaReconcile = '5s' +""" + +# Chainlnk node settings that will be used by all tests +# BackupLogPollerBlockDelay = 0 disables the backup log poller +CommonChainConfigTOML = """ +AutoCreateKey = true +MinContractPayment = 0 +LogPollInterval="500ms" +BackupLogPollerBlockDelay = 0 +FinalityTagEnabled = true +""" + [Seth] ephemeral_addresses_number = 50 @@ -16,9 +78,6 @@ generator = "looped" contracts = 2 events_per_tx = 4 use_finality_tag = true -log_poll_interval = "500ms" -# 0 disables backup poller -backup_log_poller_block_delay = 0 [LogPoller.Looped] execution_count = 100 @@ -26,6 +85,15 @@ min_emit_wait_time_ms = 200 max_emit_wait_time_ms = 500 # test-specific +[TestLogPollerFewFiltersFixedDepth.NodeConfig] +CommonChainConfigTOML = """ +AutoCreateKey = true +MinContractPayment = 0 +LogPollInterval="500ms" +BackupLogPollerBlockDelay = 0 +FinalityDepth = 10 +FinalityTagEnabled = false +""" [TestLogPollerFewFiltersFixedDepth.LogPoller.General] use_finality_tag = false @@ -36,6 +104,16 @@ events_per_tx = 3 [TestLogManyFiltersPollerFinalityTag.LogPoller.Looped] execution_count = 30 +[TestLogManyFiltersPollerFixedDepth.NodeConfig] +CommonChainConfigTOML = """ +AutoCreateKey = true +MinContractPayment = 0 +LogPollInterval="500ms" +BackupLogPollerBlockDelay = 0 +FinalityDepth = 10 +FinalityTagEnabled = false +""" + [TestLogManyFiltersPollerFixedDepth.LogPoller.General] use_finality_tag = false contracts = 300 @@ -50,6 +128,16 @@ execution_count = 30 experiment_count = 4 target_component = "chainlink" +[TestLogPollerWithChaosFixedDepth.NodeConfig] +CommonChainConfigTOML = """ +AutoCreateKey = true +MinContractPayment = 0 +LogPollInterval="500ms" +BackupLogPollerBlockDelay = 0 +FinalityDepth = 10 +FinalityTagEnabled = false +""" + [TestLogPollerWithChaosFixedDepth.LogPoller.General] execution_count = 30 use_finality_tag = false @@ -63,6 +151,16 @@ execution_count = 30 experiment_count = 4 target_component = "postgres" +[TestLogPollerWithChaosPostgresFixedDepth.NodeConfig] +CommonChainConfigTOML = """ +AutoCreateKey = true +MinContractPayment = 0 +LogPollInterval="500ms" +BackupLogPollerBlockDelay = 0 +FinalityDepth = 10 +FinalityTagEnabled = false +""" + [TestLogPollerWithChaosPostgresFixedDepth.LogPoller.General] execution_count = 30 use_finality_tag = false @@ -70,6 +168,15 @@ use_finality_tag = false experiment_count = 4 target_component = "postgres" +[TestLogPollerReplayFixedDepth.NodeConfig] +CommonChainConfigTOML = """ +AutoCreateKey = true +MinContractPayment = 0 +LogPollInterval="500ms" +BackupLogPollerBlockDelay = 0 +FinalityDepth = 10 +FinalityTagEnabled = false +""" [TestLogPollerReplayFixedDepth.LogPoller.General] use_finality_tag = false diff --git a/integration-tests/testconfig/ocr/example.toml b/integration-tests/testconfig/ocr/example.toml index b8eb891ba33..3355ede75f7 100644 --- a/integration-tests/testconfig/ocr/example.toml +++ b/integration-tests/testconfig/ocr/example.toml @@ -69,6 +69,77 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # load test specific configuration [Load.OCR] [Load.OCR.Common] diff --git a/integration-tests/testconfig/ocr/ocr.toml b/integration-tests/testconfig/ocr/ocr.toml index 67d7d4588a0..5bc9b975648 100644 --- a/integration-tests/testconfig/ocr/ocr.toml +++ b/integration-tests/testconfig/ocr/ocr.toml @@ -2,6 +2,47 @@ [Common] chainlink_node_funding = 0.5 +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + # load test specific configuration [Load.OCR] [Load.OCR.Common] diff --git a/integration-tests/testconfig/ocr2/example.toml b/integration-tests/testconfig/ocr2/example.toml index b8eb891ba33..9f7fdc7ff92 100644 --- a/integration-tests/testconfig/ocr2/example.toml +++ b/integration-tests/testconfig/ocr2/example.toml @@ -69,6 +69,77 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # load test specific configuration [Load.OCR] [Load.OCR.Common] diff --git a/integration-tests/testconfig/ocr2/ocr2.toml b/integration-tests/testconfig/ocr2/ocr2.toml index 8d3c73ca761..1d33cdc1ec4 100644 --- a/integration-tests/testconfig/ocr2/ocr2.toml +++ b/integration-tests/testconfig/ocr2/ocr2.toml @@ -2,6 +2,47 @@ [Common] chainlink_node_funding = 0.5 +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR2] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + # load test specific configuration [Load.OCR] [Load.OCR.Common] diff --git a/integration-tests/testconfig/testconfig.go b/integration-tests/testconfig/testconfig.go index abeca8e6eb2..337c960204a 100644 --- a/integration-tests/testconfig/testconfig.go +++ b/integration-tests/testconfig/testconfig.go @@ -231,7 +231,6 @@ type Product string const ( Automation Product = "automation" Cron Product = "cron" - DirectRequest Product = "direct_request" Flux Product = "flux" ForwarderOcr Product = "forwarder_ocr" ForwarderOcr2 Product = "forwarder_ocr2" @@ -248,8 +247,6 @@ const ( VRFv2Plus Product = "vrfv2plus" ) -var TestTypesWithLoki = []string{"Load", "Soak", "Stress", "Spike", "Volume"} - const TestTypeEnvVarName = "TEST_TYPE" func GetConfigurationNameFromEnv() (string, error) { diff --git a/integration-tests/testconfig/vrf/vrf.toml b/integration-tests/testconfig/vrf/vrf.toml new file mode 100644 index 00000000000..5282dae8910 --- /dev/null +++ b/integration-tests/testconfig/vrf/vrf.toml @@ -0,0 +1,40 @@ +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" \ No newline at end of file diff --git a/integration-tests/testconfig/vrfv2/example.toml b/integration-tests/testconfig/vrfv2/example.toml index 8a8139b92d4..0351ae85142 100644 --- a/integration-tests/testconfig/vrfv2/example.toml +++ b/integration-tests/testconfig/vrfv2/example.toml @@ -69,6 +69,77 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # Common [Common] chainlink_node_funding = 0.5 diff --git a/integration-tests/testconfig/vrfv2/vrfv2.toml b/integration-tests/testconfig/vrfv2/vrfv2.toml index 59affd85f5a..56257b9c1a6 100644 --- a/integration-tests/testconfig/vrfv2/vrfv2.toml +++ b/integration-tests/testconfig/vrfv2/vrfv2.toml @@ -1,6 +1,47 @@ # default config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + [Common] -chainlink_node_funding = 0.1 +chainlink_node_funding = 0.5 [VRFv2] [VRFv2.General] diff --git a/integration-tests/testconfig/vrfv2plus/example.toml b/integration-tests/testconfig/vrfv2plus/example.toml index 76fe23a2e70..1aaf8951e20 100644 --- a/integration-tests/testconfig/vrfv2plus/example.toml +++ b/integration-tests/testconfig/vrfv2plus/example.toml @@ -69,6 +69,77 @@ chain_id=1337 # list of addresses to be prefunded in genesis addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] +[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] +# hardforks to be applied (fork_name = epoch) +Deneb=500 + +# Chainlink node TOML config +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + +# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml +CommonChainConfigTOML = """ +AutoCreateKey = true +FinalityDepth = 1 +MinContractPayment = 0 + +[GasEstimator] +PriceMax = '200 gwei' +LimitDefault = 6000000 +FeeCapDefault = '200 gwei' +""" + +# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key +[NodeConfig.ChainConfigTOMLByChainID] +# applicable for arbitrum-goerli chain +421613 = """ +[GasEstimator] +PriceMax = '400 gwei' +LimitDefault = 100000000 +FeeCapDefault = '200 gwei' +BumpThreshold = 60 +BumpPercent = 20 +BumpMin = '100 gwei' +""" + # Common [Common] chainlink_node_funding = 0.5 diff --git a/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml b/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml index b420a1c1d88..e441e647949 100644 --- a/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml +++ b/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml @@ -1,6 +1,48 @@ # default config + +[NodeConfig] +BaseConfigTOML = """ +[Feature] +FeedsManager = true +LogPoller = true +UICSAKeys = true + +[Log] +Level = 'debug' +JSONConsole = true + +[Log.File] +MaxSize = '0b' + +[WebServer] +AllowOrigins = '*' +HTTPPort = 6688 +SecureCookies = false +HTTPWriteTimeout = '1m' +SessionTimeout = '999h0m0s' + +[WebServer.RateLimit] +Authenticated = 2000 +Unauthenticated = 1000 + +[WebServer.TLS] +HTTPSPort = 0 + +[Database] +MaxIdleConns = 20 +MaxOpenConns = 40 +MigrateOnStartup = true + +[OCR] +Enabled = true + +[P2P] +[P2P.V2] +ListenAddresses = ['0.0.0.0:6690'] +""" + [Common] -chainlink_node_funding = 0.1 +chainlink_node_funding = 0.5 [VRFv2Plus] [VRFv2Plus.General] diff --git a/integration-tests/types/config/node/core.go b/integration-tests/types/config/node/core.go index 23efdf13a8b..8c8d6d1c339 100644 --- a/integration-tests/types/config/node/core.go +++ b/integration-tests/types/config/node/core.go @@ -4,18 +4,19 @@ import ( "bytes" "fmt" "math/big" - "os" + "strconv" "time" "github.com/segmentio/ksuid" "go.uber.org/zap/zapcore" - commonassets "github.com/smartcontractkit/chainlink-common/pkg/assets" + corechainlink "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" + "github.com/smartcontractkit/chainlink-common/pkg/config" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/utils/ptr" - it_utils "github.com/smartcontractkit/chainlink/integration-tests/utils" + itutils "github.com/smartcontractkit/chainlink/integration-tests/utils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" @@ -73,16 +74,9 @@ func NewConfig(baseConf *chainlink.Config, opts ...NodeConfigOpt) *chainlink.Con return baseConf } -func NewConfigFromToml(tomlFile string, opts ...NodeConfigOpt) (*chainlink.Config, error) { - readFile, err := os.ReadFile(tomlFile) - if err != nil { - return nil, err - } +func NewConfigFromToml(tomlConfig []byte, opts ...NodeConfigOpt) (*chainlink.Config, error) { var cfg chainlink.Config - if err != nil { - return nil, err - } - err = config.DecodeTOML(bytes.NewReader(readFile), &cfg) + err := config.DecodeTOML(bytes.NewReader(tomlConfig), &cfg) if err != nil { return nil, err } @@ -92,116 +86,37 @@ func NewConfigFromToml(tomlFile string, opts ...NodeConfigOpt) (*chainlink.Confi return &cfg, nil } -func WithOCR1() NodeConfigOpt { - return func(c *chainlink.Config) { - c.OCR = toml.OCR{ - Enabled: ptr.Ptr(true), - } - } -} - -func WithOCR2() NodeConfigOpt { - return func(c *chainlink.Config) { - c.OCR2 = toml.OCR2{ - Enabled: ptr.Ptr(true), - } - } -} - -func WithP2Pv2() NodeConfigOpt { - return func(c *chainlink.Config) { - c.P2P.V2 = toml.P2PV2{ - ListenAddresses: &[]string{"0.0.0.0:6690"}, +func WithPrivateEVMs(networks []blockchain.EVMNetwork, commonChainConfig *evmcfg.Chain, chainSpecificConfig map[int64]evmcfg.Chain) NodeConfigOpt { + var evmConfigs []*evmcfg.EVMConfig + for _, network := range networks { + var evmNodes []*evmcfg.Node + for i := range network.URLs { + evmNodes = append(evmNodes, &evmcfg.Node{ + Name: ptr.Ptr(fmt.Sprintf("%s-%d", network.Name, i)), + WSURL: itutils.MustURL(network.URLs[i]), + HTTPURL: itutils.MustURL(network.HTTPURLs[i]), + }) } - } -} - -func WithTracing() NodeConfigOpt { - return func(c *chainlink.Config) { - c.Tracing = toml.Tracing{ - Enabled: ptr.Ptr(true), - CollectorTarget: ptr.Ptr("otel-collector:4317"), - // ksortable unique id - NodeID: ptr.Ptr(ksuid.New().String()), - SamplingRatio: ptr.Ptr(1.0), - Mode: ptr.Ptr("unencrypted"), - Attributes: map[string]string{ - "env": "smoke", - }, + evmConfig := &evmcfg.EVMConfig{ + ChainID: ubig.New(big.NewInt(network.ChainID)), + Nodes: evmNodes, + Chain: evmcfg.Chain{}, } - } -} - -func SetChainConfig( - cfg *chainlink.Config, - wsUrls, - httpUrls []string, - chain blockchain.EVMNetwork, - forwarders bool, -) { - if cfg.EVM == nil { - var nodes []*evmcfg.Node - for i := range wsUrls { - node := evmcfg.Node{ - Name: ptr.Ptr(fmt.Sprintf("node_%d_%s", i, chain.Name)), - WSURL: it_utils.MustURL(wsUrls[i]), - HTTPURL: it_utils.MustURL(httpUrls[i]), - SendOnly: ptr.Ptr(false), - } - - nodes = append(nodes, &node) + if commonChainConfig != nil { + evmConfig.Chain = *commonChainConfig } - var chainConfig evmcfg.Chain - if chain.Simulated { - chainConfig = evmcfg.Chain{ - AutoCreateKey: ptr.Ptr(true), - FinalityDepth: ptr.Ptr[uint32](1), - MinContractPayment: commonassets.NewLinkFromJuels(0), + if chainSpecificConfig != nil { + if overriddenChainCfg, ok := chainSpecificConfig[network.ChainID]; ok { + evmConfig.Chain = overriddenChainCfg } } - cfg.EVM = evmcfg.EVMConfigs{ - { - ChainID: ubig.New(big.NewInt(chain.ChainID)), - Chain: chainConfig, - Nodes: nodes, - }, + if evmConfig.Chain.FinalityDepth == nil && network.FinalityDepth > 0 { + evmConfig.Chain.FinalityDepth = ptr.Ptr(uint32(network.FinalityDepth)) } - if forwarders { - cfg.EVM[0].Transactions = evmcfg.Transactions{ - ForwardersEnabled: ptr.Ptr(true), - } + if evmConfig.Chain.FinalityTagEnabled == nil && network.FinalityTag { + evmConfig.Chain.FinalityTagEnabled = ptr.Ptr(network.FinalityTag) } - } -} - -func WithPrivateEVMs(networks []blockchain.EVMNetwork) NodeConfigOpt { - var evmConfigs []*evmcfg.EVMConfig - for _, network := range networks { - evmConfigs = append(evmConfigs, &evmcfg.EVMConfig{ - ChainID: ubig.New(big.NewInt(network.ChainID)), - Chain: evmcfg.Chain{ - AutoCreateKey: ptr.Ptr(true), - FinalityDepth: ptr.Ptr[uint32](50), - MinContractPayment: commonassets.NewLinkFromJuels(0), - LogPollInterval: commonconfig.MustNewDuration(1 * time.Second), - HeadTracker: evmcfg.HeadTracker{ - HistoryDepth: ptr.Ptr(uint32(100)), - }, - GasEstimator: evmcfg.GasEstimator{ - LimitDefault: ptr.Ptr(uint64(6000000)), - PriceMax: assets.GWei(200), - FeeCapDefault: assets.GWei(200), - }, - }, - Nodes: []*evmcfg.Node{ - { - Name: ptr.Ptr(network.Name), - WSURL: it_utils.MustURL(network.URLs[0]), - HTTPURL: it_utils.MustURL(network.HTTPURLs[0]), - SendOnly: ptr.Ptr(false), - }, - }, - }) + evmConfigs = append(evmConfigs, evmConfig) } return func(c *chainlink.Config) { c.EVM = evmConfigs @@ -237,3 +152,46 @@ func WithLogPollInterval(interval time.Duration) NodeConfigOpt { c.EVM[0].Chain.LogPollInterval = commonconfig.MustNewDuration(interval) } } + +func BuildChainlinkNodeConfig(nets []blockchain.EVMNetwork, nodeConfig, commonChain string, configByChain map[string]string) (*corechainlink.Config, string, error) { + var tomlCfg *corechainlink.Config + var err error + var commonChainConfig *evmcfg.Chain + if commonChain != "" { + err = config.DecodeTOML(bytes.NewReader([]byte(commonChain)), &commonChainConfig) + if err != nil { + return nil, "", err + } + } + configByChainMap := make(map[int64]evmcfg.Chain) + for k, v := range configByChain { + var chain evmcfg.Chain + err = config.DecodeTOML(bytes.NewReader([]byte(v)), &chain) + if err != nil { + return nil, "", err + } + chainId, err := strconv.ParseInt(k, 10, 64) + if err != nil { + return nil, "", err + } + configByChainMap[chainId] = chain + } + if nodeConfig == "" { + tomlCfg = NewConfig( + NewBaseConfig(), + WithPrivateEVMs(nets, commonChainConfig, configByChainMap)) + } else { + tomlCfg, err = NewConfigFromToml([]byte(nodeConfig), WithPrivateEVMs(nets, commonChainConfig, configByChainMap)) + if err != nil { + return nil, "", err + } + } + + // we need unique id for each node for OTEL tracing + if tomlCfg.Tracing.Enabled != nil && *tomlCfg.Tracing.Enabled { + tomlCfg.Tracing.NodeID = ptr.Ptr(ksuid.New().String()) + } + + tomlStr, err := tomlCfg.TOMLString() + return tomlCfg, tomlStr, err +} diff --git a/integration-tests/universal/log_poller/helpers.go b/integration-tests/universal/log_poller/helpers.go index d732ad4af5d..9de11c439c8 100644 --- a/integration-tests/universal/log_poller/helpers.go +++ b/integration-tests/universal/log_poller/helpers.go @@ -25,12 +25,10 @@ import ( "github.com/smartcontractkit/seth" "github.com/smartcontractkit/wasp" - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" - "github.com/smartcontractkit/chainlink-testing-framework/utils/ptr" "github.com/smartcontractkit/chainlink/integration-tests/actions" actions_seth "github.com/smartcontractkit/chainlink/integration-tests/actions/seth" @@ -40,8 +38,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" lp_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/log_poller" - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" cltypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ac "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/automation_compatible_utils" @@ -1046,46 +1042,17 @@ func ExecuteChaosExperiment(l zerolog.Logger, testEnv *test_env.CLClusterTestEnv }() } -// GetFinalityDepth returns the finality depth for the provided chain ID -func GetFinalityDepth(chainId int64) (int64, error) { - var finalityDepth int64 - switch chainId { - // Ethereum Sepolia - case 11155111: - finalityDepth = 50 - // Polygon Mumbai - case 80001: - finalityDepth = 500 - // Simulated network - case 1337: - finalityDepth = 10 - default: - return 0, fmt.Errorf("no known finality depth for chain %d", chainId) - } - - return finalityDepth, nil -} - // GetEndBlockToWaitFor returns the end block to wait for based on chain id and finality tag provided in config -func GetEndBlockToWaitFor(endBlock, chainId int64, cfg *lp_config.Config) (int64, error) { +func GetEndBlockToWaitFor(endBlock int64, network blockchain.EVMNetwork, cfg *lp_config.Config) (int64, error) { if *cfg.General.UseFinalityTag { return endBlock + 1, nil } - finalityDepth, err := GetFinalityDepth(chainId) - if err != nil { - return 0, err - } - - return endBlock + finalityDepth, nil + return endBlock + int64(network.FinalityDepth), nil } const ( - automationDefaultUpkeepGasLimit = uint32(2500000) - automationDefaultLinkFunds = int64(9e18) - automationDefaultUpkeepsToDeploy = 10 - automationExpectedData = "abcdef" - defaultAmountOfUpkeeps = 2 + defaultAmountOfUpkeeps = 2 ) var ( @@ -1111,8 +1078,6 @@ func SetupLogPollerTestDocker( registryVersion ethereum.KeeperRegistryVersion, registryConfig contracts.KeeperRegistrySettings, upkeepsNeeded int, - lpPollingInterval time.Duration, - backupPollingInterval uint64, finalityTagEnabled bool, testConfig *tc.TestConfig, logScannerSettings test_env.ChainlinkNodeLogScannerSettings, @@ -1131,43 +1096,21 @@ func SetupLogPollerTestDocker( registryConfig.RegistryVersion = registryVersion network := networks.MustGetSelectedNetworkConfig(testConfig.Network)[0] - finalityDepth, err := GetFinalityDepth(network.ChainID) - require.NoError(t, err, "Error getting finality depth") - - // build the node config - clNodeConfig := node.NewConfig(node.NewBaseConfig()) - syncInterval := *commonconfig.MustNewDuration(5 * time.Minute) - clNodeConfig.Feature.LogPoller = ptr.Ptr[bool](true) - clNodeConfig.OCR2.Enabled = ptr.Ptr[bool](true) - clNodeConfig.Keeper.TurnLookBack = ptr.Ptr[int64](int64(0)) - clNodeConfig.Keeper.Registry.SyncInterval = &syncInterval - clNodeConfig.Keeper.Registry.PerformGasOverhead = ptr.Ptr[uint32](uint32(150000)) - clNodeConfig.P2P.V2.Enabled = ptr.Ptr[bool](true) - clNodeConfig.P2P.V2.AnnounceAddresses = &[]string{"0.0.0.0:6690"} - clNodeConfig.P2P.V2.ListenAddresses = &[]string{"0.0.0.0:6690"} - //launch the environment var env *test_env.CLClusterTestEnv chainlinkNodeFunding := 0.5 l.Debug().Msgf("Funding amount: %f", chainlinkNodeFunding) clNodesCount := 5 - var logPolllerSettingsFn = func(chain *evmcfg.Chain) *evmcfg.Chain { - chain.LogPollInterval = commonconfig.MustNewDuration(lpPollingInterval) - chain.FinalityDepth = ptr.Ptr[uint32](uint32(finalityDepth)) - chain.FinalityTagEnabled = ptr.Ptr[bool](finalityTagEnabled) - chain.BackupLogPollerBlockDelay = ptr.Ptr[uint64](backupPollingInterval) - return chain - } - - var evmNetworkSettingsFn = func(network *blockchain.EVMNetwork) *blockchain.EVMNetwork { - network.FinalityDepth = uint64(finalityDepth) + var evmNetworkExtraSettingsFn = func(network *blockchain.EVMNetwork) *blockchain.EVMNetwork { + // we need it, because by default finality depth is 0 for our simulated network + if network.Simulated && !finalityTagEnabled { + network.FinalityDepth = 10 + } network.FinalityTag = finalityTagEnabled return network } - evmNetworkSettingsFn(&network) - privateNetwork, err := actions.EthereumNetworkConfigFromConfig(l, testConfig) require.NoError(t, err, "Error building ethereum network config") @@ -1176,10 +1119,8 @@ func SetupLogPollerTestDocker( WithTestInstance(t). WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). WithCLNodes(clNodesCount). - WithCLNodeConfig(clNodeConfig). WithFunding(big.NewFloat(chainlinkNodeFunding)). - WithChainOptions(logPolllerSettingsFn). - EVMNetworkOptions(evmNetworkSettingsFn). + WithEVMNetworkOptions(evmNetworkExtraSettingsFn). WithChainlinkNodeLogScanner(logScannerSettings). WithStandardCleanup(). WithSeth().