From 244b8a879a320eee82e049a4a7be9e876c254bc5 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 11:13:51 +0000 Subject: [PATCH 01/26] build_manifest update --- build_manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_manifest.json b/build_manifest.json index 9d94b0fb32..82e0c700b2 100644 --- a/build_manifest.json +++ b/build_manifest.json @@ -25,7 +25,7 @@ }, "barretenberg.js": { "buildDir": "js", - "dockerfile": "js/Dockerfile", + "dockerfile": "Dockerfile", "rebuildPatterns": ["^js/"], "dependencies": ["barretenberg-wasm-linux-clang"] }, From e04373f841bca89a34cce5e1310492818fd1cd45 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 14:14:31 +0000 Subject: [PATCH 02/26] fiddling --- .circleci/build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/build b/.circleci/build index 3db9f403af..7615427f4a 100755 --- a/.circleci/build +++ b/.circleci/build @@ -20,6 +20,7 @@ echo "Repository: $REPOSITORY" echo "Working directory: $PWD" echo "Dockerfile: $DOCKERFILE" +echo "$(query_manifest buildDir $REPOSITORY)" cd $(query_manifest buildDir $REPOSITORY) function fetch_image() { @@ -31,9 +32,12 @@ function fetch_image() { return 0 } +echo "Executing ensure_repo" # Ensure ECR repository exists. ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle +echo "ensure_repo complete" +echo "Executing last successful commit" LAST_SUCCESSFUL_COMMIT=$(last_successful_commit $REPOSITORY) echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" From 7f3c2b8a1142a70fb41346a39cc9190e3502ecc6 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 14:25:59 +0000 Subject: [PATCH 03/26] fiddling --- .circleci/ensure_repo | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/ensure_repo b/.circleci/ensure_repo index c1d579d1f0..2d526f738f 100755 --- a/.circleci/ensure_repo +++ b/.circleci/ensure_repo @@ -24,8 +24,10 @@ REPOSITORY=$1 REGION=$2 REFRESH_LIFECYCLE=$3 +echo "Logging in" aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT.dkr.ecr.$REGION.amazonaws.com 2> /dev/null +echo "Repository: $REPOSITORY" # Create the repository if it doesn't exist. if ! aws ecr describe-repositories --region $REGION --repository-names $REPOSITORY > /dev/null 2>&1; then echo "Creating repo: $REPOSITORY" From 11a6a60967d1554e7a703dbf81d65bfd78cc0848 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 14:55:00 +0000 Subject: [PATCH 04/26] skip ensure_repo --- .circleci/build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/build b/.circleci/build index 7615427f4a..bc2029e3b5 100755 --- a/.circleci/build +++ b/.circleci/build @@ -32,10 +32,10 @@ function fetch_image() { return 0 } -echo "Executing ensure_repo" +#echo "Executing ensure_repo" # Ensure ECR repository exists. -ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle -echo "ensure_repo complete" +#ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle +#echo "ensure_repo complete" echo "Executing last successful commit" LAST_SUCCESSFUL_COMMIT=$(last_successful_commit $REPOSITORY) From 4a3e8223f054f84f0c34df19e946d68e7a473d9e Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 14:58:24 +0000 Subject: [PATCH 05/26] skipping more stuff --- .circleci/build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/build b/.circleci/build index bc2029e3b5..af8ad27148 100755 --- a/.circleci/build +++ b/.circleci/build @@ -70,11 +70,11 @@ if [ -d $ROOT_PATH/$PROJECT_DIR/terraform ]; then fi # Pull latest parents that are not ours. -echo "$DOCKERHUB_PASSWORD" | docker login -u aztecprotocolci --password-stdin -PARENTS=$(cat $DOCKERFILE | sed -n -e 's/^FROM \([^[:space:]]\+\).*/\1/p' | grep -v $ECR_DEPLOY_URL | sort | uniq) -for PARENT in $PARENTS; do - fetch_image $PARENT -done +#echo "$DOCKERHUB_PASSWORD" | docker login -u aztecprotocolci --password-stdin +#PARENTS=$(cat $DOCKERFILE | sed -n -e 's/^FROM \([^[:space:]]\+\).*/\1/p' | grep -v $ECR_DEPLOY_URL | sort | uniq) +#for PARENT in $PARENTS; do +# fetch_image $PARENT +#done # For each parent that's ours, pull in the latest image. PARENTS=$(cat $DOCKERFILE | sed -n -e "s/^FROM $ECR_DEPLOY_URL\/\([^[:space:]]\+\).*/\1/p") From bd8ecce651367c75c647831018a73b572582ffc9 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 15:02:13 +0000 Subject: [PATCH 06/26] fiddling --- .circleci/build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/build b/.circleci/build index af8ad27148..dda025192a 100755 --- a/.circleci/build +++ b/.circleci/build @@ -127,6 +127,8 @@ if [ -n "$LAST_SUCCESSFUL_COMMIT" ]; then echo fi +docker ps + # Build the actual image and give it a commit tag. IMAGE_COMMIT_URI=$ECR_URL/$REPOSITORY:cache-$COMMIT_HASH echo "Building image: $IMAGE_COMMIT_URI" From 9f522a33cc326bd561c478cc85939eccf441fa38 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 15:07:16 +0000 Subject: [PATCH 07/26] get docker version --- .circleci/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/build b/.circleci/build index dda025192a..78bb6d6f6d 100755 --- a/.circleci/build +++ b/.circleci/build @@ -127,7 +127,7 @@ if [ -n "$LAST_SUCCESSFUL_COMMIT" ]; then echo fi -docker ps +docker --version # Build the actual image and give it a commit tag. IMAGE_COMMIT_URI=$ECR_URL/$REPOSITORY:cache-$COMMIT_HASH From 688c913f73b09bb42a13e3710cf28fb99d66bfea Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 15:14:20 +0000 Subject: [PATCH 08/26] force change in key_gen --- cpp/src/barretenberg/solidity_helpers/key_gen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/barretenberg/solidity_helpers/key_gen.cpp b/cpp/src/barretenberg/solidity_helpers/key_gen.cpp index 86913a0d92..68f2a42230 100644 --- a/cpp/src/barretenberg/solidity_helpers/key_gen.cpp +++ b/cpp/src/barretenberg/solidity_helpers/key_gen.cpp @@ -17,7 +17,7 @@ void generate_keys(std::string output_path, std::string srs_path, std::string fl uint256_t public_inputs[4] = { 0, 0, 0, 0 }; Composer composer = Circuit::generate(srs_path, public_inputs); - std::shared_ptr vkey = composer.compute_verification_key(); + std::shared_ptr verification_key = composer.compute_verification_key(); // Make verification key file upper case circuit_name.at(0) = static_cast(std::toupper(static_cast(circuit_name.at(0)))); @@ -30,7 +30,7 @@ void generate_keys(std::string output_path, std::string srs_path, std::string fl { auto vk_filename = output_path + "/keys/" + vk_class_name + ".sol"; std::ofstream os(vk_filename); - proof_system::output_vk_sol(os, vkey, vk_class_name); + proof_system::output_vk_sol(os, verification_key, vk_class_name); info("VK contract written to: ", vk_filename); } From 0b45e91cf610814432074eb2137235e915764507 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 15:19:34 +0000 Subject: [PATCH 09/26] fiddle --- .circleci/build | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.circleci/build b/.circleci/build index 78bb6d6f6d..cfc1680421 100755 --- a/.circleci/build +++ b/.circleci/build @@ -19,6 +19,7 @@ PROJECT_DIR=$(query_manifest projectDir $REPOSITORY) echo "Repository: $REPOSITORY" echo "Working directory: $PWD" echo "Dockerfile: $DOCKERFILE" +docker --version echo "$(query_manifest buildDir $REPOSITORY)" cd $(query_manifest buildDir $REPOSITORY) @@ -34,7 +35,7 @@ function fetch_image() { #echo "Executing ensure_repo" # Ensure ECR repository exists. -#ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle +ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle #echo "ensure_repo complete" echo "Executing last successful commit" @@ -70,11 +71,11 @@ if [ -d $ROOT_PATH/$PROJECT_DIR/terraform ]; then fi # Pull latest parents that are not ours. -#echo "$DOCKERHUB_PASSWORD" | docker login -u aztecprotocolci --password-stdin -#PARENTS=$(cat $DOCKERFILE | sed -n -e 's/^FROM \([^[:space:]]\+\).*/\1/p' | grep -v $ECR_DEPLOY_URL | sort | uniq) -#for PARENT in $PARENTS; do -# fetch_image $PARENT -#done +echo "$DOCKERHUB_PASSWORD" | docker login -u aztecprotocolci --password-stdin +PARENTS=$(cat $DOCKERFILE | sed -n -e 's/^FROM \([^[:space:]]\+\).*/\1/p' | grep -v $ECR_DEPLOY_URL | sort | uniq) +for PARENT in $PARENTS; do + fetch_image $PARENT +done # For each parent that's ours, pull in the latest image. PARENTS=$(cat $DOCKERFILE | sed -n -e "s/^FROM $ECR_DEPLOY_URL\/\([^[:space:]]\+\).*/\1/p") @@ -127,8 +128,6 @@ if [ -n "$LAST_SUCCESSFUL_COMMIT" ]; then echo fi -docker --version - # Build the actual image and give it a commit tag. IMAGE_COMMIT_URI=$ECR_URL/$REPOSITORY:cache-$COMMIT_HASH echo "Building image: $IMAGE_COMMIT_URI" From 8be5f53e0999bac47fdb20d7dcd30860691d67ae Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 15:28:07 +0000 Subject: [PATCH 10/26] docker version in cond_spot --- .circleci/cond_spot_run_build | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/cond_spot_run_build b/.circleci/cond_spot_run_build index d4fa4723ea..948457b9ae 100755 --- a/.circleci/cond_spot_run_build +++ b/.circleci/cond_spot_run_build @@ -6,6 +6,7 @@ shift SPEC=$1 shift DOCKERFILE=$(query_manifest dockerfile $REPOSITORY) +docker --version cd $(query_manifest buildDir $REPOSITORY) From ced23168c913db9e0771f7e3303166848da1fdfa Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 17:44:30 +0000 Subject: [PATCH 11/26] fiddle --- .github/workflows/solidity_verifier_test.yml | 55 ++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/solidity_verifier_test.yml diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml new file mode 100644 index 0000000000..7547a40924 --- /dev/null +++ b/.github/workflows/solidity_verifier_test.yml @@ -0,0 +1,55 @@ +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: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + cd sol + forge --version + forge build --sizes + id: build + + - name: Build cpp + run: | + sudo apt update + sudo apt install build-essential clang-10 lld-10 libomp-dev libboost-tools-dev libtbb-dev + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 100 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-10 100 + sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-10 100 + + - name: Cache Barretenberg + uses: actions/cache@v3 + id: cache_cpp + with: + path: cpp + key: ${{ runner.os }}-${{ hashFiles('cpp/*') }} + + - name: Build cpp + run: ./bootstrap.sh + + - name: Run Forge tests + run: | + forge test --no-match-contract TestBase -vvv + id: test \ No newline at end of file From 356f86ca0590206de0551e85c2af65f191ead941 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 17:48:44 +0000 Subject: [PATCH 12/26] update path --- .github/workflows/solidity_verifier_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 7547a40924..5694afc7a4 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -48,6 +48,8 @@ jobs: - name: Build cpp run: ./bootstrap.sh + with: + path: sol - name: Run Forge tests run: | From a778149fc4d62b3a8a980339b889502636d8a61a Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 17:49:55 +0000 Subject: [PATCH 13/26] fiddle --- .github/workflows/solidity_verifier_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 5694afc7a4..37edd1f861 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -47,10 +47,10 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('cpp/*') }} - name: Build cpp - run: ./bootstrap.sh - with: - path: sol - + run: | + cd sol + ./bootstrap.sh + - name: Run Forge tests run: | forge test --no-match-contract TestBase -vvv From aee490d3c25881cd886a898d4c17e40ff7a94211 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 18:14:18 +0000 Subject: [PATCH 14/26] build in init --- .github/workflows/solidity_verifier_test.yml | 4 ++-- sol/scripts/init.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 37edd1f861..9d7a169f6f 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -31,7 +31,7 @@ jobs: forge build --sizes id: build - - name: Build cpp + - name: Prepare for cpp run: | sudo apt update sudo apt install build-essential clang-10 lld-10 libomp-dev libboost-tools-dev libtbb-dev @@ -46,7 +46,7 @@ jobs: path: cpp key: ${{ runner.os }}-${{ hashFiles('cpp/*') }} - - name: Build cpp + - name: Bootstrap sol run: | cd sol ./bootstrap.sh diff --git a/sol/scripts/init.sh b/sol/scripts/init.sh index fa00f288bd..ccac00be24 100755 --- a/sol/scripts/init.sh +++ b/sol/scripts/init.sh @@ -1,5 +1,8 @@ #!/bin/bash +cd ../cpp +cmake --preset clang15 +cmake --build --preset clang15 --target solidity_key_gen solidity_proof_gen PLONK_FLAVOUR="ultra" SRS_PATH="../cpp/srs_db/ignition" From 35c582009d5ea70fb45cc52387b898abadcbafb7 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 18:23:54 +0000 Subject: [PATCH 15/26] fiddle --- .github/workflows/solidity_verifier_test.yml | 8 +++----- sol/scripts/init.sh | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 9d7a169f6f..b79302bbea 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -33,11 +33,9 @@ jobs: - name: Prepare for cpp run: | - sudo apt update - sudo apt install build-essential clang-10 lld-10 libomp-dev libboost-tools-dev libtbb-dev - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 100 - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-10 100 - sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-10 100 + sudo apt update + sudo apk upgrade + sudo apk add --no-cache build-base clang15 openmp-dev cmake ninja git curl perl - name: Cache Barretenberg uses: actions/cache@v3 diff --git a/sol/scripts/init.sh b/sol/scripts/init.sh index ccac00be24..cfeebd5142 100755 --- a/sol/scripts/init.sh +++ b/sol/scripts/init.sh @@ -4,6 +4,8 @@ cd ../cpp cmake --preset clang15 cmake --build --preset clang15 --target solidity_key_gen solidity_proof_gen +cd ../sol + PLONK_FLAVOUR="ultra" SRS_PATH="../cpp/srs_db/ignition" OUTPUT_PATH="./src/ultra" From da9f50de9275d0c6fc7e250bc0d1eb01e445dc59 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 18:25:55 +0000 Subject: [PATCH 16/26] fiddle --- .github/workflows/solidity_verifier_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index b79302bbea..a5cb3d2d3c 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -34,8 +34,8 @@ jobs: - name: Prepare for cpp run: | sudo apt update - sudo apk upgrade - sudo apk add --no-cache build-base clang15 openmp-dev cmake ninja git curl perl + sudo apt upgrade + sudo apt add --no-cache build-base clang15 openmp-dev cmake ninja git curl perl - name: Cache Barretenberg uses: actions/cache@v3 From 0a5712161c30c9ba39af6114287fbda88524dd28 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 18:30:26 +0000 Subject: [PATCH 17/26] fiddle --- .github/workflows/solidity_verifier_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index a5cb3d2d3c..132482d00c 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -33,9 +33,9 @@ jobs: - name: Prepare for cpp run: | - sudo apt update - sudo apt upgrade - sudo apt add --no-cache build-base clang15 openmp-dev cmake ninja git curl perl + sudo apt-get update + sudo apt-get upgrade -y + sudo apt-get install -y build-base clang15 openmp-dev cmake ninja git curl perl - name: Cache Barretenberg uses: actions/cache@v3 From 77da9f6dad154046a2014713a1bc43e21acdb04d Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 18:34:24 +0000 Subject: [PATCH 18/26] fiddle --- .github/workflows/solidity_verifier_test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 132482d00c..0c3e19250c 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -34,8 +34,7 @@ jobs: - name: Prepare for cpp run: | sudo apt-get update - sudo apt-get upgrade -y - sudo apt-get install -y build-base clang15 openmp-dev cmake ninja git curl perl + sudo apt-get install -y build-essential clang-15 openmp-dev cmake ninja git curl perl - name: Cache Barretenberg uses: actions/cache@v3 From b671e07e4708f123e92ace739630f85e71e81e8a Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 18:46:30 +0000 Subject: [PATCH 19/26] alpine --- .github/workflows/solidity_verifier_test.yml | 7 ++++--- cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 0c3e19250c..c8d73ec533 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true name: Solidity Verifier Tests - runs-on: ubuntu-20.04 + runs-on: alpine:3.17 steps: - uses: actions/checkout@v3 with: @@ -33,8 +33,9 @@ jobs: - name: Prepare for cpp run: | - sudo apt-get update - sudo apt-get install -y build-essential clang-15 openmp-dev cmake ninja git curl perl + sudo apk update + sudo apk upgrade + sudo apk add --no-cache build-base clang15 openmp-dev cmake ninja git curl perl - name: Cache Barretenberg uses: actions/cache@v3 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 From 1bfc1686f8aaddec66876e2661aa91d3742ebf3a Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 18:57:54 +0000 Subject: [PATCH 20/26] package naming --- .github/workflows/solidity_verifier_test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index c8d73ec533..12777b9818 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true name: Solidity Verifier Tests - runs-on: alpine:3.17 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 with: @@ -33,9 +33,8 @@ jobs: - name: Prepare for cpp run: | - sudo apk update - sudo apk upgrade - sudo apk add --no-cache build-base clang15 openmp-dev cmake ninja git curl perl + sudo apt-get update + sudo apt-get install -y build-essential clang-15 libomp-dev cmake ninja-build git curl perl - name: Cache Barretenberg uses: actions/cache@v3 From fa29dbdbf223659207db68b0472dd98173b3c26f Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 19:00:59 +0000 Subject: [PATCH 21/26] add apt-repository --- .github/workflows/solidity_verifier_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 12777b9818..fd5fa9c0a8 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -33,6 +33,7 @@ jobs: - name: Prepare for cpp run: | + sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" sudo apt-get update sudo apt-get install -y build-essential clang-15 libomp-dev cmake ninja-build git curl perl From 719916fb3d0e0914dc301993779e8b94b6edcc5a Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 19:03:21 +0000 Subject: [PATCH 22/26] add apt rep key --- .github/workflows/solidity_verifier_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index fd5fa9c0a8..49ed38e637 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -33,6 +33,7 @@ jobs: - name: Prepare for cpp run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" sudo apt-get update sudo apt-get install -y build-essential clang-15 libomp-dev cmake ninja-build git curl perl From f1c84eb4b2eadf30c89a3b9eb618baf61b800b5a Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 19:07:32 +0000 Subject: [PATCH 23/26] lld-15 --- .github/workflows/solidity_verifier_test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/solidity_verifier_test.yml b/.github/workflows/solidity_verifier_test.yml index 49ed38e637..94eb831c09 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -36,7 +36,10 @@ jobs: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" sudo apt-get update - sudo apt-get install -y build-essential clang-15 libomp-dev cmake ninja-build git curl perl + sudo apt-get install -y build-essential clang-15 lld-15 libomp-dev libboost-tools-dev libtbb-dev cmake ninja-build git curl perl + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100 + sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-15 100 - name: Cache Barretenberg uses: actions/cache@v3 From c042664154aac260cb4c71e9c8f354be02c86e6c Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 19:49:17 +0000 Subject: [PATCH 24/26] fiddle with docker --- .dockerignore | 8 ++++ .github/workflows/solidity_verifier_test.yml | 40 +------------------- sol/.dockerignore | 3 +- sol/Dockerfile | 21 +++++++++- sol/README.md | 9 ++++- sol/bootstrap.sh | 6 +++ sol/scripts/init.sh | 6 --- 7 files changed, 45 insertions(+), 48 deletions(-) create mode 100644 .dockerignore 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 index 94eb831c09..8203b494ba 100644 --- a/.github/workflows/solidity_verifier_test.yml +++ b/.github/workflows/solidity_verifier_test.yml @@ -19,41 +19,5 @@ jobs: with: submodules: recursive - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Run Forge build - run: | - cd sol - forge --version - forge build --sizes - id: build - - - name: Prepare for cpp - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" - sudo apt-get update - sudo apt-get install -y build-essential clang-15 lld-15 libomp-dev libboost-tools-dev libtbb-dev cmake ninja-build git curl perl - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100 - sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-15 100 - - - name: Cache Barretenberg - uses: actions/cache@v3 - id: cache_cpp - with: - path: cpp - key: ${{ runner.os }}-${{ hashFiles('cpp/*') }} - - - name: Bootstrap sol - run: | - cd sol - ./bootstrap.sh - - - name: Run Forge tests - run: | - forge test --no-match-contract TestBase -vvv - id: test \ No newline at end of file + - name: Build docker image + run: docker build . -f sol/Dockerfile \ No newline at end of file diff --git a/sol/.dockerignore b/sol/.dockerignore index d5fb189d60..407d3308b1 100644 --- a/sol/.dockerignore +++ b/sol/.dockerignore @@ -2,4 +2,5 @@ broadcast cache out Dockerfile -lib \ No newline at end of file +lib +../.gitmodules \ 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..dd2e4d3435 100644 --- a/sol/README.md +++ b/sol/README.md @@ -68,4 +68,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, from root run: +```bash +# From root +docker build . -f sol/Dockerfile +``` \ No newline at end of file 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/scripts/init.sh b/sol/scripts/init.sh index cfeebd5142..c3a31c9388 100755 --- a/sol/scripts/init.sh +++ b/sol/scripts/init.sh @@ -1,11 +1,5 @@ #!/bin/bash -cd ../cpp -cmake --preset clang15 -cmake --build --preset clang15 --target solidity_key_gen solidity_proof_gen - -cd ../sol - PLONK_FLAVOUR="ultra" SRS_PATH="../cpp/srs_db/ignition" OUTPUT_PATH="./src/ultra" From 6acb77fe93c63ef3ce8152a011052eacc8a64ee6 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 20:30:51 +0000 Subject: [PATCH 25/26] chore: cleanups --- .circleci/build | 4 ---- .circleci/build_local | 1 - .circleci/cond_spot_run_build | 1 - .circleci/config.yml | 12 ------------ .circleci/ensure_repo | 2 -- build_manifest.json | 8 +------- cpp/src/barretenberg/solidity_helpers/key_gen.cpp | 4 ++-- sol/.dockerignore | 6 ------ sol/README.md | 6 ++++-- sol/foundry.toml | 2 +- sol/scripts/init.sh | 1 + 11 files changed, 9 insertions(+), 38 deletions(-) delete mode 100644 sol/.dockerignore diff --git a/.circleci/build b/.circleci/build index cfc1680421..d04de6c40a 100755 --- a/.circleci/build +++ b/.circleci/build @@ -19,7 +19,6 @@ PROJECT_DIR=$(query_manifest projectDir $REPOSITORY) echo "Repository: $REPOSITORY" echo "Working directory: $PWD" echo "Dockerfile: $DOCKERFILE" -docker --version echo "$(query_manifest buildDir $REPOSITORY)" cd $(query_manifest buildDir $REPOSITORY) @@ -33,12 +32,9 @@ function fetch_image() { return 0 } -#echo "Executing ensure_repo" # Ensure ECR repository exists. ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle -#echo "ensure_repo complete" -echo "Executing last successful commit" LAST_SUCCESSFUL_COMMIT=$(last_successful_commit $REPOSITORY) echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" 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/cond_spot_run_build b/.circleci/cond_spot_run_build index 948457b9ae..d4fa4723ea 100755 --- a/.circleci/cond_spot_run_build +++ b/.circleci/cond_spot_run_build @@ -6,7 +6,6 @@ shift SPEC=$1 shift DOCKERFILE=$(query_manifest dockerfile $REPOSITORY) -docker --version cd $(query_manifest buildDir $REPOSITORY) 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/.circleci/ensure_repo b/.circleci/ensure_repo index 2d526f738f..c1d579d1f0 100755 --- a/.circleci/ensure_repo +++ b/.circleci/ensure_repo @@ -24,10 +24,8 @@ REPOSITORY=$1 REGION=$2 REFRESH_LIFECYCLE=$3 -echo "Logging in" aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT.dkr.ecr.$REGION.amazonaws.com 2> /dev/null -echo "Repository: $REPOSITORY" # Create the repository if it doesn't exist. if ! aws ecr describe-repositories --region $REGION --repository-names $REPOSITORY > /dev/null 2>&1; then echo "Creating repo: $REPOSITORY" diff --git a/build_manifest.json b/build_manifest.json index 82e0c700b2..a44071b71e 100644 --- a/build_manifest.json +++ b/build_manifest.json @@ -25,14 +25,8 @@ }, "barretenberg.js": { "buildDir": "js", - "dockerfile": "Dockerfile", + "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/src/barretenberg/solidity_helpers/key_gen.cpp b/cpp/src/barretenberg/solidity_helpers/key_gen.cpp index 68f2a42230..86913a0d92 100644 --- a/cpp/src/barretenberg/solidity_helpers/key_gen.cpp +++ b/cpp/src/barretenberg/solidity_helpers/key_gen.cpp @@ -17,7 +17,7 @@ void generate_keys(std::string output_path, std::string srs_path, std::string fl uint256_t public_inputs[4] = { 0, 0, 0, 0 }; Composer composer = Circuit::generate(srs_path, public_inputs); - std::shared_ptr verification_key = composer.compute_verification_key(); + std::shared_ptr vkey = composer.compute_verification_key(); // Make verification key file upper case circuit_name.at(0) = static_cast(std::toupper(static_cast(circuit_name.at(0)))); @@ -30,7 +30,7 @@ void generate_keys(std::string output_path, std::string srs_path, std::string fl { auto vk_filename = output_path + "/keys/" + vk_class_name + ".sol"; std::ofstream os(vk_filename); - proof_system::output_vk_sol(os, verification_key, vk_class_name); + proof_system::output_vk_sol(os, vkey, vk_class_name); info("VK contract written to: ", vk_filename); } diff --git a/sol/.dockerignore b/sol/.dockerignore deleted file mode 100644 index 407d3308b1..0000000000 --- a/sol/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -broadcast -cache -out -Dockerfile -lib -../.gitmodules \ No newline at end of file diff --git a/sol/README.md b/sol/README.md index dd2e4d3435..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: @@ -71,8 +73,8 @@ 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. # Docker -To run the docker image, from root run: +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 -``` \ No newline at end of file +``` 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" diff --git a/sol/scripts/init.sh b/sol/scripts/init.sh index c3a31c9388..fa00f288bd 100755 --- a/sol/scripts/init.sh +++ b/sol/scripts/init.sh @@ -1,5 +1,6 @@ #!/bin/bash + PLONK_FLAVOUR="ultra" SRS_PATH="../cpp/srs_db/ignition" OUTPUT_PATH="./src/ultra" From 62539f2f0bfad605224aa894ed8fcef58a1a1350 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Wed, 19 Apr 2023 20:32:04 +0000 Subject: [PATCH 26/26] chore: remove log --- .circleci/build | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/build b/.circleci/build index d04de6c40a..3db9f403af 100755 --- a/.circleci/build +++ b/.circleci/build @@ -20,7 +20,6 @@ echo "Repository: $REPOSITORY" echo "Working directory: $PWD" echo "Dockerfile: $DOCKERFILE" -echo "$(query_manifest buildDir $REPOSITORY)" cd $(query_manifest buildDir $REPOSITORY) function fetch_image() {