diff --git a/.cicd/defaults.json b/.cicd/defaults.json new file mode 100644 index 00000000..deaa69b8 --- /dev/null +++ b/.cicd/defaults.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/.cicd/platforms.json b/.cicd/platforms.json new file mode 100644 index 00000000..2b0c8c46 --- /dev/null +++ b/.cicd/platforms.json @@ -0,0 +1,5 @@ +{ + "ubuntu22": { + "dockerfile": ".cicd/platforms/ubuntu22.Dockerfile" + } + } diff --git a/.cicd/platforms/ubuntu22.Dockerfile b/.cicd/platforms/ubuntu22.Dockerfile new file mode 100644 index 00000000..0bce4565 --- /dev/null +++ b/.cicd/platforms/ubuntu22.Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:jammy +ENV TZ="America/New_York" +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y build-essential \ + cmake \ + gcc-11 \ + g++-11 \ + git \ + python3-pip +RUN pip install -v "conan==1.60.2" diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 6e9745d2..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,388 +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 - -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.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 - steps: - - run: - name: "Install compiler" - command: cmake/setup/compiler_install.sh <> <> - - run: - name: "Install dependencies" - command: | - sudo apt-get update - sudo apt-get install -y m4 texinfo bison - - 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: cmake --build ~/build -j8 # each compiler job requires 4GB of RAM - - build_using_conan: - parameters: - build_type: - type: string - default: Release - compiler_id: - type: string - compiler_version: - type: integer - steps: - - run: - name: "Install Conan" - command: sudo pip3 install conan==1.58.0 chardet - - run: - name: "Select Conan profile" - command: | - if [[ "<>" == "clang" ]] - then - conan_profile=linux_clang_13_release - else - conan_profile=linux_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.txt"}} - - build: - build_type: <> - compiler_id: <> - compiler_version: <> - conan_profile: $CONAN_PROFILE - - save_cache: - name: "Save Conan cache" - key: *conan-cache-key - paths: - - ~/.conan - - test: - parameters: - ethereum_tests: - type: boolean - default: true - steps: - - 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 --threads 8 - -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: xlarge - 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: xlarge - 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: xlarge - 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: xlarge - 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: "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 - - 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: xlarge - 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: 14 - - run: - name: "Generate report" - command: | - sudo pip install clang-html - curl --output build.log "https://circleci.com/api/v1.1/project/github/torquem-ch/silkworm/$CIRCLE_BUILD_NUM/output/110/0?file=true" - clang-tidy-html build.log -o /tmp/report.html - - store_artifacts: - path: /tmp/report.html - - linux-wasm-build: - environment: - WASI_SDK_VERSION: 14 - 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.58.0 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: | - sed -i.bak '/grpc/d' ../project/conanfile.txt # remove GRPC dependencies to avoid building them - 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: 13 - clang_version_latest: - type: integer - default: 15 - gcc_version_min: - type: integer - default: 11 - gcc_version_latest: - type: integer - default: 12 - -workflows: - version: 2 - - 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-release: - name: linux-clang-<>-release - compiler_id: clang - compiler_version: <> - - linux-gcc-thread-sanitizer - - linux-clang-coverage - - linux-clang-address-sanitizer - - linux-clang-tidy - - linux-wasm-build diff --git a/.github/workflows/build-tests.sh b/.github/workflows/build-tests.sh new file mode 100755 index 00000000..f17438f4 --- /dev/null +++ b/.github/workflows/build-tests.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -eo pipefail + +# print and run a command +function ee() +{ + echo "$ $*" + eval "$@" +} + +# debug code +echo "CC='${CC}'" +echo "CXX='${CXX}'" +ee cmake --version + +# build +ee mkdir build +ee pushd build +ee cmake .. +ee make -j "$(nproc)" + +# pack +ee popd +ee 'tar -czf build.tar.gz build/cmd/test/*_test' + +echo "Done! - ${0##*/}" diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml deleted file mode 100644 index 49e7174d..00000000 --- a/.github/workflows/macOS.yml +++ /dev/null @@ -1,82 +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: macOS - -on: - push: - branches: - - master - - 'ci/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - osx: - runs-on: macOS-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 Prerequisites - run: | - brew install gmp - pip3 install --user conan==1.58.0 chardet - echo "$HOME/Library/Python/$(ls $HOME/Library/Python)/bin" >> "$GITHUB_PATH" - - - 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 ${{runner.workspace}}/build - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.config.cc }}-${{ matrix.config.build_type }} # Eg. "linux_x64-ubuntu-latest-clang-12-Debug" - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - env: - CC: ${{ matrix.config.cc}} - CXX: ${{ matrix.config.cxx}} - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} - - - name: Build - working-directory: ${{runner.workspace}}/build - # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config ${{ matrix.config.build_type }} -j 2 - - - name: Unit tests - run: make "SILKWORM_BUILD_DIR=${{runner.workspace}}/build" run_unit_tests - - - name: Ethereum EL tests - working-directory: ${{runner.workspace}}/build - run: | - cmd/test/ethereum --threads 4 diff --git a/.github/workflows/silkworm.md b/.github/workflows/silkworm.md new file mode 100644 index 00000000..13a0764c --- /dev/null +++ b/.github/workflows/silkworm.md @@ -0,0 +1,53 @@ +# EOS EVM Silkworm CI +This GitHub Actions workflow builds all silkworm modules + +### Index +1. [Triggers](#triggers) +1. [Inputs](#inputs) +1. [Steps](#steps) +1. [Outputs](#outputs) +1. [See Also](#see-also) + +## Triggers +This GitHub action will run under the following circumstances: +1. When code is pushed. +1. Workflow dispatch event, a manual CI run, which can be triggered by the "Workflow Dispatch" button in the Actions tab of the GitHub repository, among other means. + +## Inputs +The inputs for this GitHub action are: +1. `GITHUB_TOKEN` - a GitHub Actions intrinsic used to access the repository and other public resources. +1. `TRUSTEVM_CI_APP_ID` - the app ID of the `trustevm-ci-submodule-checkout` GitHub App. +1. `TRUSTEVM_CI_APP_KEY` - the private key to the `trustevm-ci-submodule-checkout` GitHub App. +1. `upload-artifacts` - a boolean input that specifies whether or not to upload the artifacts of the build. The default value is `false`. This can be overridden in manual CI runs. + +These inputs are used in various steps of the workflow to perform actions such as authentication, downloading artifacts, configuring the build, and uploading artifacts. + +## Steps +This workflow performs the following steps: +1. Attach Documentation + 1. Checkout the repo with no submodules. + 1. Attach an annotation to the GitHub Actions build summary page containing CI documentation. +1. EOS EVM Siklworm Build + 1. Authenticate to the `trustevm-ci-submodule-checkout` GitHub app using the [AntelopeIO/github-app-token-action](https://github.com/AntelopeIO/github-app-token-action) action to obtain an ephemeral token. + 1. Checkout the repo and submodules using the ephemeral token. + 1. Build using `cmake` and `make`. + 1. Upload the test binaries to GitHub Actions if the `upload-artifacts` input is set to `true`. + +## Outputs +This workflow produces the following outputs: +1. Build Artifacts - `build.tar.gz` containing the built artifacts of unit tests of the silkworm project, if the `upload-artifacts` input is set to `true`. Note that only tests are included as we do not really care about other binaries for this repo. + +> 💾️ Build artifacts are only attached on-demand for this pipeline because they are >117 MB each, but we only get 2 GB of cumulative artifact storage in GitHub Actions while eos-evm is a private repo. Obtain artifacts by performing a manual build with `upload-artifacts` set to `true`. + +## See Also +- [github-app-token-action](https://github.com/AntelopeIO/github-app-token-action) GitHub action +- [EOS EVM Documentation](../../README.md) + +For assistance with the CI system, please open an issue in this repo or reach out in the `#help-automation` channel via IM. + +*** +**_Legal notice_** +This document was generated in collaboration with ChatGPT from OpenAI, a machine learning algorithm or weak artificial intelligence (AI). At the time of this writing, the [OpenAI terms of service agreement](https://openai.com/terms) §3.a states: +> Your Content. You may provide input to the Services (“Input”), and receive output generated and returned by the Services based on the Input (“Output”). Input and Output are collectively “Content.” As between the parties and to the extent permitted by applicable law, you own all Input, and subject to your compliance with these Terms, OpenAI hereby assigns to you all its right, title and interest in and to Output. + +This notice is required in some countries. diff --git a/.github/workflows/silkworm.yml b/.github/workflows/silkworm.yml new file mode 100644 index 00000000..30df960c --- /dev/null +++ b/.github/workflows/silkworm.yml @@ -0,0 +1,178 @@ +name: EOS EVM Silkworm CI + +on: + push: + branches: + - main + - release/* + pull_request: + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + documentation: + name: Attach Documentation + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 1 + submodules: 'false' + + - name: Attach Documentation + run: cat .github/workflows/silkworm.md >> $GITHUB_STEP_SUMMARY + + d: + name: Discover Platforms + runs-on: ubuntu-latest + outputs: + missing-platforms: ${{steps.discover.outputs.missing-platforms}} + p: ${{steps.discover.outputs.platforms}} + steps: + - name: Discover Platforms + id: discover + uses: AntelopeIO/discover-platforms-action@v1 + with: + platform-file: .cicd/platforms.json + password: ${{secrets.GITHUB_TOKEN}} + package-name: builders + + build-platforms: + name: Build Platforms + needs: d + if: needs.d.outputs.missing-platforms != '[]' + strategy: + fail-fast: false + matrix: + platform: ${{fromJSON(needs.d.outputs.missing-platforms)}} + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Login to Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{github.repository_owner}} + password: ${{secrets.GITHUB_TOKEN}} + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} + file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}} + + build: + name: EOS EVM Silkworm Build + needs: [d, build-platforms] + if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped') + strategy: + fail-fast: false + matrix: + platform: [ ubuntu22 ] + runs-on: ubuntu-latest + container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} + + steps: +# - name: Authenticate +# id: auth +# uses: AntelopeIO/github-app-token-action@v1 +# with: +# app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }} +# private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }} + + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: 'recursive' + token: ${{secrets.GITHUB_TOKEN}} + + - name: Build EOS EVM Silkworm + run: .github/workflows/build-tests.sh + env: + CC: gcc-11 + CXX: g++-11 + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: build.tar.gz + path: build.tar.gz + + unit-test: + name: EOS EVM Silkworm Unit Tests + needs: [d, build] + if: always() && needs.d.result == 'success' && needs.build.result == 'success' + strategy: + fail-fast: false + matrix: + platform: [ ubuntu22 ] + runs-on: ubuntu-latest + container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} + env: + CC: gcc-11 + CXX: g++-11 + DCMAKE_BUILD_TYPE: 'Release' + + steps: + - name: Update Package Index & Upgrade Packages + run: | + apt-get update + apt-get upgrade -y + apt update + apt upgrade -y + +# - name: Authenticate +# id: auth +# uses: AntelopeIO/github-app-token-action@v1 +# with: +# app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }} +# private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }} + + - name: Download EOS EVM Silkworm builddir + uses: actions/download-artifact@v3 + with: + name: build.tar.gz + + - name: Extract EOS EVM Silkworm builddir + id: evm-silkworm-build + run: | + mkdir silkworm + mv build.tar.gz silkworm/ + pushd silkworm + tar xvf build.tar.gz + pushd build + echo "EVM_SILKWORM_BUILD=$(pwd)" >> "$GITHUB_OUTPUT" + popd + + - name: Test rpcdaemon_test + run: | + cd ${{ steps.evm-silkworm-build.outputs.EVM_SILKWORM_BUILD }}/cmd/test/ + ./rpcdaemon_test + + - name: Test core_test + run: | + cd ${{ steps.evm-silkworm-build.outputs.EVM_SILKWORM_BUILD }}/cmd/test/ + ./core_test + + - name: Test infra_test + run: | + cd ${{ steps.evm-silkworm-build.outputs.EVM_SILKWORM_BUILD }}/cmd/test/ + ./infra_test + + - name: Test node_test + run: | + cd ${{ steps.evm-silkworm-build.outputs.EVM_SILKWORM_BUILD }}/cmd/test/ + ./node_test + + - name: Test sync_test + run: | + cd ${{ steps.evm-silkworm-build.outputs.EVM_SILKWORM_BUILD }}/cmd/test/ + ./sync_test + diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index fa49e34f..00000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,75 +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.59.0 - - - 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: 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 diff --git a/cmd/common/rpcdaemon_options.cpp b/cmd/common/rpcdaemon_options.cpp index 2936eb1d..bd947c5c 100644 --- a/cmd/common/rpcdaemon_options.cpp +++ b/cmd/common/rpcdaemon_options.cpp @@ -101,7 +101,7 @@ void add_rpcdaemon_options(CLI::App& cli, silkworm::rpc::DaemonSettings& setting cli.add_flag("--rpc_quirk_flag", settings.rpc_quirk_flag) ->description("Flag controling quirk modes for rpc APIs") - ->check(CLI::Range(0, UINT64_MAX)) + ->check(CLI::Range(uint64_t(0), UINT64_MAX)) ->capture_default_str(); } diff --git a/silkworm/silkrpc/core/estimate_gas_oracle_test.cpp b/silkworm/silkrpc/core/estimate_gas_oracle_test.cpp index 1211c8cb..6497cd52 100644 --- a/silkworm/silkrpc/core/estimate_gas_oracle_test.cpp +++ b/silkworm/silkrpc/core/estimate_gas_oracle_test.cpp @@ -390,9 +390,8 @@ TEST_CASE("estimate gas") { try { EXPECT_CALL(estimate_gas_oracle, try_execution(_, _, _)) - .Times(3) - .WillOnce(Return(expect_result_fail_pre_check)) - .WillRepeatedly(Return(expect_result_fail)); + .Times(1) + .WillOnce(Return(expect_result_fail_pre_check)); auto result = boost::asio::co_spawn(pool, estimate_gas_oracle.estimate_gas(call, block), boost::asio::use_future); result.get(); CHECK(false); @@ -415,9 +414,8 @@ TEST_CASE("estimate gas") { try { EXPECT_CALL(estimate_gas_oracle, try_execution(_, _, _)) - .Times(3) - .WillOnce(Return(expect_result_fail_pre_check)) - .WillRepeatedly(Return(expect_result_fail)); + .Times(1) + .WillOnce(Return(expect_result_fail_pre_check)); auto result = boost::asio::co_spawn(pool, estimate_gas_oracle.estimate_gas(call, block), boost::asio::use_future); result.get(); CHECK(false); diff --git a/silkworm/silkrpc/core/evm_trace_test.cpp b/silkworm/silkrpc/core/evm_trace_test.cpp index bc21beab..5b5cf3c6 100644 --- a/silkworm/silkrpc/core/evm_trace_test.cpp +++ b/silkworm/silkrpc/core/evm_trace_test.cpp @@ -2585,7 +2585,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_block") { "action": { "author": "0x0000000000000000000000000000000000000000", "rewardType": "block", - "value": "0x1bc16d674ec80000" + "value": "0x0" }, "blockHash": "0x527198f474c1f1f1d01129d3a17ecc17895d85884a31b05ef0ecd480faee1592", "blockNumber": 1024165, @@ -3843,18 +3843,26 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { })); // TransactionDatabase::walk: TABLE BlockTransaction - static Bytes kBlockTransactionKey1{*silkworm::from_hex("0000000005c62e67")}; + static Bytes kBlockTransactionKey1{*silkworm::from_hex("0000000005c62e66")}; static uint32_t kBlockTransactionFixedBits1{0}; EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, silkworm::ByteView{kBlockTransactionKey1}, kBlockTransactionFixedBits1, _)) - .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { + .WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); // TransactionDatabase::walk: TABLE BlockTransaction - static Bytes kBlockTransactionKey2{*silkworm::from_hex("0000000005c62e6a")}; + static Bytes kBlockTransactionKey2{*silkworm::from_hex("0000000005c62e69")}; static uint32_t kBlockTransactionFixedBits2{0}; EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, silkworm::ByteView{kBlockTransactionKey2}, kBlockTransactionFixedBits2, _)) - .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { + .WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { + co_return; + })); + + // TransactionDatabase::walk: TABLE BlockTransaction + static Bytes kBlockTransactionKey3{*silkworm::from_hex("0000000005c62e6f")}; + static uint32_t kBlockTransactionFixedBits3{0}; + EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, silkworm::ByteView{kBlockTransactionKey3}, kBlockTransactionFixedBits3, _)) + .WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); @@ -5343,7 +5351,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { "action": { "author": "0x0000000000000000000000000000000000000000", "rewardType": "block", - "value": "0x1bc16d674ec80000" + "value": "0x0" }, "blockHash": "0xa87009e08f9af73efe86d702561afcf98f277a8acec60b97869969e367c12d66", "blockNumber": 7200002, @@ -5356,7 +5364,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { "action": { "author": "0x0000000000000000000000000000000000000000", "rewardType": "block", - "value": "0x1bc16d674ec80000" + "value": "0x0" }, "blockHash": "0xa316f156582fb5fba2166910becdb6342965a801fa473e18cd6a0c06143cac1a", "blockNumber": 7200003, @@ -5529,7 +5537,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { "action": { "author": "0x0000000000000000000000000000000000000000", "rewardType": "block", - "value": "0x1bc16d674ec80000" + "value": "0x0" }, "blockHash": "0xa87009e08f9af73efe86d702561afcf98f277a8acec60b97869969e367c12d66", "blockNumber": 7200002, @@ -5600,7 +5608,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { "action": { "author": "0x0000000000000000000000000000000000000000", "rewardType": "block", - "value": "0x1bc16d674ec80000" + "value": "0x0" }, "blockHash": "0xa87009e08f9af73efe86d702561afcf98f277a8acec60b97869969e367c12d66", "blockNumber": 7200002, @@ -5613,7 +5621,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { "action": { "author": "0x0000000000000000000000000000000000000000", "rewardType": "block", - "value": "0x1bc16d674ec80000" + "value": "0x0" }, "blockHash": "0xa316f156582fb5fba2166910becdb6342965a801fa473e18cd6a0c06143cac1a", "blockNumber": 7200003, @@ -5684,7 +5692,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { "action": { "author": "0x0000000000000000000000000000000000000000", "rewardType": "block", - "value": "0x1bc16d674ec80000" + "value": "0x0" }, "blockHash": "0xa316f156582fb5fba2166910becdb6342965a801fa473e18cd6a0c06143cac1a", "blockNumber": 7200003,