diff --git a/.github/actions/solc-build/action.yml b/.github/actions/solc-build/action.yml new file mode 100644 index 0000000000..23ac6e5adb --- /dev/null +++ b/.github/actions/solc-build/action.yml @@ -0,0 +1,95 @@ +name: 'Build' +description: 'Builds solc executable.' +inputs: + release-suffix: + description: 'Release suffix.' + required: false + default: '' + zksync-version: + description: 'Release version.' + required: true + solc-version: + description: 'Solidity version.' + required: true + build-type: + description: 'Build type: candidate or reference' + required: false + default: 'candidate' + extra-args: + description: 'Extra arguments for cmake.' + required: false + default: '' +runs: + using: "composite" + steps: + + - name: Install Boost (MacOS ARM64) + if: runner.os == 'macOS' + shell: bash + env: + BOOST_DOWNLOAD_URL: "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source" + BOOST_FILENAME: "boost_1_71_0" + run: | + curl -L -o ${BOOST_FILENAME}.tar.gz "${BOOST_DOWNLOAD_URL}/${BOOST_FILENAME}.tar.gz" + tar xzf "${BOOST_FILENAME}.tar.gz" && cd ${BOOST_FILENAME} + if [ ${RUNNER_ARCH} = ARM64 ]; then + ./bootstrap.sh --prefix=${PWD}/boost + else + ./bootstrap.sh --prefix=/usr/local --with-python-version=2.7 + fi + ./b2 link=static runtime-link=static -j$(sysctl -n hw.ncpu) + ./b2 install -j$(sysctl -n hw.ncpu) + + - name: Build solc + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + env: + CXXFLAGS: "-Wno-narrowing" + run: | + mkdir -p ./build + cd ./build + [ ${RUNNER_OS} = macOS ] && PARALLEL=$(sysctl -n hw.ncpu) || PARALLEL=$(nproc) + cmake .. \ + -DCMAKE_BUILD_TYPE="Release" \ + -DCMAKE_CXX_FLAGS="-DJSON_USE_INT64_DOUBLE_CONVERSION" \ + -DSOL_VERSION_ZKSYNC="${{ inputs.solc-version }}-${{ inputs.zksync-version }}" \ + -DSOLC_VERSION_ZKEVM="${{ inputs.solc-version }}-${{ inputs.zksync-version }}" \ + -DSOL_VERSION_ZKEVM="${{ inputs.solc-version }}-${{ inputs.zksync-version }}" \ + -DUSE_Z3=OFF \ + -DUSE_CVC4=OFF \ + -DTESTS=0 \ + -DBoost_NO_BOOST_CMAKE=TRUE \ + -DSOLC_LINK_STATIC=1 \ + -DSTATIC_LINKING=1 \ + -DPEDANTIC=OFF ${{ inputs.extra-args}} + if [[ ${{ inputs.solc-version}} == "0.4"* ]]; then + cmake --build . --config Release --parallel ${PARALLEL} --target jsoncpp-project + cmake --build . --config Release --parallel ${PARALLEL} --target range-v3-project + fi + cmake --build . --config Release --parallel ${PARALLEL} --target solc + [ "$RUNNER_OS" = "Windows" ] && WIN_SUFFIX=".exe" + cp ./solc/solc${WIN_SUFFIX} ./solc/solc-${{ inputs.solc-version }}-${{ inputs.build-type }}${WIN_SUFFIX} + + - name: Upload binary for testing + if: inputs.release-suffix == '' + uses: actions/upload-artifact@v4 + with: + name: solc-${{ inputs.solc-version }}-${{ inputs.build-type }} + path: ./build/solc/solc-${{ inputs.solc-version }}-${{ inputs.build-type }} + + - name: Prepare binary + if: inputs.release-suffix != '' + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + run: | + [ "$RUNNER_OS" = "Windows" ] && WIN_SUFFIX=".exe" + SOLC_BIN="./build/solc/solc${WIN_SUFFIX}" + mkdir -p ./releases/${{ inputs.release-suffix }} + strip "${SOLC_BIN}" + ${SOLC_BIN} --version + mv ${SOLC_BIN} ./releases/${{ inputs.release-suffix }}/solc-${{ inputs.release-suffix }}-${{ inputs.solc-version}}-${{ inputs.zksync-version }}${WIN_SUFFIX} + + - name: Upload binary for release + if: inputs.release-suffix != '' + uses: actions/upload-artifact@v4 + with: + name: release-${{ inputs.release-suffix }} + path: releases diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml deleted file mode 100644 index 174dae8c41..0000000000 --- a/.github/workflows/benchmarks.yml +++ /dev/null @@ -1,207 +0,0 @@ -name: Benchmarking - -on: - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - benchmarks_candidate: - runs-on: [self-hosted, ci-runner-compiler] - container: - image: matterlabs/llvm_runner:latest - credentials: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - - uses: AutoModality/action-clean@492b2d2e2e77247bfd0b17eaa89a371b2f3430ee # v1 - - name: Preparing workspace. Setting environment. - run: | - echo "BENCHMARK_MODE=${{ github.event.inputs.compiler_llvm_benchmark_mode || '+M^B3' }}" >> $GITHUB_ENV - echo "BENCHMARK_PATH=${{ github.event.inputs.compiler_llvm_benchmark_path || 'tests/solidity/' }}" >> $GITHUB_ENV - echo "CANDIDATE_BRANCH_NAME=${{ github.event.inputs.compiler_tester_candidate_branch }}" >> $GITHUB_ENV - - - name: Getting the branch name (pull request) - if: github.event_name == 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV - - - name: Checking out the Solidity repository - uses: actions/checkout@v4 - with: - submodules: recursive - path: solidity - - - name: Checking out the compiler-tester candidate - uses: actions/checkout@v4 - with: - repository: matter-labs/era-compiler-tester - submodules: recursive - path: compiler-tester - - - name: Building the Solidity compiler - working-directory: solidity - run: | - mkdir -p ./build - cd ./build - cmake .. -DCMAKE_BUILD_TYPE='Release' -DSOLC_VERSION_ZKEVM='1.0.0-lts' -DPEDANTIC=OFF -DCMAKE_CXX_FLAGS='-w' -DUSE_Z3=OFF -DUSE_CVC4=OFF - make -j$(nproc) - - - name: Benchmarking the Solidity compiler candidate - id: compiler_tester_run - working-directory: compiler-tester - run: | - mkdir -p './solc-bin/' - cp '../solidity/build/solc/solc' "./solc-bin/solc-${BRANCH_NAME}" - chmod +x "./solc-bin/solc-${BRANCH_NAME}" - - cargo install compiler-llvm-builder - /usr/local/cargo/bin/zkevm-llvm clone && /usr/local/cargo/bin/zkevm-llvm build - - export RUST_BACKTRACE='full' - export LLVM_SYS_150_PREFIX="$(pwd)/target-llvm/target-final/" - cargo build --verbose --release --bin 'compiler-tester' - cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-solidity-*/*/Cargo.toml --target-dir './target-zksolc/' - cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-vyper-*/*/Cargo.toml --target-dir './target-zkvyper/' - - ./target/release/compiler-tester \ - --zksolc './target-zksolc/release/zksolc' \ - --zkvyper './target-zkvyper/release/zkvyper' \ - --path="${{ env.BENCHMARK_PATH || '' }}" \ - --mode="${{ env.BENCHMARK_MODE || '' }}" \ - --benchmark='candidate.json' \ - --solc-bin-config-path="configs/solc-bin-zkevm-candidate-${BRANCH_NAME}.json" - - - uses: actions/upload-artifact@v4 - with: - name: candidate-benchmark - path: compiler-tester/candidate.json - - benchmarks_reference: - runs-on: [self-hosted, ci-runner-compiler] - container: - image: matterlabs/llvm_runner:latest - credentials: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - - uses: AutoModality/action-clean@492b2d2e2e77247bfd0b17eaa89a371b2f3430ee # v1 - - name: Preparing workspace. Setting environment. - run: | - echo "BENCHMARK_MODE=${{ github.event.inputs.compiler_llvm_benchmark_mode || '+M^B3' }}" >> $GITHUB_ENV - echo "BENCHMARK_PATH=${{ github.event.inputs.compiler_llvm_benchmark_path || 'tests/solidity/' }}" >> $GITHUB_ENV - echo "REFERENCE_BRANCH_NAME=${{ github.event.inputs.compiler_tester_reference_branch }}" >> $GITHUB_ENV - - - name: Getting the branch name (pull request) - if: github.event_name == 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV - - - name: Checking out the Solidity repository - uses: actions/checkout@v4 - with: - submodules: recursive - path: solidity - - - name: Checking out the compiler-tester reference - uses: actions/checkout@v4 - with: - repository: matter-labs/era-compiler-tester - ref: main - submodules: recursive - path: compiler-tester - - - name: Benchmarking the Solidity compiler reference - working-directory: compiler-tester - id: compiler_tester_run - run: | - cargo install compiler-llvm-builder - /usr/local/cargo/bin/zkevm-llvm clone && /usr/local/cargo/bin/zkevm-llvm build - - export RUST_BACKTRACE='full' - export LLVM_SYS_150_PREFIX="$(pwd)/target-llvm/target-final/" - cargo build --verbose --release --bin 'compiler-tester' - cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-solidity-*/*/Cargo.toml --target-dir './target-zksolc/' - cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-vyper-*/*/Cargo.toml --target-dir './target-zkvyper/' - - ./target/release/compiler-tester \ - --zksolc './target-zksolc/release/zksolc' \ - --zkvyper './target-zkvyper/release/zkvyper' \ - --path="${{ env.BENCHMARK_PATH || '' }}" \ - --mode="${{ env.BENCHMARK_MODE || '' }}" \ - --benchmark='reference.json' \ - --solc-bin-config-path="configs/solc-bin-zkevm-reference-${BRANCH_NAME}.json" - - - uses: actions/upload-artifact@v4 - with: - name: reference-benchmark - path: compiler-tester/reference.json - - benchmarks_analysis: - runs-on: [matterlabs-ci-runner] - needs: [benchmarks_candidate, benchmarks_reference] - container: - image: matterlabs/llvm_runner:latest - credentials: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - - uses: AutoModality/action-clean@492b2d2e2e77247bfd0b17eaa89a371b2f3430ee # v1 - - name: Getting the branch name (pull request) - if: github.event_name == 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV - - - name: Checking out the compiler-tester repository - uses: actions/checkout@v4 - with: - repository: matter-labs/era-compiler-tester - submodules: recursive - path: compiler-tester - - - uses: actions/download-artifact@v4 - with: - name: candidate-benchmark - path: compiler-tester - - - uses: actions/download-artifact@v4 - with: - name: reference-benchmark - path: compiler-tester - - - name: Comparing the benchmark results - id: compiler_tester_run - run: | - cd compiler-tester && \ - export RUST_BACKTRACE=full && \ - cargo run --release --bin benchmark-analyzer -- \ - --reference 'reference.json' \ - --candidate 'candidate.json' \ - --output-file 'result.txt' && \ - chown 1000:1000 result.txt - - - name: Posting the benchmark results to the step summary - run: | - printf "Benchmark results:\n" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - cat ./compiler-tester/result.txt >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - cat $GITHUB_STEP_SUMMARY > ./compiler-tester/result.txt - - - name: Posting the benchmark results to a PR comment - if: github.event_name == 'pull_request' - uses: mshick/add-pr-comment@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - message-path: ./compiler-tester/result.txt - - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.COMPILER_CI_MATTERMOST_WEBHOOK }} # required - if: ${{ failure() || success() }} # Skip canceled jobs diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml new file mode 100644 index 0000000000..baecacba06 --- /dev/null +++ b/.github/workflows/build-release.yaml @@ -0,0 +1,199 @@ +name: Build and release + +on: + workflow_dispatch: + pull_request: + push: + tags: + - "**" + +concurrency: + group: ${{ github.repository_id }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + + setup: + runs-on: ubuntu-latest + outputs: + solc-version: ${{ steps.set.outputs.solc-version }} + zksync-version: ${{ steps.set.outputs.zksync-version }} + skip-windows: ${{ steps.check-version.outputs.result }} + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Define release version + shell: bash + id: set + run: | + if [[ ${{ github.event_name }} != 'pull_request' ]]; then + echo "zksync-version=$(cut -d "-" -f2 <<< ${GITHUB_REF#refs/*/})" | tee -a "${GITHUB_OUTPUT}" + else + echo "zksync-version=1.0.${{ github.run_id }}" | tee -a "${GITHUB_OUTPUT}" + fi + SOLC_VERSION=$(grep 'PROJECT_VERSION' CMakeLists.txt | grep -oP '(\d+\.\d+\.\d+)') + echo "solc-version=${SOLC_VERSION}" | tee -a "${GITHUB_OUTPUT}" + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install semver + run: npm install semver + + - name: Check that version is >= 0.6.0 + id: check-version + uses: actions/github-script@v7 + with: + script: | + const semver = require('semver'); + const currentVersion = '${{ steps.set.outputs.solc-version }}'; + const result = semver.lt(currentVersion, '0.6.0'); + console.log(`Is the version < 0.6.0? ${result}`); + return result; + result-encoding: string + + build: + needs: setup + strategy: + fail-fast: false + matrix: + include: + - name: "MacOS x86" + runner: macos-12-large + release-suffix: macosx-amd64 + - name: "MacOS arm64" + runner: [self-hosted, macOS, ARM64] + release-suffix: macosx-arm64 + - name: "Linux x86" + runner: matterlabs-ci-runner + image: matterlabs/llvm_runner:ubuntu20-llvm17-latest + release-suffix: linux-amd64 + - name: "Linux ARM64" + runner: matterlabs-ci-runner-arm + image: matterlabs/llvm_runner:ubuntu20-llvm17-latest + release-suffix: linux-arm64 + runs-on: ${{ matrix.runner }} + container: + image: ${{ matrix.image || '' }} + name: ${{ matrix.name }} + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Building the Solidity compiler + uses: ./.github/actions/solc-build + with: + release-suffix: ${{ matrix.release-suffix }} + zksync-version: ${{ needs.setup.outputs.zksync-version }} + solc-version: ${{ needs.setup.outputs.solc-version }} + + build-windows: + name: Windows + needs: setup + if: needs.setup.outputs.skip-windows == 'false' + runs-on: windows-2019-github-hosted-16core + steps: + + - name: Checkout source + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "15.0.7" + + - name: Prepare environment + run: | + git config --global user.email "runner@github.com" + git fetch --all + # try to apply win patch + git cherry-pick 860226e25dca397b5afd70680530963712aff050 || git cherry-pick --abort + # latest llvm for MSVC + git clone -q --depth=1 --branch=main https://github.com/zufuliu/llvm-utils.git c:\projects\llvm-utils + Invoke-Item "c:\projects\llvm-utils\VS2017\install.bat" + clang --version + + + - name: Install windows Deps + run: | + if ( -not (Test-Path "deps\boost") ) { + New-Item -ItemType Directory -Force -Path "deps" + + Invoke-WebRequest -URI "https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-x86_64.zip" -OutFile cmake.zip + + tar -xf cmake.zip + mv cmake-3.27.1-windows-x86_64 "deps\cmake" + + # and serving it a page that requires JavaScript. + Invoke-WebRequest -URI "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.zip" -OutFile boost.zip + + tar -xf boost.zip + cd boost_1_77_0 + .\bootstrap.bat --with-toolset=clang + .\b2 -j4 -d0 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" link=static runtime-link=static variant=release threading=multi address-model=64 --prefix="..\deps\boost" --with-filesystem --with-system --with-program_options --with-test --with-regex --with-thread install + if ( -not $? ) { throw "Error building boost." } + cd .. + } + + - name: Building the Solidity compiler + run: | + $env:path += ";deps\cmake\bin\" + $env:CXXFLAGS="-Wno-narrowing -Qunused-arguments -Wno-everything -DBOOST_REGEX_NO_LIB -D_REGEX_MAX_STACK_COUNT=200000L -DJSON_USE_INT64_DOUBLE_CONVERSION -std=c++17 -stdlib=libc++" + mkdir build + cd build + $boost_dir=(Resolve-Path ..\deps\boost\lib\cmake\Boost-*) + cmake .. -D SOL_VERSION_ZKSYNC="${{ needs.setup.outputs.zksync-version }}" -D USE_Z3="OFF" -DBoost_DIR="$boost_dir\" -DBoost_USE_STATIC_RUNTIME=1 -DBoost_USE_STATIC_LIBS=1 -DBoost_COMPILER=clang15 -T LLVM_v142 -DPEDANTIC=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded + cmake --build . -j 16 --target install --config Release + + - name: Prepare binary file name + run: | + mkdir -p releases\windows-amd64 + ls .\build\solc\Release\ + .\build\solc\Release\solc.exe --version + mv .\build\solc\Release\solc.exe releases\windows-amd64\solc-windows-amd64-${{ needs.setup.outputs.solc-version }}-${{ needs.setup.outputs.zksync-version }}.exe + + - uses: actions/upload-artifact@v4 + with: + name: release-windows-amd64 + path: releases + + release: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: build + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: release* + path: releases + + - name: Generate changelog + shell: bash + run: awk '/###/ {flag=!flag; if (seen++) exit; next} flag' ./Changelog.md > release-changelog.txt + + - name: Prepare release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: false + name: ZKsync solc ${{ github.ref_name }} + body_path: release-changelog.txt + tag_name: ${{ github.ref_name }} + files: releases/**/** diff --git a/.github/workflows/build_and_release_binary.yaml b/.github/workflows/build_and_release_binary.yaml deleted file mode 100644 index 7b8cac2cb3..0000000000 --- a/.github/workflows/build_and_release_binary.yaml +++ /dev/null @@ -1,368 +0,0 @@ -name: Build and release binaries - -on: - workflow_dispatch: - pull_request: - push: - tags: - - "**" -jobs: - setup: - name: Setup - runs-on: [ubuntu-latest] - outputs: - release_version: ${{ steps.set.outputs.release_version }} - git_tag: ${{ steps.set.outputs.git_tag }} - steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - - - name: Generate output with git tag - id: set - run: | - if [[ ${{ github.event_name }} != 'pull_request' ]]; then - version=$(cut -d "-" -f1 <<< ${GITHUB_REF#refs/*/}) - echo "release_version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - echo "git_tag=${version}" >> $GITHUB_OUTPUT - else - echo "release_version=${{ github.base_ref }}" >> $GITHUB_OUTPUT - echo "git_tag=${{ github.base_ref }}" >> $GITHUB_OUTPUT - fi - - - build_linux_amd64: - runs-on: [matterlabs-ci-runner] - needs: [setup] - container: - image: matterlabs/llvm_runner:latest - credentials: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - - name: Checkout source - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - submodules: recursive - ref: ${{ steps.set.outputs.release_version }} - - - name: Building the Solidity compiler - run: | - mkdir -p ./build - cd ./build - cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF - make -j$(nproc) - pwd - ls -la ./solc/ - ls -la ./solc/solc - - - name: Prepare binary file name - run: | - mkdir -p releases/linux-amd64 - ./build/solc/solc --version - mv ./build/solc/solc releases/linux-amd64/solc-linux-amd64-${{ needs.setup.outputs.release_version }} - - - uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 - with: - name: release_linux_amd64 - path: releases - - build_linux_arm64: - runs-on: [matterlabs-ci-runner-arm] - needs: [setup] - container: - image: matterlabs/llvm_runner:latest - credentials: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - - name: Checkout source - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - submodules: recursive - ref: ${{ steps.set.outputs.release_version }} - - - name: Building the Solidity compiler - run: | - mkdir -p ./build - cd ./build - cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF -DUSE_CVC4=OFF - make -j$(nproc) - pwd - ls -la ./solc/ - ls -la ./solc/solc - - - name: Prepare binary file name - run: | - mkdir -p releases/linux-arm64 - ./build/solc/solc --version - mv ./build/solc/solc releases/linux-arm64/solc-linux-arm64-${{ needs.setup.outputs.release_version }} - - - uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 - with: - name: release_linux_arm64 - path: releases - - build_macos_amd64: - runs-on: macos-12-xl - needs: [setup] - steps: - - name: Checkout source - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - submodules: recursive - ref: ${{ steps.set.outputs.release_version }} - - # It is needed as we use some commands which a deprecated in newer versions of boost - - name: Install BOOST - shell: zsh {0} - run: | - curl -L -o boost_1_71_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.gz - tar xzf ./boost_1_71_0.tar.gz - cd ./boost_1_71_0 - ./bootstrap.sh --prefix=/usr/local --with-python-version=2.7 - ./b2 -j$(sysctl -n hw.ncpu) - ./b2 install -j$(sysctl -n hw.ncpu) - - - name: Cmake gen - shell: zsh {0} - env: - CXXFLAGS: "-Wno-narrowing" - run: | - mkdir -p ./build - cd ./build - cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF - - - name: Building the Solidity compiler - run: | - cd ./build - make -j12 - ./solc/solc --version - - - name: Prepare binary file name - shell: zsh {0} - run: | - mkdir -p ./releases/macosx-amd64 - ./build/solc/solc --version - mv ./build/solc/solc ./releases/macosx-amd64/solc-macosx-amd64-${{ needs.setup.outputs.release_version }} - - - uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 - with: - name: release_macos_amd64 - path: releases - - build_macos_arm64: - runs-on: [self-hosted, macOS, ARM64] - needs: [setup] - steps: - - name: Clear repository - run: rm -rf ~/.gitconfig; rm -rf {*,.*} || true - - - name: Checkout source - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - submodules: recursive - ref: ${{ steps.set.outputs.release_version }} - - # It is needed as we use some commands which a deprecated in newer versions of boost - - name: Install BOOST - shell: zsh {0} - run: | - curl -L -o boost_1_71_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.gz - tar xzf ./boost_1_71_0.tar.gz - cd ./boost_1_71_0 - export BOOST_DIR=$(pwd)/boost - mkdir $BOOST_DIR - ./bootstrap.sh --prefix=$BOOST_DIR - ./b2 -j12 - ./b2 install -j12 - - - name: Cmake gen - shell: zsh {0} - env: - CXXFLAGS: "-Wno-narrowing" - run: | - mkdir -p ./build - cd ./build - cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF - - - name: Building the Solidity compiler - shell: zsh {0} - run: | - cd ./build - make -j12 - ./solc/solc --version - - - name: Prepare binary file name - shell: zsh {0} - run: | - mkdir -p ./releases/macosx-arm64 - ./build/solc/solc --version - mv ./build/solc/solc ./releases/macosx-arm64/solc-macosx-arm64-${{ needs.setup.outputs.release_version }} - - - uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 - with: - name: release_macos_arm64 - path: releases - - build_windows_amd64: - runs-on: windows-2019-github-hosted-16core - needs: [setup] - outputs: - version_to_skip: ${{ steps.compare_version.outputs.result }} - steps: - - # Had to install node to determine release version. - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' - - - name: Install semver - run: npm install semver - - - name: Check that version is >= 0.6.0 - id: compare_version - uses: actions/github-script@v5 - with: - script: | - const semver = require('semver'); - const currentVersion = '${{ needs.setup.outputs.git_tag }}'; - const result = semver.lt(currentVersion, '0.6.0'); - console.log(`Is the version < 0.6.0? ${result}`); - return result; - result-encoding: string - - - name: Checkout source - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - if: steps.compare_version.outputs.result != 'true' - with: - submodules: recursive - ref: ${{ steps.set.outputs.release_version }} - - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - if: steps.compare_version.outputs.result != 'true' - with: - version: "15.0.7" - - - name: Prepare environment - if: steps.compare_version.outputs.result != 'true' - run: | - git config --global user.email "runner@github.com" - git fetch --all - # try to apply win patch - git cherry-pick 860226e25dca397b5afd70680530963712aff050 || git cherry-pick --abort - # latest llvm for MSVC - git clone -q --depth=1 --branch=main https://github.com/zufuliu/llvm-utils.git c:\projects\llvm-utils - Invoke-Item "c:\projects\llvm-utils\VS2017\install.bat" - clang --version - - - - name: Install windows Deps - if: steps.compare_version.outputs.result != 'true' - run: | - if ( -not (Test-Path "deps\boost") ) { - New-Item -ItemType Directory -Force -Path "deps" - - Invoke-WebRequest -URI "https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-x86_64.zip" -OutFile cmake.zip - - tar -xf cmake.zip - mv cmake-3.27.1-windows-x86_64 "deps\cmake" - - # and serving it a page that requires JavaScript. - Invoke-WebRequest -URI "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.zip" -OutFile boost.zip - - tar -xf boost.zip - cd boost_1_77_0 - .\bootstrap.bat --with-toolset=clang - .\b2 -j4 -d0 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" link=static runtime-link=static variant=release threading=multi address-model=64 --prefix="..\deps\boost" --with-filesystem --with-system --with-program_options --with-test --with-regex --with-thread install - if ( -not $? ) { throw "Error building boost." } - cd .. - } - - - name: Building the Solidity compiler - if: steps.compare_version.outputs.result != 'true' - run: | - $env:path += ";deps\cmake\bin\" - $env:CXXFLAGS="-Wno-narrowing -Qunused-arguments -Wno-everything -DBOOST_REGEX_NO_LIB -D_REGEX_MAX_STACK_COUNT=200000L -DJSON_USE_INT64_DOUBLE_CONVERSION -std=c++17 -stdlib=libc++" - mkdir build - cd build - $boost_dir=(Resolve-Path ..\deps\boost\lib\cmake\Boost-*) - cmake .. -D SOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -D USE_Z3="OFF" -DBoost_DIR="$boost_dir\" -DBoost_USE_STATIC_RUNTIME=1 -DBoost_USE_STATIC_LIBS=1 -DBoost_COMPILER=clang15 -T LLVM_v142 -DPEDANTIC=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded - cmake --build . -j 10 --target install --config Release - - - name: Prepare binary file name - if: steps.compare_version.outputs.result != 'true' - run: | - mkdir -p releases\windows-amd64 - ls .\build\solc\Release\ - .\build\solc\Release\solc.exe --version - mv .\build\solc\Release\solc.exe releases\windows-amd64\solc-windows-amd64-${{ needs.setup.outputs.release_version }}.exe - - - uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 - if: steps.compare_version.outputs.result != 'true' - with: - name: release_windows_amd64 - path: releases - - prepare-release: - runs-on: [ matterlabs-default-infra-runners ] - if: startsWith(github.ref, 'refs/tags/') - needs: - - setup - - build_macos_arm64 - - build_macos_amd64 - - build_linux_arm64 - - build_linux_amd64 - - build_windows_amd64 - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ steps.set.outputs.release_version }} - - - name: Download artifact macos_arm64 - uses: actions/download-artifact@v3 - with: - name: release_macos_arm64 - path: releases - - - name: Download artifact macosx_amd64 - uses: actions/download-artifact@v3 - with: - name: release_macos_amd64 - path: releases - - - name: Download artifact linux_amd64 - uses: actions/download-artifact@v3 - with: - name: release_linux_amd64 - path: releases - - - name: Download artifact linux_arm64 - uses: actions/download-artifact@v3 - with: - name: release_linux_arm64 - path: releases - - - name: Download artifact release_windows_amd64 - if: needs.build_windows_amd64.outputs.version_to_skip != 'true' - uses: actions/download-artifact@v3 - with: - name: release_windows_amd64 - path: releases - - - name: Generate changelog - id: changelog - shell: bash - run: | - awk '/###/ {flag=!flag; if (seen++) exit; next} flag' ./Changelog.md > tmp_changelog.txt - - - name: Prepare release - uses: softprops/action-gh-release@v1 - with: - generate_release_notes: false - name: zkVM solc ${{ needs.setup.outputs.release_version }} - body_path: ./tmp_changelog.txt - tag_name: ${{ needs.setup.outputs.release_version }} - files: | - releases/**/** diff --git a/.github/workflows/secrets_scanner.yaml b/.github/workflows/secrets_scanner.yaml deleted file mode 100644 index d0fea22668..0000000000 --- a/.github/workflows/secrets_scanner.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Leaked Secrets Scan -on: [pull_request] -jobs: - TruffleHog: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - fetch-depth: 0 - - name: TruffleHog OSS - uses: trufflesecurity/trufflehog@11394ea318a12a5bf99c1b0cb7ba5e44b3c7a79c # v3.63.2 - with: - path: ./ - base: ${{ github.event.repository.default_branch }} - head: HEAD - extra_args: --debug --only-verified --exclude-paths=.truffleignore diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000000..bb008ee8ed --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,131 @@ +name: Tests and benchmarks + +on: + pull_request: + workflow_dispatch: + inputs: + compiler_tester_reference_branch: + description: "compiler-tester branch to use as a benchmark reference" + required: false + default: "main" + compiler_tester_candidate_branch: + description: "compiler-tester branch to use as a benchmark candidate" + required: false + default: "era-solidity-test" + +concurrency: + group: ${{ github.repository_id }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + + compiler-tester-ref: + runs-on: ubuntu-latest + name: Compiler tester ref + outputs: + reference-ref: ${{ steps.compiler_tester_ref.outputs.reference-ref }} + candidate-ref: ${{ steps.compiler_tester_ref.outputs.candidate-ref }} + env: + ERA_SOLIDITY_TEST_TAG: era-solidity-test + ERA_SOLIDITY_REF_DEFAULT: main + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + repository: matter-labs/era-compiler-tester + + - name: Define compiler tester ref + id: compiler_tester_ref + shell: bash + run: | + REFERENCE_REF=${{ inputs.compiler_tester_reference_branch || env.ERA_SOLIDITY_REF_DEFAULT }} + if [ -n "$(git ls-remote --tags --heads --refs origin ${REFERENCE_REF})" ]; then + echo "reference-ref=${REFERENCE_REF}" | tee -a "${GITHUB_OUTPUT}" + else + echo "reference-ref=${{ env.ERA_SOLIDITY_REF_DEFAULT }}" | tee -a "${GITHUB_OUTPUT}" + fi + CANDIDATE_REF=${{ inputs.compiler_tester_candidate_branch || env.ERA_SOLIDITY_TEST_TAG }} + if [ -n "$(git ls-remote --tags --heads --refs origin ${CANDIDATE_REF})" ]; then + echo "candidate-ref=${CANDIDATE_REF}" | tee -a "${GITHUB_OUTPUT}" + else + echo "candidate-ref=${{ env.ERA_SOLIDITY_REF_DEFAULT }}" | tee -a "${GITHUB_OUTPUT}" + fi + + build: + strategy: + fail-fast: false + matrix: + include: + - type: "reference" + ref: ${{ github.base_ref }} + - type: "candidate" + ref: '' + runs-on: ci-runner-compiler + name: build-${{ matrix.type }} + container: + image: matterlabs/llvm_runner:ubuntu20-llvm17-latest + outputs: + solc-version: ${{ steps.project_version.outputs.solc-version }} + steps: + + - name: Checking out the Solidity repository + uses: actions/checkout@v4 + with: + ref: ${{ matrix.ref }} + submodules: recursive + + - name: Define project version + id: project_version + shell: bash + run: | + SOLC_VERSION=$(grep 'PROJECT_VERSION' CMakeLists.txt | grep -oP '(\d+\.\d+\.\d+)') + echo "solc-version=${SOLC_VERSION}" | tee -a "${GITHUB_OUTPUT}" + + - name: Building the Solidity compiler + if: matrix.type == 'candidate' + uses: ./.github/actions/solc-build + with: + solc-version: ${{ steps.project_version.outputs.solc-version }} + zksync-version: 1.0.${{ github.run_id }} + build-type: ${{ matrix.type }} + + - name: Building the Solidity compiler + if: matrix.type == 'reference' + uses: matter-labs/era-solidity/.github/actions/solc-build@latest-ci + with: + solc-version: ${{ steps.project_version.outputs.solc-version }} + zksync-version: 1.0.${{ github.run_id }} + build-type: ${{ matrix.type }} + + # Integration tests workflow call from the era-compiler-ci repository + # This is a common part of the integration tests workflow for all repositories + # If you would like to make a change to the integration tests workflow, please do it in the era-compiler-ci repository + integration-tests: + needs: [ compiler-tester-ref, build ] + uses: matter-labs/era-compiler-ci/.github/workflows/integration-tests.yaml@main + secrets: inherit + with: + compiler-tester-ref: ${{ needs.compiler-tester-ref.outputs.candidate-ref }} + path: 'tests/solidity/' + custom-solc-run-id: ${{ github.run_id }} + custom-solc-version: ${{ needs.build.outputs.solc-version }} + extra-args: --mode "${{ github.base_ref }}" + save-ccache: 'true' + ccache-key-type: 'static' + + + # Benchmarks workflow call from the era-compiler-ci repository + # This is a common part of the benchmarks workflow for all repositories + # If you would like to make a change to the benchmarks workflow, please do it in the era-compiler-ci repository + benchmarks: + needs: [ compiler-tester-ref, build ] + uses: matter-labs/era-compiler-ci/.github/workflows/benchmarks.yml@main + secrets: inherit + with: + compiler_tester_reference_branch: ${{ needs.compiler-tester-ref.outputs.reference-ref }} + compiler_tester_candidate_branch: ${{ needs.compiler-tester-ref.outputs.candidate-ref }} + compiler_llvm_benchmark_mode: '+M^B3 ${{ needs.build.outputs.solc-version }}' + compiler_llvm_benchmark_path: 'tests/solidity/' + custom-solc-run-id: ${{ github.run_id }} + custom-solc-version: ${{ needs.build.outputs.solc-version }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index 62bdb48cd9..0000000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,74 +0,0 @@ -name: Integration testing - -on: - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - testing: - runs-on: [self-hosted, ci-runner-compiler] - container: - image: matterlabs/llvm_runner:latest - credentials: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - - name: Getting the branch name (pull request) - if: github.event_name == 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV - - - name: Checking out the Solidity repository - uses: actions/checkout@v4 - with: - submodules: recursive - path: solidity - - - name: Checking out the compiler-tester repository - uses: actions/checkout@v4 - with: - repository: matter-labs/era-compiler-tester - path: compiler-tester - submodules: recursive - - - name: Building the Solidity compiler - working-directory: solidity - run: | - mkdir -p ./build - cd ./build - cmake .. -DCMAKE_BUILD_TYPE='Release' -DSOLC_VERSION_ZKEVM='1.0.0-lts' -DPEDANTIC=OFF -DCMAKE_CXX_FLAGS='-w' -DUSE_Z3=OFF -DUSE_CVC4=OFF - make -j$(nproc) - - - name: Building and running the compiler tester - id: compiler_tester_run - working-directory: compiler-tester - run: | - mkdir -p './solc-bin/' - cp '../solidity/build/solc/solc' "./solc-bin/solc-${BRANCH_NAME}" - chmod +x "./solc-bin/solc-${BRANCH_NAME}" - - cargo install compiler-llvm-builder - /usr/local/cargo/bin/zkevm-llvm clone && /usr/local/cargo/bin/zkevm-llvm build - - export RUST_BACKTRACE='full' - export LLVM_SYS_150_PREFIX="$(pwd)/target-llvm/target-final/" - cargo build --verbose --release --bin 'compiler-tester' - cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-solidity-*/*/Cargo.toml --target-dir './target-zksolc/' - cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-vyper-*/*/Cargo.toml --target-dir './target-zkvyper/' - - ./target/release/compiler-tester \ - --zksolc './target-zksolc/release/zksolc' \ - --zkvyper './target-zkvyper/release/zkvyper' \ - --path='tests/solidity/' \ - --solc-bin-config-path="configs/solc-bin-zkevm-candidate-${BRANCH_NAME}.json" - - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.COMPILER_CI_MATTERMOST_WEBHOOK }} # required - if: ${{ failure() || success() }} # Skip canceled jobs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 152aec38d3..95cda68b05 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,7 @@ license. We aim to make it as easy as possible to contribute to the mission. This is still WIP, and we're happy for contributions and suggestions here too. Some resources to help: -1. [zkSync Era docs!](https://era.zksync.io/docs/) +1. [ZKsync Era docs!](https://era.zksync.io/docs/) 2. Company links can be found in the [repo's readme](README.md) ## Code of Conduct diff --git a/Changelog.md b/Changelog.md index ec9588fdca..8cea0e86fe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,12 @@ -### solc v0.4.16-legacy for zkVM - revision 1.0.0 - Legacy edition +### 1.0.1 - ZKsync Legacy Edition (2024-05-31) -This release has changes in the lowering of EVM assembly in order to get the zkSync's translator (targeting LLVM IR) to work correctly. +Bugfixes: +* Fixed nested try-catch lowering in EVM assembly codegen (^0.6.0) + + +### 1.0.0 - ZKsync Legacy Edition (2024-01-16) + +This release has changes in the lowering of EVM assembly in order to get the ZKsync's translator targeting LLVM IR to work correctly. Added: * A new metadata output field called "extraMetadata" in standard-json that stores information of recursive functions @@ -8,6 +14,7 @@ Added: Changed: * Internal function pointers are lowered to static jump tables * Disabled evmasm optimizations to avoid any potential invalidation of the new metadata for recursive functions +* Minor changes in the control-flow when lowering a try-catch block (^0.6.0) ### 0.4.16 (2017-08-24) diff --git a/README.md b/README.md index bfb637ed21..a1123f4053 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# zkSync Era: Solidity Compiler +# ZKsync Era: Solidity Compiler [![Logo](eraLogo.svg)](https://zksync.io/) -zkSync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security +ZKsync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or decentralization. As it's EVM-compatible (with Solidity/Vyper), 99% of Ethereum projects can redeploy without -needing to refactor or re-audit any code. zkSync Era also uses an LLVM-based compiler that will eventually enable +needing to refactor or re-audit any code. ZKsync Era also uses an LLVM-based compiler that will eventually enable developers to write smart contracts in popular languages such as C++ and Rust. This repository contains the Solidity compiler and language tuned for EraVM. @@ -20,12 +20,12 @@ Some third-party code has its [own licensing terms](cmake/templates/license.h.in - [Website](https://zksync.io/) - [GitHub](https://github.com/matter-labs) - [Twitter](https://twitter.com/zksync) -- [Twitter for Devs](https://twitter.com/zkSyncDevs) +- [Twitter for Devs](https://twitter.com/ZKsyncDevs) - [Discord](https://join.zksync.dev/) ## Disclaimer -zkSync Era has been through extensive testing and audits, and although it is live, it is still in alpha state and +ZKsync Era has been through extensive testing and audits, and although it is live, it is still in alpha state and will undergo further audits and bug bounty programs. We would love to hear our community's thoughts and suggestions about it! It's important to note that forking it now could potentially lead to missing important diff --git a/cmake/EthBuildInfo.cmake b/cmake/EthBuildInfo.cmake index 77fea15f0b..b1ecb5c67b 100644 --- a/cmake/EthBuildInfo.cmake +++ b/cmake/EthBuildInfo.cmake @@ -37,7 +37,7 @@ function(create_build_info NAME) -DETH_BUILD_COMPILER="${ETH_BUILD_COMPILER}" -DETH_BUILD_PLATFORM="${ETH_BUILD_PLATFORM}" -DPROJECT_VERSION="${PROJECT_VERSION}" - -DSOLC_VERSION_ZKEVM="${SOLC_VERSION_ZKEVM}" + -DSOL_VERSION_ZKSYNC="${SOL_VERSION_ZKSYNC}" -P "${ETH_SCRIPTS_DIR}/buildinfo.cmake" ) include_directories(BEFORE ${PROJECT_BINARY_DIR}) diff --git a/cmake/FindZ3.cmake b/cmake/FindZ3.cmake index 971d3b4b36..d1cf563f55 100644 --- a/cmake/FindZ3.cmake +++ b/cmake/FindZ3.cmake @@ -1,7 +1,10 @@ -find_path(Z3_INCLUDE_DIR z3++.h) -find_library(Z3_LIBRARY NAMES z3 ) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Z3 DEFAULT_MSG Z3_LIBRARY Z3_INCLUDE_DIR) +if (USE_Z3) + find_path(Z3_INCLUDE_DIR z3++.h) + find_library(Z3_LIBRARY NAMES z3 ) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Z3 DEFAULT_MSG Z3_LIBRARY Z3_INCLUDE_DIR) +else() + set(Z3_FOUND FALSE) +endif() # TODO: Create IMPORTED library for Z3. - diff --git a/cmake/scripts/buildinfo.cmake b/cmake/scripts/buildinfo.cmake index 0b33b37191..ac53f871a6 100644 --- a/cmake/scripts/buildinfo.cmake +++ b/cmake/scripts/buildinfo.cmake @@ -63,8 +63,8 @@ set(SOL_VERSION_COMMIT "commit.${SOL_COMMIT_HASH}") set(SOl_VERSION_PLATFORM ETH_BUILD_PLATFORM) set(SOL_VERSION_BUILDINFO "commit.${SOL_COMMIT_HASH}.${ETH_BUILD_PLATFORM}") -if (NOT SOLC_VERSION_ZKEVM) - set(SOLC_VERSION_ZKEVM "undefined") +if (NOT SOL_VERSION_ZKSYNC) + set(SOL_VERSION_ZKSYNC "undefined") endif() set(TMPFILE "${ETH_DST_DIR}/BuildInfo.h.tmp") diff --git a/cmake/templates/BuildInfo.h.in b/cmake/templates/BuildInfo.h.in index 6b178f39b7..59ac0a9d5e 100644 --- a/cmake/templates/BuildInfo.h.in +++ b/cmake/templates/BuildInfo.h.in @@ -10,4 +10,4 @@ #define SOL_VERSION_BUILDINFO "@SOL_VERSION_BUILDINFO@" #define SOL_VERSION_COMMIT "@SOL_VERSION_COMMIT@" #define SOL_VERSION_PLATFORM "@SOL_VERSION_PLATFORM@" -#define SOL_VERSION_ZKEVM "@SOLC_VERSION_ZKEVM@" +#define SOL_VERSION_ZKSYNC "@SOL_VERSION_ZKSYNC@" diff --git a/libevmasm/LinkerObject.cpp b/libevmasm/LinkerObject.cpp index 3fcacd0759..76e249d02f 100644 --- a/libevmasm/LinkerObject.cpp +++ b/libevmasm/LinkerObject.cpp @@ -46,7 +46,7 @@ void LinkerObject::link(map const& _libraryAddresses) string LinkerObject::toHex() const { - return "The EVM bytecode is unavailable in the zkEVM edition of solc"; + return "The EVM bytecode is unavailable in the ZKsync edition of solc"; string hex = dev::toHex(bytecode); for (auto const& ref: linkReferences) { diff --git a/libsolidity/interface/Version.cpp b/libsolidity/interface/Version.cpp index 500396b400..d04465633c 100644 --- a/libsolidity/interface/Version.cpp +++ b/libsolidity/interface/Version.cpp @@ -32,7 +32,7 @@ using namespace dev::solidity; using namespace std; char const* dev::solidity::VersionNumber = ETH_PROJECT_VERSION; -char const* dev::solidity::ZKEVMVersionString = SOL_VERSION_ZKEVM; +char const* dev::solidity::ZKsyncVersionString = SOL_VERSION_ZKSYNC; string const dev::solidity::VersionString = string(dev::solidity::VersionNumber) + diff --git a/libsolidity/interface/Version.h b/libsolidity/interface/Version.h index f4edd26558..0124ed5c5e 100644 --- a/libsolidity/interface/Version.h +++ b/libsolidity/interface/Version.h @@ -38,7 +38,7 @@ extern std::string const VersionStringStrict; /// the first byte is zero, the following three bytes encode A B and C (interpreted as decimals) /// and HASH is interpreted as 8 hex digits and encoded into the last four bytes. bytes binaryVersion(); -extern char const* ZKEVMVersionString; +extern char const* ZKsyncVersionString; } } diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index c63dbe7dba..133f3eb722 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -180,12 +180,12 @@ static set const g_machineArgs static void version() { cout << - "solc, the zkEVM Solidity compiler commandline interface" << + "solc, the ZKsync Solidity compiler commandline interface" << endl << "Version: " << dev::solidity::VersionString << endl << - "zkEVM: " << dev::solidity::ZKEVMVersionString << endl; + "ZKsync: " << dev::solidity::ZKsyncVersionString << endl; exit(0); }