From 9741aa9a681cb8dc534d498141e0674d493791ce Mon Sep 17 00:00:00 2001 From: battlmonstr Date: Thu, 21 Mar 2024 15:39:33 +0100 Subject: [PATCH 1/3] debug --- .circleci/config.yml | 476 -------------------- .github/workflows/rpc-integration-tests.yml | 128 ------ .github/workflows/rpc-performance-tests.yml | 124 ----- .github/workflows/windows.yml | 78 ---- 4 files changed, 806 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .github/workflows/rpc-integration-tests.yml delete mode 100644 .github/workflows/rpc-performance-tests.yml delete mode 100644 .github/workflows/windows.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 5f04544669..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,476 +0,0 @@ -# Copyright 2020 The Silkworm Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: 2.1 -orbs: - codecov: codecov/codecov@3.3.0 - -commands: - checkout_with_submodules: - parameters: - ethereum_tests: - description: Include a heavy Ethereum tests submodule if needed. - type: boolean - default: true - steps: - - checkout - - run: - name: "Update submodules" - command: | - if [[ <> == false ]] - then - git config submodule.ethereum-tests.update none - fi - - git submodule sync - git -c submodule.LegacyTests.update=none submodule update --init --recursive - - build: - parameters: - build_type: - type: string - default: Release - compiler_id: - type: string - compiler_version: - type: integer - conan_profile: - type: string - default: none - target: - type: string - default: all - steps: - - run: - name: "Install compiler" - command: cmake/setup/compiler_install.sh <> <> - - run: - name: "Cmake" - working_directory: ~/build - command: | - if [[ "<>" != "none" ]] - then - CONAN_CMAKE_ARGS="-DCONAN_PROFILE=<>" - fi - if [[ "<>" == "clang" ]] - then - TOOLCHAIN_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../project/cmake/toolchain/clang_libcxx.cmake" - fi - - cmake ../project -DCMAKE_BUILD_TYPE=<> $CONAN_CMAKE_ARGS $TOOLCHAIN_CMAKE_ARGS $BUILD_CMAKE_ARGS - - run: - name: "Build" - command: | - if [[ "<>" == "all" ]] - then - cmake --build ~/build -j16 - else - cmake --build ~/build -j16 --target <> - fi - - build_using_conan: - parameters: - build_type: - type: string - default: Release - compiler_id: - type: string - compiler_version: - type: integer - target: - type: string - default: all - steps: - - run: - name: "Install Conan" - command: sudo pip3 install conan==1.60.2 chardet - - run: - name: "Select Conan profile" - command: | - if [[ "<>" == "clang" ]] - then - conan_profile=linux_x64_clang_13_release - else - conan_profile=linux_x64_gcc_11_release - fi - echo "export CONAN_PROFILE='$conan_profile'" >> "$BASH_ENV" - cp "cmake/profiles/$conan_profile" "$HOME/selected_conan_profile" - - restore_cache: - name: "Restore Conan cache" - key: &conan-cache-key conan-machine-{{ .Environment.CIRCLE_JOB }}-<>-<>-{{checksum "../selected_conan_profile"}}-{{checksum "conanfile.py"}} - - build: - build_type: <> - compiler_id: <> - compiler_version: <> - conan_profile: $CONAN_PROFILE - target: <> - - save_cache: - name: "Save Conan cache" - key: *conan-cache-key - paths: - - ~/.conan - - build_fuzzer: - steps: - - checkout_with_submodules: - ethereum_tests: false - - run: - name: "Ensure pip" - command: | - sudo apt-get update - sudo apt install -y python3-pip - sudo pip install conan==1.60.2 chardet - sudo apt-get update - - run: - name: "Install compiler" - command: cmake/setup/compiler_install.sh clang 15 - - run: - name: "CMake Fuzzer" - working_directory: ~/build - command: cmake ../project -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONAN_PROFILE=linux_x64_clang_13_release -DCMAKE_TOOLCHAIN_FILE=../project/cmake/toolchain/clang_libcxx.cmake -DSILKWORM_FUZZER=ON - - run: - name: "Build Fuzzer" - command: | - cmake --build ~/build -j4 --target rpcdaemon_fuzzer_test - cmake --build ~/build -j4 --target rpcdaemon_fuzzer_diagnostics - - test: - parameters: - ethereum_tests: - type: boolean - default: true - steps: - - run: - name: "Smoke tests" - command: make "SILKWORM_BUILD_DIR=$HOME/build" run_smoke_tests - - run: - name: "Unit tests" - command: make "SILKWORM_BUILD_DIR=$HOME/build" run_unit_tests - - when: - condition: <> - steps: - - run: - name: "Ethereum EL tests" - working_directory: ~/build - no_output_timeout: 30m - command: cmd/test/ethereum - - run: - name: "Execution spec tests" - working_directory: ~/build - command: cmd/test/ethereum --tests $HOME/project/third_party/execution-spec-tests - - fuzz-test: - steps: - - run: - name: "RPCDaemon Fuzz test" - working_directory: ~/build - command: | - mkdir -p ~/corpus - mkdir -p ~/crashes - mkdir -p ~/artifacts - for file in ../project/third_party/execution-apis/tests/*/*.io; do cp --backup=numbered "$file" ~/artifacts; done - for file in ~/artifacts/*; do sed -i '2,$d' "$file"; done - for file in ~/artifacts/*; do sed -i 's/^>> //' "$file"; done - ./cmd/test/rpcdaemon_fuzzer_test ~/corpus ~/crashes ~/artifacts -max_total_time=86400 -detect_leaks=0 - -jobs: - lint: - machine: - image: ubuntu-2204:2023.04.2 - steps: - - add_ssh_keys: - fingerprints: - - "4b:13:8d:15:b9:98:1a:dc:96:c2:b9:ab:fa:c1:d4:e6" - - checkout - - run: - name: "Format" - working_directory: ~/project - command: | - sudo pip install cmake-format==0.6.13 - make fmt - if ! git diff --exit-code - then - commit_message="make fmt" - head_commit_message="$(git log -1 --pretty=%B)" - - if [[ "$head_commit_message" == "$commit_message" ]] - then - echo "The formatting style is not compliant, although it was formatted. Try to run 'make fmt' locally and push the changes." - exit 1 - else - git config user.name GitHub - git config user.email noreply@github.com - git commit --all --message="$commit_message" - git config push.autoSetupRemote true - git push - - echo "The formatting style was not compliant, but it is fixed now. A new workflow will start soon, wait for it..." - exit 2 - fi - fi - - run: - name: "Copyright" - working_directory: ~/project - command: cmake -P cmake/copyright.cmake - - linux-gcc-thread-sanitizer: - environment: - BUILD_CMAKE_ARGS: -DSILKWORM_SANITIZE=thread - machine: - image: ubuntu-2204:2023.04.2 - resource_class: 2xlarge - steps: - - checkout_with_submodules - - build_using_conan: - compiler_id: gcc - compiler_version: <> - build_type: Debug - - test - - linux-release: - parameters: - compiler_id: - type: string - compiler_version: - type: integer - ethereum_tests: - type: boolean - default: true - machine: - image: ubuntu-2204:2023.04.2 - resource_class: 2xlarge - steps: - - checkout_with_submodules: - ethereum_tests: <> - - build_using_conan: - compiler_id: <> - compiler_version: <> - - test: - ethereum_tests: <> - - linux-clang-address-sanitizer: - environment: - BUILD_CMAKE_ARGS: -DSILKWORM_SANITIZE=address,undefined - ASAN_OPTIONS: alloc_dealloc_mismatch=0 # https://github.com/llvm/llvm-project/issues/59432 - UBSAN_OPTIONS: print_stacktrace=1 - machine: - image: ubuntu-2204:2023.04.2 - resource_class: 2xlarge - steps: - - checkout_with_submodules - - build_using_conan: - build_type: Debug - compiler_id: clang - compiler_version: <> - - test - - linux-clang-coverage: - environment: - BUILD_CMAKE_ARGS: -DSILKWORM_CLANG_COVERAGE=ON - machine: - image: ubuntu-2204:2023.04.2 - resource_class: 2xlarge - steps: - - checkout_with_submodules - - build_using_conan: - build_type: Debug - compiler_id: clang - compiler_version: <> - - run: - name: "Unit tests" - command: make "SILKWORM_BUILD_DIR=$HOME/build" SILKWORM_CLANG_COVERAGE=ON run_unit_tests - - run: - name: "Ethereum EL tests" - no_output_timeout: 30m - command: LLVM_PROFILE_FILE=ethereum.profraw ~/build/cmd/test/ethereum - - run: - name: "Execution spec tests" - command: LLVM_PROFILE_FILE=execution-spec.profraw ~/build/cmd/test/ethereum --tests $HOME/project/third_party/execution-spec-tests - - run: - name: "Coverage" - command: | - llvm-profdata merge *.profraw -o profdata - llvm-cov export -instr-profile profdata ~/build/cmd/silkworm '-ignore-filename-regex=(third_party|silkworm/interfaces|test)' -format=lcov > /tmp/silkworm.lcov - llvm-cov report -instr-profile profdata ~/build/cmd/silkworm '-ignore-filename-regex=(third_party|silkworm/interfaces|test)' > /tmp/report.txt - - codecov/upload: - file: /tmp/silkworm.lcov - - store_artifacts: - path: /tmp/silkworm.lcov - - store_artifacts: - path: /tmp/report.txt - - linux-clang-tidy: - environment: - # see: https://clang.llvm.org/extra/clang-tidy/ - BUILD_CMAKE_ARGS: -DSILKWORM_CLANG_TIDY=ON - machine: - image: ubuntu-2204:2023.04.2 - resource_class: 2xlarge - steps: - - run: - name: "Install clang-tidy" - command: | - sudo apt-get update - sudo apt-get install -y clang-tidy - - checkout_with_submodules: - ethereum_tests: false - - build_using_conan: - build_type: Debug - compiler_id: clang - compiler_version: <> - - run: - name: "Generate report" - command: | - sudo pip install clang-html - sudo cp ~/project/third_party/clang-tidy-html/clang_visualizer.py /usr/local/lib/python3.10/dist-packages/clang_html/clang_visualizer.py - curl --output build.log "https://circleci.com/api/v1.1/project/github/torquem-ch/silkworm/$CIRCLE_BUILD_NUM/output/109/0?file=true" - clang-tidy-html build.log -o /tmp/report.html - - store_artifacts: - path: /tmp/report.html - - linux-clang-fuzzer: - parameters: - run_tests: - description: Run fuzzy tests if required. - type: boolean - default: false - environment: - BUILD_CMAKE_ARGS: -DSILKWORM_FUZZER=ON - UBSAN_OPTIONS: print_stacktrace=1 - docker: - - image: cimg/python:3.12 - resource_class: 2xlarge - steps: - - build_fuzzer - - when: - condition: <> - steps: - - fuzz-test - - linux-wasm-build: - environment: - WASI_SDK_VERSION: 20 - machine: - image: ubuntu-2204:2023.04.2 - steps: - - checkout_with_submodules: - ethereum_tests: false - - run: - name: "Install WASI SDK" - working_directory: ~/tmp1 - command: | - wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-linux.tar.gz - tar xvf wasi-sdk-$WASI_SDK_VERSION.0-linux.tar.gz - sudo mv wasi-sdk-$WASI_SDK_VERSION.0 /opt/wasi-sdk - - run: - name: "Install dependencies" - command: | - sudo apt-get update - sudo apt-get install -y texinfo libtinfo5 - - run: - name: "Install Conan" - command: sudo pip3 install conan==1.60.2 chardet - - run: - name: "Install Wasmer" - working_directory: ~/tmp2 - command: $HOME/project/third_party/wasmer/install.sh v3.2.1 - - run: - name: "Build GMP" - working_directory: ~/tmp3 - command: | - git clone https://github.com/torquem-ch/gmp-wasm - cd gmp-wasm - git checkout 87e9087 - ./configure --prefix $HOME/opt-wasm CC=/opt/wasi-sdk/bin/clang --host=none AR=llvm-ar RANLIB=llvm-ranlib --enable-cxx CXX=/opt/wasi-sdk/bin/clang++ ABI=longlong - make -j - make install - - run: - name: "Cmake" - working_directory: ~/build - command: | - cmake ../project -DCMAKE_TOOLCHAIN_FILE=$HOME/project/cmake/toolchain/wasi.cmake -DSILKWORM_CORE_ONLY=ON -DSILKWORM_CORE_USE_ABSEIL=OFF -DSILKWORM_WASM_API=ON -DGMP_INCLUDE_DIR=$HOME/opt-wasm/include -DGMP_LIBRARY=$HOME/opt-wasm/lib/libgmp.a -DCMAKE_BUILD_TYPE=Release - - run: - name: "Build" - command: cmake --build ~/build -j - - run: - name: "Core unit tests" - working_directory: ~/build - command: wasmer cmd/test/core_test --stack-size 16777216 - -parameters: - clang_version_min: - type: integer - default: 15 - clang_version_latest: - type: integer - default: 15 - gcc_version_min: - type: integer - default: 11 - gcc_version_latest: - type: integer - default: 12 - -workflows: - light: - when: - not: - equal: [ master, <> ] - jobs: - - lint - - linux-release: - name: linux-gcc-<>-release - compiler_id: gcc - compiler_version: <> - ethereum_tests: false - requires: - - lint - - linux-release: - name: linux-clang-<>-release - compiler_id: clang - compiler_version: <> - ethereum_tests: false - requires: - - lint - - integration: - when: - or: - - equal: [ master, <> ] - - matches: { pattern: "^ci\\/.+$", value: <> } - jobs: - - linux-release: - name: linux-gcc-<>-release - compiler_id: gcc - compiler_version: <> - - linux-gcc-thread-sanitizer - - linux-clang-coverage - - linux-clang-address-sanitizer - - linux-clang-fuzzer: - name: linux-clang-fuzzer - - linux-clang-tidy - - linux-wasm-build - - fuzzer: - triggers: - - schedule: - cron: "0 0 * * 6" - filters: - branches: - only: - - master - jobs: - - linux-clang-fuzzer: - name: linux-clang-run-fuzzer - run_tests: true diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml deleted file mode 100644 index e26b1c184a..0000000000 --- a/.github/workflows/rpc-integration-tests.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: QA - RPC Integration Tests - -on: - pull_request: - branches: - - master - types: - - opened - - ready_for_review - - synchronize - -jobs: - integration-test-suite: - runs-on: self-hosted - env: - ERIGON_DATA_DIR: /opt/erigon-versions/reference-version/datadir - RPC_PAST_TEST_DIR: /opt/rpc-past-tests - ERIGON_QA_PATH: /opt/erigon-qa - - steps: - - name: Checkout Silkworm Repository - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: "0" - - - name: Checkout RPC Tests Repository & Install Requirements - run: | - rm -rf ${{runner.workspace}}/rpc-tests - git -c advice.detachedHead=false clone --depth 1 --branch v0.5.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests - cd ${{runner.workspace}}/rpc-tests - pip3 install -r requirements.txt - - - name: Clean Build Directory - run: rm -rf ${{runner.workspace}}/silkworm/build - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/silkworm/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/silkworm/build - run: | - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release - - - name: Build Silkworm RpcDaemon - working-directory: ${{runner.workspace}}/silkworm/build - run: cmake --build . --config Release --target rpcdaemon -j 8 - - - name: Pause the Erigon instance dedicated to db maintenance - run: | - python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true - - - name: Start Silkworm RpcDaemon - working-directory: ${{runner.workspace}}/silkworm/build/cmd - run: | - echo "Silkworm RpcDaemon starting..." - ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check --ws & - RPC_DAEMON_PID=$! - echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV - echo "Silkworm RpcDaemon started" - - - name: Run RPC Integration Tests - id: test_step - run: | - set +e # Disable exit on error - - cd ${{runner.workspace}}/rpc-tests/integration - rm -rf ./mainnet/results/ - - # Run RPC integration test runner via http - python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json,engine_ --transport_type http,websocket - - # Capture test runner script exit status - test_exit_status=$? - - # Check test runner exit status - if [ $test_exit_status -eq 0 ]; then - echo "tests completed successfully" - echo - echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" - else - echo "error detected during tests" - echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" - - # Save failed results to a directory with timestamp and commit hash - cp -r ${{runner.workspace}}/rpc-tests/integration/mainnet/results/ $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD)_http/ - fi - - - name: Stop Silkworm RpcDaemon - working-directory: ${{runner.workspace}}/silkworm/build/cmd - run: | - # Clean up rpcdaemon process if it's still running - if kill -0 $RPC_DAEMON_PID 2> /dev/null; then - echo "Silkworm RpcDaemon stopping..." - kill $RPC_DAEMON_PID - echo "Silkworm RpcDaemon stopped" - else - echo "Silkworm RpcDaemon has already terminated" - fi - - - name: Resume the Erigon instance dedicated to db maintenance - run: | - python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true - - - name: Upload test results - if: steps.test_step.outputs.TEST_RESULT != 'success' - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ${{runner.workspace}}/rpc-tests/integration/mainnet/results/ - - - name: Save test results - if: steps.test_step.outputs.TEST_RESULT != 'success' - working-directory: ${{runner.workspace}}/silkworm - env: - TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} - run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --commit $(git rev-parse HEAD) --test_name rpc-integration-tests --outcome $TEST_RESULT #--result_file ${{runner.workspace}}/rpc-tests/integration/mainnet/result.json - - - name: Action for Success - if: steps.test_step.outputs.TEST_RESULT == 'success' - run: echo "::notice::Tests completed successfully" - - - name: Action for Failure - if: steps.test_step.outputs.TEST_RESULT != 'success' - run: | - echo "::error::Error detected during tests" - exit 1 - diff --git a/.github/workflows/rpc-performance-tests.yml b/.github/workflows/rpc-performance-tests.yml deleted file mode 100644 index 13156b8fd4..0000000000 --- a/.github/workflows/rpc-performance-tests.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: QA - RPC Performance Tests - -on: - schedule: - - cron: '0 0 * * *' # Run every day at 00:00 AM UTC - -jobs: - performance-test-suite: - runs-on: self-hosted - env: - ERIGON_DATA_DIR: /opt/erigon-versions/reference-version/datadir - RPC_PAST_TEST_DIR: /opt/rpc-past-tests - ERIGON_QA_PATH: /opt/erigon-qa - - steps: - - name: Checkout Silkworm repository - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: "0" - - - name: Checkout RPC Tests Repository & Install Requirements - run: | - rm -rf ${{runner.workspace}}/rpc-tests - git -c advice.detachedHead=false clone --depth 1 --branch v0.1.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests - cd ${{runner.workspace}}/rpc-tests - pip3 install -r requirements.txt - - - name: Clean Build Directory - run: rm -rf ${{runner.workspace}}/silkworm/build - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/silkworm/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/silkworm/build - run: | - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release - - - name: Build Silkworm RpcDaemon - working-directory: ${{runner.workspace}}/silkworm/build - run: cmake --build . --config Release --target rpcdaemon -j 8 - - - name: Pause the Erigon instance dedicated to db maintenance - run: | - python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true - - - name: Run Silkworm RpcDaemon - working-directory: ${{runner.workspace}}/silkworm/build/cmd - run: | - ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & - RPC_DAEMON_PID=$! - echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV - - - name: Run RPC Performance Tests - id: test_step - run: | - set +e # Disable exit on error - - cd ${{runner.workspace}}/rpc-tests/perf - rm -rf ./reports/mainnet - - # Launch the RPC performance test runner - python3 ./run_perf_tests.py -b mainnet -y eth_call -p pattern/mainnet/stress_test_eth_call_001_14M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u - python3 ./run_perf_tests.py -b mainnet -y eth_getLogs -p pattern/mainnet/stress_test_eth_getLogs_15M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u - python3 ./run_perf_tests.py -b mainnet -y eth_getBalance -p pattern/mainnet/stress_test_eth_getBalance_15M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u - python3 ./run_perf_tests.py -b mainnet -y eth_getBlockByHash -p pattern/mainnet/stress_test_eth_getBlockByHash_14M.tar -t 1:1,100:30,1000:20,10000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u - python3 ./run_perf_tests.py -b mainnet -y eth_getBlockByNumber -p pattern/mainnet/stress_test_eth_getBlockByNumber_13M.tar -t 1:1,100:30,1000:20,5000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u - python3 ./run_perf_tests.py -b mainnet -y eth_getTransactionByHash -p pattern/mainnet/stress_test_eth_getTransactionByHash_13M.tar -t 1:1,100:30,1000:20,10000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u - python3 ./run_perf_tests.py -b mainnet -y eth_getTransactionReceipt -p pattern/mainnet/stress_test_eth_getTransactionReceipt_14M.tar -t 1:1,100:30,1000:20,5000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u - - # Capture test runner script exit status - perf_exit_status=$? - - # Save test results to a directory with timestamp and commit hash - cp -r ${{runner.workspace}}/rpc-tests/perf/reports/mainnet $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_perf_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD) - - # Check test runner script exit status - if [ $perf_exit_status -eq 0 ]; then - echo "Tests completed successfully" - echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" - else - echo "Error detected during tests" - echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" - fi - - - name: Stop Silkworm RpcDaemon - working-directory: ${{runner.workspace}}/silkworm/build/cmd - run: | - # Clean up rpcdaemon process if it's still running - if kill -0 $RPC_DAEMON_PID 2> /dev/null; then - echo "Terminating rpc-daemon" - kill $RPC_DAEMON_PID - else - echo "rpc-daemon has already terminated" - fi - - - name: Resume the Erigon instance dedicated to db maintenance - run: | - python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true - - - name: Upload test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ${{runner.workspace}}/rpc-tests/perf/reports/mainnet - - - name: Save test results - if: always() - working-directory: ${{runner.workspace}}/silkworm - env: - TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} - run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --commit $(git rev-parse HEAD) --test_name rpc-performance-tests --outcome $TEST_RESULT #--result_file ${{runner.workspace}}/rpc-tests/perf/reports/mainnet/result.json - - - name: Action for Success - if: steps.test_step.outputs.TEST_RESULT == 'success' - run: echo "::notice::Tests completed successfully" - - - name: Action for Not Success - if: steps.test_step.outputs.TEST_RESULT != 'success' - run: | - echo "::error::Error detected during tests" - exit 1 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index b25d7a8127..0000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2023 The Silkworm Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Windows - -on: - push: - branches: - - master - - 'ci/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - windows: - runs-on: windows-latest - - # Disable on external PRs - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository - - strategy: - matrix: - config: - - {build_type: "Release"} - fail-fast: false # This makes it so that if 1 of the tests in the matrix fail, they don't all fail - - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: "0" - - - name: Install Conan - id: conan - uses: turtlebrowser/get-conan@main - with: - version: 1.60.2 - - - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory C:\build - - - name: Configure CMake - working-directory: C:\build - run: cmake ${{runner.workspace}}\silkworm -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} - - - name: Build unit tests - working-directory: C:\build - run: cmake --build . --config ${{ matrix.config.build_type }} --target all_unit_tests -j 1 - - - name: Build Ethereum EL tests - working-directory: C:\build - run: cmake --build . --config ${{ matrix.config.build_type }} --target ethereum -j 2 - - - name: Smoke tests - run: cmake -DSILKWORM_BUILD_DIR=C:\build -P cmake\run_smoke_tests.cmake - - - name: Unit tests - run: cmake -DSILKWORM_BUILD_DIR=C:\build -P cmake\run_unit_tests.cmake - - - name: Ethereum EL tests - working-directory: C:\build - run: | - cmd/test/${{ matrix.config.build_type }}/ethereum --threads 4 From cdcdad3e37faa74a29bd65601c079754674e21f8 Mon Sep 17 00:00:00 2001 From: battlmonstr Date: Thu, 21 Mar 2024 15:44:17 +0100 Subject: [PATCH 2/3] ci: macOS job - use Xcode 15 --- .github/workflows/macOS.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 5b2d626e72..6a98c29803 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -26,9 +26,9 @@ concurrency: jobs: osx: - runs-on: macos-13 + runs-on: macos-14 env: - DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer # Disable on external PRs if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository diff --git a/README.md b/README.md index dc56688ff7..777a05fbd1 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ git submodule update --init --recursive Building Silkworm requires: * C++20 compiler: [GCC](https://www.gnu.org/software/gcc/) >= 11.2 or [Clang](https://clang.llvm.org/) >= 15 -or AppleClang ([Xcode](https://developer.apple.com/xcode/) >= 14.3) +or AppleClang ([Xcode](https://developer.apple.com/xcode/) >= 15) * [CMake](https://cmake.org) * [Conan](https://conan.io) From f9e12de7f949f11682fe411a93f5d5ecc90b41d7 Mon Sep 17 00:00:00 2001 From: battlmonstr Date: Thu, 21 Mar 2024 17:27:56 +0100 Subject: [PATCH 3/3] Revert "debug" This reverts commit 9741aa9a681cb8dc534d498141e0674d493791ce. --- .circleci/config.yml | 476 ++++++++++++++++++++ .github/workflows/rpc-integration-tests.yml | 128 ++++++ .github/workflows/rpc-performance-tests.yml | 124 +++++ .github/workflows/windows.yml | 78 ++++ 4 files changed, 806 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .github/workflows/rpc-integration-tests.yml create mode 100644 .github/workflows/rpc-performance-tests.yml create mode 100644 .github/workflows/windows.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..5f04544669 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,476 @@ +# Copyright 2020 The Silkworm Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: 2.1 +orbs: + codecov: codecov/codecov@3.3.0 + +commands: + checkout_with_submodules: + parameters: + ethereum_tests: + description: Include a heavy Ethereum tests submodule if needed. + type: boolean + default: true + steps: + - checkout + - run: + name: "Update submodules" + command: | + if [[ <> == false ]] + then + git config submodule.ethereum-tests.update none + fi + + git submodule sync + git -c submodule.LegacyTests.update=none submodule update --init --recursive + + build: + parameters: + build_type: + type: string + default: Release + compiler_id: + type: string + compiler_version: + type: integer + conan_profile: + type: string + default: none + target: + type: string + default: all + steps: + - run: + name: "Install compiler" + command: cmake/setup/compiler_install.sh <> <> + - run: + name: "Cmake" + working_directory: ~/build + command: | + if [[ "<>" != "none" ]] + then + CONAN_CMAKE_ARGS="-DCONAN_PROFILE=<>" + fi + if [[ "<>" == "clang" ]] + then + TOOLCHAIN_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../project/cmake/toolchain/clang_libcxx.cmake" + fi + + cmake ../project -DCMAKE_BUILD_TYPE=<> $CONAN_CMAKE_ARGS $TOOLCHAIN_CMAKE_ARGS $BUILD_CMAKE_ARGS + - run: + name: "Build" + command: | + if [[ "<>" == "all" ]] + then + cmake --build ~/build -j16 + else + cmake --build ~/build -j16 --target <> + fi + + build_using_conan: + parameters: + build_type: + type: string + default: Release + compiler_id: + type: string + compiler_version: + type: integer + target: + type: string + default: all + steps: + - run: + name: "Install Conan" + command: sudo pip3 install conan==1.60.2 chardet + - run: + name: "Select Conan profile" + command: | + if [[ "<>" == "clang" ]] + then + conan_profile=linux_x64_clang_13_release + else + conan_profile=linux_x64_gcc_11_release + fi + echo "export CONAN_PROFILE='$conan_profile'" >> "$BASH_ENV" + cp "cmake/profiles/$conan_profile" "$HOME/selected_conan_profile" + - restore_cache: + name: "Restore Conan cache" + key: &conan-cache-key conan-machine-{{ .Environment.CIRCLE_JOB }}-<>-<>-{{checksum "../selected_conan_profile"}}-{{checksum "conanfile.py"}} + - build: + build_type: <> + compiler_id: <> + compiler_version: <> + conan_profile: $CONAN_PROFILE + target: <> + - save_cache: + name: "Save Conan cache" + key: *conan-cache-key + paths: + - ~/.conan + + build_fuzzer: + steps: + - checkout_with_submodules: + ethereum_tests: false + - run: + name: "Ensure pip" + command: | + sudo apt-get update + sudo apt install -y python3-pip + sudo pip install conan==1.60.2 chardet + sudo apt-get update + - run: + name: "Install compiler" + command: cmake/setup/compiler_install.sh clang 15 + - run: + name: "CMake Fuzzer" + working_directory: ~/build + command: cmake ../project -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONAN_PROFILE=linux_x64_clang_13_release -DCMAKE_TOOLCHAIN_FILE=../project/cmake/toolchain/clang_libcxx.cmake -DSILKWORM_FUZZER=ON + - run: + name: "Build Fuzzer" + command: | + cmake --build ~/build -j4 --target rpcdaemon_fuzzer_test + cmake --build ~/build -j4 --target rpcdaemon_fuzzer_diagnostics + + test: + parameters: + ethereum_tests: + type: boolean + default: true + steps: + - run: + name: "Smoke tests" + command: make "SILKWORM_BUILD_DIR=$HOME/build" run_smoke_tests + - run: + name: "Unit tests" + command: make "SILKWORM_BUILD_DIR=$HOME/build" run_unit_tests + - when: + condition: <> + steps: + - run: + name: "Ethereum EL tests" + working_directory: ~/build + no_output_timeout: 30m + command: cmd/test/ethereum + - run: + name: "Execution spec tests" + working_directory: ~/build + command: cmd/test/ethereum --tests $HOME/project/third_party/execution-spec-tests + + fuzz-test: + steps: + - run: + name: "RPCDaemon Fuzz test" + working_directory: ~/build + command: | + mkdir -p ~/corpus + mkdir -p ~/crashes + mkdir -p ~/artifacts + for file in ../project/third_party/execution-apis/tests/*/*.io; do cp --backup=numbered "$file" ~/artifacts; done + for file in ~/artifacts/*; do sed -i '2,$d' "$file"; done + for file in ~/artifacts/*; do sed -i 's/^>> //' "$file"; done + ./cmd/test/rpcdaemon_fuzzer_test ~/corpus ~/crashes ~/artifacts -max_total_time=86400 -detect_leaks=0 + +jobs: + lint: + machine: + image: ubuntu-2204:2023.04.2 + steps: + - add_ssh_keys: + fingerprints: + - "4b:13:8d:15:b9:98:1a:dc:96:c2:b9:ab:fa:c1:d4:e6" + - checkout + - run: + name: "Format" + working_directory: ~/project + command: | + sudo pip install cmake-format==0.6.13 + make fmt + if ! git diff --exit-code + then + commit_message="make fmt" + head_commit_message="$(git log -1 --pretty=%B)" + + if [[ "$head_commit_message" == "$commit_message" ]] + then + echo "The formatting style is not compliant, although it was formatted. Try to run 'make fmt' locally and push the changes." + exit 1 + else + git config user.name GitHub + git config user.email noreply@github.com + git commit --all --message="$commit_message" + git config push.autoSetupRemote true + git push + + echo "The formatting style was not compliant, but it is fixed now. A new workflow will start soon, wait for it..." + exit 2 + fi + fi + - run: + name: "Copyright" + working_directory: ~/project + command: cmake -P cmake/copyright.cmake + + linux-gcc-thread-sanitizer: + environment: + BUILD_CMAKE_ARGS: -DSILKWORM_SANITIZE=thread + machine: + image: ubuntu-2204:2023.04.2 + resource_class: 2xlarge + steps: + - checkout_with_submodules + - build_using_conan: + compiler_id: gcc + compiler_version: <> + build_type: Debug + - test + + linux-release: + parameters: + compiler_id: + type: string + compiler_version: + type: integer + ethereum_tests: + type: boolean + default: true + machine: + image: ubuntu-2204:2023.04.2 + resource_class: 2xlarge + steps: + - checkout_with_submodules: + ethereum_tests: <> + - build_using_conan: + compiler_id: <> + compiler_version: <> + - test: + ethereum_tests: <> + + linux-clang-address-sanitizer: + environment: + BUILD_CMAKE_ARGS: -DSILKWORM_SANITIZE=address,undefined + ASAN_OPTIONS: alloc_dealloc_mismatch=0 # https://github.com/llvm/llvm-project/issues/59432 + UBSAN_OPTIONS: print_stacktrace=1 + machine: + image: ubuntu-2204:2023.04.2 + resource_class: 2xlarge + steps: + - checkout_with_submodules + - build_using_conan: + build_type: Debug + compiler_id: clang + compiler_version: <> + - test + + linux-clang-coverage: + environment: + BUILD_CMAKE_ARGS: -DSILKWORM_CLANG_COVERAGE=ON + machine: + image: ubuntu-2204:2023.04.2 + resource_class: 2xlarge + steps: + - checkout_with_submodules + - build_using_conan: + build_type: Debug + compiler_id: clang + compiler_version: <> + - run: + name: "Unit tests" + command: make "SILKWORM_BUILD_DIR=$HOME/build" SILKWORM_CLANG_COVERAGE=ON run_unit_tests + - run: + name: "Ethereum EL tests" + no_output_timeout: 30m + command: LLVM_PROFILE_FILE=ethereum.profraw ~/build/cmd/test/ethereum + - run: + name: "Execution spec tests" + command: LLVM_PROFILE_FILE=execution-spec.profraw ~/build/cmd/test/ethereum --tests $HOME/project/third_party/execution-spec-tests + - run: + name: "Coverage" + command: | + llvm-profdata merge *.profraw -o profdata + llvm-cov export -instr-profile profdata ~/build/cmd/silkworm '-ignore-filename-regex=(third_party|silkworm/interfaces|test)' -format=lcov > /tmp/silkworm.lcov + llvm-cov report -instr-profile profdata ~/build/cmd/silkworm '-ignore-filename-regex=(third_party|silkworm/interfaces|test)' > /tmp/report.txt + - codecov/upload: + file: /tmp/silkworm.lcov + - store_artifacts: + path: /tmp/silkworm.lcov + - store_artifacts: + path: /tmp/report.txt + + linux-clang-tidy: + environment: + # see: https://clang.llvm.org/extra/clang-tidy/ + BUILD_CMAKE_ARGS: -DSILKWORM_CLANG_TIDY=ON + machine: + image: ubuntu-2204:2023.04.2 + resource_class: 2xlarge + steps: + - run: + name: "Install clang-tidy" + command: | + sudo apt-get update + sudo apt-get install -y clang-tidy + - checkout_with_submodules: + ethereum_tests: false + - build_using_conan: + build_type: Debug + compiler_id: clang + compiler_version: <> + - run: + name: "Generate report" + command: | + sudo pip install clang-html + sudo cp ~/project/third_party/clang-tidy-html/clang_visualizer.py /usr/local/lib/python3.10/dist-packages/clang_html/clang_visualizer.py + curl --output build.log "https://circleci.com/api/v1.1/project/github/torquem-ch/silkworm/$CIRCLE_BUILD_NUM/output/109/0?file=true" + clang-tidy-html build.log -o /tmp/report.html + - store_artifacts: + path: /tmp/report.html + + linux-clang-fuzzer: + parameters: + run_tests: + description: Run fuzzy tests if required. + type: boolean + default: false + environment: + BUILD_CMAKE_ARGS: -DSILKWORM_FUZZER=ON + UBSAN_OPTIONS: print_stacktrace=1 + docker: + - image: cimg/python:3.12 + resource_class: 2xlarge + steps: + - build_fuzzer + - when: + condition: <> + steps: + - fuzz-test + + linux-wasm-build: + environment: + WASI_SDK_VERSION: 20 + machine: + image: ubuntu-2204:2023.04.2 + steps: + - checkout_with_submodules: + ethereum_tests: false + - run: + name: "Install WASI SDK" + working_directory: ~/tmp1 + command: | + wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-linux.tar.gz + tar xvf wasi-sdk-$WASI_SDK_VERSION.0-linux.tar.gz + sudo mv wasi-sdk-$WASI_SDK_VERSION.0 /opt/wasi-sdk + - run: + name: "Install dependencies" + command: | + sudo apt-get update + sudo apt-get install -y texinfo libtinfo5 + - run: + name: "Install Conan" + command: sudo pip3 install conan==1.60.2 chardet + - run: + name: "Install Wasmer" + working_directory: ~/tmp2 + command: $HOME/project/third_party/wasmer/install.sh v3.2.1 + - run: + name: "Build GMP" + working_directory: ~/tmp3 + command: | + git clone https://github.com/torquem-ch/gmp-wasm + cd gmp-wasm + git checkout 87e9087 + ./configure --prefix $HOME/opt-wasm CC=/opt/wasi-sdk/bin/clang --host=none AR=llvm-ar RANLIB=llvm-ranlib --enable-cxx CXX=/opt/wasi-sdk/bin/clang++ ABI=longlong + make -j + make install + - run: + name: "Cmake" + working_directory: ~/build + command: | + cmake ../project -DCMAKE_TOOLCHAIN_FILE=$HOME/project/cmake/toolchain/wasi.cmake -DSILKWORM_CORE_ONLY=ON -DSILKWORM_CORE_USE_ABSEIL=OFF -DSILKWORM_WASM_API=ON -DGMP_INCLUDE_DIR=$HOME/opt-wasm/include -DGMP_LIBRARY=$HOME/opt-wasm/lib/libgmp.a -DCMAKE_BUILD_TYPE=Release + - run: + name: "Build" + command: cmake --build ~/build -j + - run: + name: "Core unit tests" + working_directory: ~/build + command: wasmer cmd/test/core_test --stack-size 16777216 + +parameters: + clang_version_min: + type: integer + default: 15 + clang_version_latest: + type: integer + default: 15 + gcc_version_min: + type: integer + default: 11 + gcc_version_latest: + type: integer + default: 12 + +workflows: + light: + when: + not: + equal: [ master, <> ] + jobs: + - lint + - linux-release: + name: linux-gcc-<>-release + compiler_id: gcc + compiler_version: <> + ethereum_tests: false + requires: + - lint + - linux-release: + name: linux-clang-<>-release + compiler_id: clang + compiler_version: <> + ethereum_tests: false + requires: + - lint + + integration: + when: + or: + - equal: [ master, <> ] + - matches: { pattern: "^ci\\/.+$", value: <> } + jobs: + - linux-release: + name: linux-gcc-<>-release + compiler_id: gcc + compiler_version: <> + - linux-gcc-thread-sanitizer + - linux-clang-coverage + - linux-clang-address-sanitizer + - linux-clang-fuzzer: + name: linux-clang-fuzzer + - linux-clang-tidy + - linux-wasm-build + + fuzzer: + triggers: + - schedule: + cron: "0 0 * * 6" + filters: + branches: + only: + - master + jobs: + - linux-clang-fuzzer: + name: linux-clang-run-fuzzer + run_tests: true diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml new file mode 100644 index 0000000000..e26b1c184a --- /dev/null +++ b/.github/workflows/rpc-integration-tests.yml @@ -0,0 +1,128 @@ +name: QA - RPC Integration Tests + +on: + pull_request: + branches: + - master + types: + - opened + - ready_for_review + - synchronize + +jobs: + integration-test-suite: + runs-on: self-hosted + env: + ERIGON_DATA_DIR: /opt/erigon-versions/reference-version/datadir + RPC_PAST_TEST_DIR: /opt/rpc-past-tests + ERIGON_QA_PATH: /opt/erigon-qa + + steps: + - name: Checkout Silkworm Repository + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: "0" + + - name: Checkout RPC Tests Repository & Install Requirements + run: | + rm -rf ${{runner.workspace}}/rpc-tests + git -c advice.detachedHead=false clone --depth 1 --branch v0.5.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + cd ${{runner.workspace}}/rpc-tests + pip3 install -r requirements.txt + + - name: Clean Build Directory + run: rm -rf ${{runner.workspace}}/silkworm/build + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/silkworm/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/silkworm/build + run: | + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release + + - name: Build Silkworm RpcDaemon + working-directory: ${{runner.workspace}}/silkworm/build + run: cmake --build . --config Release --target rpcdaemon -j 8 + + - name: Pause the Erigon instance dedicated to db maintenance + run: | + python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true + + - name: Start Silkworm RpcDaemon + working-directory: ${{runner.workspace}}/silkworm/build/cmd + run: | + echo "Silkworm RpcDaemon starting..." + ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check --ws & + RPC_DAEMON_PID=$! + echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV + echo "Silkworm RpcDaemon started" + + - name: Run RPC Integration Tests + id: test_step + run: | + set +e # Disable exit on error + + cd ${{runner.workspace}}/rpc-tests/integration + rm -rf ./mainnet/results/ + + # Run RPC integration test runner via http + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json,engine_ --transport_type http,websocket + + # Capture test runner script exit status + test_exit_status=$? + + # Check test runner exit status + if [ $test_exit_status -eq 0 ]; then + echo "tests completed successfully" + echo + echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" + else + echo "error detected during tests" + echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" + + # Save failed results to a directory with timestamp and commit hash + cp -r ${{runner.workspace}}/rpc-tests/integration/mainnet/results/ $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD)_http/ + fi + + - name: Stop Silkworm RpcDaemon + working-directory: ${{runner.workspace}}/silkworm/build/cmd + run: | + # Clean up rpcdaemon process if it's still running + if kill -0 $RPC_DAEMON_PID 2> /dev/null; then + echo "Silkworm RpcDaemon stopping..." + kill $RPC_DAEMON_PID + echo "Silkworm RpcDaemon stopped" + else + echo "Silkworm RpcDaemon has already terminated" + fi + + - name: Resume the Erigon instance dedicated to db maintenance + run: | + python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true + + - name: Upload test results + if: steps.test_step.outputs.TEST_RESULT != 'success' + uses: actions/upload-artifact@v4 + with: + name: test-results + path: ${{runner.workspace}}/rpc-tests/integration/mainnet/results/ + + - name: Save test results + if: steps.test_step.outputs.TEST_RESULT != 'success' + working-directory: ${{runner.workspace}}/silkworm + env: + TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} + run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --commit $(git rev-parse HEAD) --test_name rpc-integration-tests --outcome $TEST_RESULT #--result_file ${{runner.workspace}}/rpc-tests/integration/mainnet/result.json + + - name: Action for Success + if: steps.test_step.outputs.TEST_RESULT == 'success' + run: echo "::notice::Tests completed successfully" + + - name: Action for Failure + if: steps.test_step.outputs.TEST_RESULT != 'success' + run: | + echo "::error::Error detected during tests" + exit 1 + diff --git a/.github/workflows/rpc-performance-tests.yml b/.github/workflows/rpc-performance-tests.yml new file mode 100644 index 0000000000..13156b8fd4 --- /dev/null +++ b/.github/workflows/rpc-performance-tests.yml @@ -0,0 +1,124 @@ +name: QA - RPC Performance Tests + +on: + schedule: + - cron: '0 0 * * *' # Run every day at 00:00 AM UTC + +jobs: + performance-test-suite: + runs-on: self-hosted + env: + ERIGON_DATA_DIR: /opt/erigon-versions/reference-version/datadir + RPC_PAST_TEST_DIR: /opt/rpc-past-tests + ERIGON_QA_PATH: /opt/erigon-qa + + steps: + - name: Checkout Silkworm repository + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: "0" + + - name: Checkout RPC Tests Repository & Install Requirements + run: | + rm -rf ${{runner.workspace}}/rpc-tests + git -c advice.detachedHead=false clone --depth 1 --branch v0.1.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + cd ${{runner.workspace}}/rpc-tests + pip3 install -r requirements.txt + + - name: Clean Build Directory + run: rm -rf ${{runner.workspace}}/silkworm/build + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/silkworm/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/silkworm/build + run: | + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release + + - name: Build Silkworm RpcDaemon + working-directory: ${{runner.workspace}}/silkworm/build + run: cmake --build . --config Release --target rpcdaemon -j 8 + + - name: Pause the Erigon instance dedicated to db maintenance + run: | + python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true + + - name: Run Silkworm RpcDaemon + working-directory: ${{runner.workspace}}/silkworm/build/cmd + run: | + ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & + RPC_DAEMON_PID=$! + echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV + + - name: Run RPC Performance Tests + id: test_step + run: | + set +e # Disable exit on error + + cd ${{runner.workspace}}/rpc-tests/perf + rm -rf ./reports/mainnet + + # Launch the RPC performance test runner + python3 ./run_perf_tests.py -b mainnet -y eth_call -p pattern/mainnet/stress_test_eth_call_001_14M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u + python3 ./run_perf_tests.py -b mainnet -y eth_getLogs -p pattern/mainnet/stress_test_eth_getLogs_15M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u + python3 ./run_perf_tests.py -b mainnet -y eth_getBalance -p pattern/mainnet/stress_test_eth_getBalance_15M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u + python3 ./run_perf_tests.py -b mainnet -y eth_getBlockByHash -p pattern/mainnet/stress_test_eth_getBlockByHash_14M.tar -t 1:1,100:30,1000:20,10000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u + python3 ./run_perf_tests.py -b mainnet -y eth_getBlockByNumber -p pattern/mainnet/stress_test_eth_getBlockByNumber_13M.tar -t 1:1,100:30,1000:20,5000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u + python3 ./run_perf_tests.py -b mainnet -y eth_getTransactionByHash -p pattern/mainnet/stress_test_eth_getTransactionByHash_13M.tar -t 1:1,100:30,1000:20,10000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u + python3 ./run_perf_tests.py -b mainnet -y eth_getTransactionReceipt -p pattern/mainnet/stress_test_eth_getTransactionReceipt_14M.tar -t 1:1,100:30,1000:20,5000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u + + # Capture test runner script exit status + perf_exit_status=$? + + # Save test results to a directory with timestamp and commit hash + cp -r ${{runner.workspace}}/rpc-tests/perf/reports/mainnet $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_perf_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD) + + # Check test runner script exit status + if [ $perf_exit_status -eq 0 ]; then + echo "Tests completed successfully" + echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" + else + echo "Error detected during tests" + echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" + fi + + - name: Stop Silkworm RpcDaemon + working-directory: ${{runner.workspace}}/silkworm/build/cmd + run: | + # Clean up rpcdaemon process if it's still running + if kill -0 $RPC_DAEMON_PID 2> /dev/null; then + echo "Terminating rpc-daemon" + kill $RPC_DAEMON_PID + else + echo "rpc-daemon has already terminated" + fi + + - name: Resume the Erigon instance dedicated to db maintenance + run: | + python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: ${{runner.workspace}}/rpc-tests/perf/reports/mainnet + + - name: Save test results + if: always() + working-directory: ${{runner.workspace}}/silkworm + env: + TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} + run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --commit $(git rev-parse HEAD) --test_name rpc-performance-tests --outcome $TEST_RESULT #--result_file ${{runner.workspace}}/rpc-tests/perf/reports/mainnet/result.json + + - name: Action for Success + if: steps.test_step.outputs.TEST_RESULT == 'success' + run: echo "::notice::Tests completed successfully" + + - name: Action for Not Success + if: steps.test_step.outputs.TEST_RESULT != 'success' + run: | + echo "::error::Error detected during tests" + exit 1 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000000..b25d7a8127 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,78 @@ +# Copyright 2023 The Silkworm Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Windows + +on: + push: + branches: + - master + - 'ci/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + windows: + runs-on: windows-latest + + # Disable on external PRs + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + strategy: + matrix: + config: + - {build_type: "Release"} + fail-fast: false # This makes it so that if 1 of the tests in the matrix fail, they don't all fail + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: "0" + + - name: Install Conan + id: conan + uses: turtlebrowser/get-conan@main + with: + version: 1.60.2 + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory C:\build + + - name: Configure CMake + working-directory: C:\build + run: cmake ${{runner.workspace}}\silkworm -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} + + - name: Build unit tests + working-directory: C:\build + run: cmake --build . --config ${{ matrix.config.build_type }} --target all_unit_tests -j 1 + + - name: Build Ethereum EL tests + working-directory: C:\build + run: cmake --build . --config ${{ matrix.config.build_type }} --target ethereum -j 2 + + - name: Smoke tests + run: cmake -DSILKWORM_BUILD_DIR=C:\build -P cmake\run_smoke_tests.cmake + + - name: Unit tests + run: cmake -DSILKWORM_BUILD_DIR=C:\build -P cmake\run_unit_tests.cmake + + - name: Ethereum EL tests + working-directory: C:\build + run: | + cmd/test/${{ matrix.config.build_type }}/ethereum --threads 4