diff --git a/.circleci/build_local b/.circleci/build_local index 7d488e6d66..84e7224123 100755 --- a/.circleci/build_local +++ b/.circleci/build_local @@ -14,7 +14,6 @@ PUSH_LABEL=$3 PROJECTS=( cpp:barretenberg-cpp:./dockerfiles/Dockerfile.x86_64-linux-clang:barretenberg-x86_64-linux-clang - cpp:barretenberg-cpp:./dockerfiles/Dockerfile.x86_64-linux-clang-assert:barretenberg-x86_64-linux-clang-assert cpp:barretenberg-cpp:./dockerfiles/Dockerfile.wasm-linux-clang:barretenberg-wasm-linux-clang # js:barretenberg-js ) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5f53df2aa3..c4618ddcca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -136,17 +136,6 @@ jobs: name: "Build" command: cond_spot_run_build barretenberg-x86_64-linux-clang-assert 64 - solidity-verifier-tests: - docker: - - image: aztecprotocol/alpine-build-image - resource_class: small - steps: - - *checkout - - *setup_env - - run: - name: "Build and test" - command: build sol - barretenberg-tests: docker: - image: aztecprotocol/alpine-build-image @@ -258,7 +247,6 @@ workflows: - x86_64-linux-clang - x86_64-linux-clang-assert - wasm-linux-clang - - solidity-verifier-tests: *bb_test - honk-tests: *bb_test - barretenberg-tests: *bb_test - stdlib-primitives-tests: *bb_test diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..b38d06b335 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +sol/broadcast +sol/cache +sol/out +sol/Dockerfile +sol/lib +cpp/build +cpp/srs_db/ignition +.gitmodules \ No newline at end of file diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml new file mode 100644 index 0000000000..8203b494ba --- /dev/null +++ b/.github/workflows/solidity_verifier_test.yml @@ -0,0 +1,23 @@ +name: solidity-verifier-test + +on: + - workflow_dispatch + - push + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Solidity Verifier Tests + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Build docker image + run: docker build . -f sol/Dockerfile \ No newline at end of file diff --git a/build_manifest.json b/build_manifest.json index 9d94b0fb32..a44071b71e 100644 --- a/build_manifest.json +++ b/build_manifest.json @@ -28,11 +28,5 @@ "dockerfile": "js/Dockerfile", "rebuildPatterns": ["^js/"], "dependencies": ["barretenberg-wasm-linux-clang"] - }, - "sol": { - "buildDir": "sol", - "dockerfile": "Dockerfile", - "rebuildPatterns": ["^sol/"], - "dependencies": ["barretenberg-x86_64-linux-clang-assert"] } } diff --git a/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert b/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert index 398408eb74..d03fa89cdf 100644 --- a/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert +++ b/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert @@ -20,5 +20,4 @@ RUN cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert -DCI=ON && cmake --b FROM alpine:3.17 RUN apk update && apk add curl openmp COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db -COPY --from=builder /usr/src/barretenberg/cpp/build/bin/*_tests /usr/src/barretenberg/cpp/build/bin/ -COPY --from=builder /usr/src/barretenberg/cpp/build/bin/solidity* /usr/src/barretenberg/cpp/build/bin/ \ No newline at end of file +COPY --from=builder /usr/src/barretenberg/cpp/build/bin/*_tests /usr/src/barretenberg/cpp/build/bin/ \ No newline at end of file diff --git a/sol/.dockerignore b/sol/.dockerignore deleted file mode 100644 index d5fb189d60..0000000000 --- a/sol/.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -broadcast -cache -out -Dockerfile -lib \ No newline at end of file diff --git a/sol/Dockerfile b/sol/Dockerfile index 91491ebc68..8284044d0e 100644 --- a/sol/Dockerfile +++ b/sol/Dockerfile @@ -1,4 +1,21 @@ -FROM 278380418400.dkr.ecr.us-east-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert +FROM alpine:3.17 +RUN apk update \ + && apk upgrade \ + && apk add --no-cache \ + build-base \ + clang15 \ + openmp-dev \ + cmake \ + ninja \ + git \ + curl \ + perl + +WORKDIR /usr/src/barretenberg/cpp + +COPY ./cpp . +# Build everything to ensure everything builds. All tests will be run from the result of this build. +RUN cmake --preset default && cmake --build --preset default --target solidity_key_gen solidity_proof_gen FROM docker.io/frolvlad/alpine-glibc:alpine-3.16_glibc-2.34 as builder RUN apk update && apk add git curl build-base openmp-dev bash @@ -7,7 +24,7 @@ COPY --from=0 /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/buil COPY --from=0 /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db WORKDIR /usr/src/barretenberg/sol RUN git init -COPY . . +COPY ./sol . # Copy forge binary directly from foundry COPY --from=ghcr.io/foundry-rs/foundry:latest /usr/local/bin/forge /usr/local/bin/forge diff --git a/sol/README.md b/sol/README.md index 1e94a935c6..d0ae9ffa1b 100644 --- a/sol/README.md +++ b/sol/README.md @@ -25,6 +25,8 @@ Run `bootstrap.sh` to clone git submodules, download SRS and generate verificati Test are performed with a `TestBase` harness, it provides helpers for reading files and printing proofs. The tests also require proofs and verification keys, those are build as part of the `bootstrap.sh`. +Note that foundry is set to just run 1 fuzz run, this is mainly to limit the duty for CI, and then it can be hammered more heavily when needed. + ## How To Run the Tests? To run all tests, run the following scripts at the root of the repo: @@ -68,4 +70,11 @@ mstore(0x24, val_2) // add second value after first mstore(0x44, val_3) // add third value after second revert(0x00, 0x64) // revert with a message containing 0x64 bytes defined above ``` -When running a test, you will then see the three values `val_1, val_2, val_3` in the console. \ No newline at end of file +When running a test, you will then see the three values `val_1, val_2, val_3` in the console. + +# Docker +To run the docker image, which will build keygen and proofgen and then run tests, run the following from root: +```bash +# From root +docker build . -f sol/Dockerfile +``` diff --git a/sol/bootstrap.sh b/sol/bootstrap.sh index 70c6b1d18b..fa9a85bbf0 100755 --- a/sol/bootstrap.sh +++ b/sol/bootstrap.sh @@ -17,6 +17,12 @@ cd ../cpp/srs_db cd ../../sol echo "Building c++ binaries..." +cd ../cpp +cmake --preset clang15 +cmake --build --preset clang15 --target solidity_key_gen solidity_proof_gen +cd ../sol + +echo "Generating keys..." ./scripts/init.sh echo "Formatting code..." diff --git a/sol/foundry.toml b/sol/foundry.toml index 4b00788aac..15f71ad424 100644 --- a/sol/foundry.toml +++ b/sol/foundry.toml @@ -5,7 +5,7 @@ libs = ['lib'] ffi = true [fuzz] -runs = 5 +runs = 1 solc = "0.8.18"