diff --git a/.github/actions/compile-and-bundle/action.yml b/.github/actions/compile-and-bundle/action.yml new file mode 100644 index 0000000..ae7c624 --- /dev/null +++ b/.github/actions/compile-and-bundle/action.yml @@ -0,0 +1,128 @@ +name: "Compile and Bundle Circuit" +description: "Compiles and bundles the witness generator of a Circom Circuit" +branding: + icon: "package" + color: "blue" + +inputs: + circuit-name-display: + description: "The name of the Circom circuit to compile." + required: true + circuit-name-binary: + description: "The final name of the compiled binary. The name should be extensionless." + required: true + circuit-path: + description: "The path to the Circom circuit file relative to the repository root." + required: true + resources-path: + description: "The path to the CI resources directory relative to the repository root." + required: false + default: ".github/resources" + version: + description: "The version of the bundle. E.g.: v1.0.0." + required: true + os: + description: "The target operating system for the bundle (linux, windows, macos)." + required: true + arch: + description: "The target architecture for the bundle (x86_64, aarch64)." + required: true + +runs: + using: "composite" + steps: + - name: Parse Circuit Path + id: parse-circuit-path + shell: bash + env: + CIRCUIT_PATH: ${{ inputs.circuit-path }} + BUNDLE_TRIPLET: ${{ inputs.version }}-${{ inputs.os }}-${{ inputs.arch }} + CIRCUIT_NAME_BINARY: ${{ inputs.circuit-name-binary }} + RESOURCES_PATH: ${{ inputs.resources-path }} + OS: ${{ inputs.os }} + run: | + CIRCUIT_DIRECTORY="$(dirname ${CIRCUIT_PATH})" + CIRCUIT_FILENAME="$(basename ${CIRCUIT_PATH})" + CIRCUIT_FILESTEM="${CIRCUIT_FILENAME%.circom}" + CIRCUIT_CPP_DIRNAME="${CIRCUIT_FILESTEM}_cpp" + + platform_binary_name="${CIRCUIT_NAME_BINARY}" + if [ "${OS}" = "windows" ]; then + platform_binary_name="${platform_binary_name}.exe" + fi + + { + echo "CIRCUIT_DIRECTORY=${CIRCUIT_DIRECTORY}" + echo "CIRCUIT_FILENAME=${CIRCUIT_FILENAME}" + echo "CIRCUIT_FILESTEM=${CIRCUIT_FILESTEM}" + echo "CIRCUIT_CPP_DIRNAME=${CIRCUIT_CPP_DIRNAME}" + echo "CIRCUIT_CPP_PATH=${CIRCUIT_DIRECTORY}/${CIRCUIT_CPP_DIRNAME}" + echo "WITNESS_GENERATOR_RESOURCES_PATH=${RESOURCES_PATH}/witness-generator" + echo "BUNDLE_TRIPLET=${BUNDLE_TRIPLET}" + echo "PLATFORM_BINARY_NAME=${platform_binary_name}" + } >> "${GITHUB_OUTPUT}" + + - name: Generate ${{ inputs.circuit-name-display }} + shell: bash + working-directory: ${{ steps.parse-circuit-path.outputs.CIRCUIT_DIRECTORY }} + env: + CIRCUIT_FILENAME: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILENAME }} + run: circom --c --r1cs --no_asm --O2 "${CIRCUIT_FILENAME}" + + # TODO: Instead of replace, make a fork that generates the appropriate Makefile + - name: Replace ${{ inputs.circuit-name-display }}'s Makefile + shell: bash + env: + WITNESS_GENERATOR_RESOURCES_PATH: ${{ steps.parse-circuit-path.outputs.WITNESS_GENERATOR_RESOURCES_PATH }} + CIRCUIT_CPP_PATH: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }} + run: cp "${WITNESS_GENERATOR_RESOURCES_PATH}/Makefile" "${CIRCUIT_CPP_PATH}/Makefile" + + # TODO: Instead of insertion, make a fork that includes the appropriate patch (or the actual fix) + - name: Patch MacOS GMP + shell: bash + if: ${{ inputs.os == 'macos' }} + env: + WITNESS_GENERATOR_RESOURCES_PATH: ${{ steps.parse-circuit-path.outputs.WITNESS_GENERATOR_RESOURCES_PATH }} + CIRCUIT_CPP_PATH: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }} + OS: ${{ inputs.os }} + run: cp "${WITNESS_GENERATOR_RESOURCES_PATH}/${{ env.OS }}.gmp_patch.hpp" "${CIRCUIT_CPP_PATH}/gmp_patch.hpp" + + - name: Compile ${{ inputs.circuit-name-display }} + if: ${{ inputs.os != 'windows' }} + shell: bash + working-directory: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }} + env: + CIRCUIT_FILESTEM: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }} + OS: ${{ inputs.os }} + run: make PROJECT="${CIRCUIT_FILESTEM}" "${OS}" + + - name: Compile ${{ inputs.circuit-name-display }} + if: ${{ inputs.os == 'windows' }} + shell: msys2 {0} + working-directory: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }} + env: + CIRCUIT_FILESTEM: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }} + OS: ${{ inputs.os }} + run: make PROJECT="${CIRCUIT_FILESTEM}" "${OS}" + + - name: Bundle ${{ inputs.circuit-name-display }} + shell: bash + env: + CIRCUIT_NAME: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }} + PLATFORM_BINARY_NAME: ${{ steps.parse-circuit-path.outputs.PLATFORM_BINARY_NAME }} + BUNDLE_NAME: ${{ inputs.circuit-name-binary }}-${{ steps.parse-circuit-path.outputs.BUNDLE_TRIPLET }} + WITNESS_GENERATOR_DIR: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }} + run: | + BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" + mkdir -p "$BUNDLE_DIR" + + mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" + mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" + + tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" + + - name: Upload ${{ inputs.circuit-name-display }} + uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + with: + name: ${{ inputs.circuit-name-binary }}-${{ steps.parse-circuit-path.outputs.BUNDLE_TRIPLET }}.tar.gz + path: ${{ inputs.circuit-name-binary }}-${{ steps.parse-circuit-path.outputs.BUNDLE_TRIPLET }}.tar.gz diff --git a/.github/workflows/build-circuits.yml b/.github/workflows/build-circuits.yml index b7e797f..27cbb76 100644 --- a/.github/workflows/build-circuits.yml +++ b/.github/workflows/build-circuits.yml @@ -66,15 +66,12 @@ jobs: - name: Checkout uses: actions/checkout@8edcb1bdb4e267140fa742c62e395cd74f332709 - with: - path: repo - name: Initialise Submodules - working-directory: repo run: git submodule update --init --recursive - name: Setup Dependencies - working-directory: repo/circom_circuits/rapidsnark + working-directory: circom_circuits/rapidsnark run: sudo apt update -y - name: Install Dependencies [Prover] @@ -84,53 +81,15 @@ jobs: run: sudo apt install nlohmann-json3-dev - name: Replace Prover Makefile # TODO: Make a fork generate the appropriate Linux Makefile - working-directory: repo run: cp .github/resources/prover/Makefile circom_circuits/rapidsnark/Makefile - name: Compile Prover and Verifier - working-directory: repo/circom_circuits/rapidsnark + working-directory: circom_circuits/rapidsnark run: | ./build_gmp.sh host make host_linux_x86_64_static - - name: Generate PoL - working-directory: repo/circom_circuits/Mantle - run: circom --c --r1cs --no_asm --O2 pol.circom - - - name: Replace PoL Makefile # TODO: Make a fork generate the appropriate Linux Makefile - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Mantle/pol_cpp/Makefile - - - name: Compile PoL - working-directory: repo/circom_circuits/Mantle/pol_cpp - run: make PROJECT=pol linux - - - name: Generate PoQ - working-directory: repo/circom_circuits/Blend - run: circom --c --r1cs --no_asm --O2 poq.circom - - - name: Replace PoQ Makefile # TODO: Make a fork generate the appropriate Linux Makefile - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Blend/poq_cpp/Makefile - - - name: Compile PoQ - working-directory: repo/circom_circuits/Blend/poq_cpp - run: make PROJECT=poq linux - - - name: Generate ZKSign - working-directory: repo/circom_circuits/Mantle - run: circom --c --r1cs --no_asm --O2 signature.circom - - - name: Replace ZKSign Makefile # TODO: Make a fork generate the appropriate Linux Makefile - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Mantle/signature_cpp/Makefile - - - name: Compile ZKSign - working-directory: repo/circom_circuits/Mantle/signature_cpp - run: make PROJECT=signature linux - - name: Bundle Rapidsnark Prover - working-directory: repo env: BINARY_NAME: prover BUNDLE_NAME: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} @@ -144,7 +103,6 @@ jobs: tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - name: Bundle Rapidsnark Verifier - working-directory: repo env: BINARY_NAME: verifier BUNDLE_NAME: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} @@ -157,84 +115,47 @@ jobs: tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - name: Bundle PoL Witness Generator - working-directory: repo - env: - CIRCUIT_NAME: pol - PLATFORM_BINARY_NAME: pol - BUNDLE_NAME: pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Mantle/pol_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - ls -la ${WITNESS_GENERATOR_DIR} - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - - name: Bundle PoQ Witness Generator - working-directory: repo - env: - CIRCUIT_NAME: poq - PLATFORM_BINARY_NAME: poq - BUNDLE_NAME: poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Blend/poq_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - - name: Bundle ZKSign Witness Generator - working-directory: repo - env: - CIRCUIT_NAME: signature - PLATFORM_BINARY_NAME: zksign - BUNDLE_NAME: zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Mantle/signature_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - name: Upload Rapidsnark Prover uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 with: name: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + path: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - name: Upload Rapidsnark Verifier uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 with: name: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + path: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - - name: Upload PoL Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle PoL + uses: ./.github/actions/compile-and-bundle with: - name: pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "PoL" + circuit-name-binary: "pol" + circuit-path: "circom_circuits/Mantle/pol.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} - - name: Upload PoQ Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle PoQ + uses: ./.github/actions/compile-and-bundle with: - name: poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "PoQ" + circuit-name-binary: "poq" + circuit-path: "circom_circuits/Blend/poq.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} - - name: Upload ZKSign Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle ZKSign + uses: ./.github/actions/compile-and-bundle with: - name: zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "ZKSign" + circuit-name-binary: "zksign" + circuit-path: "circom_circuits/Mantle/signature.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} build-windows: name: Build Windows Binaries (Native) @@ -272,11 +193,8 @@ jobs: - name: Checkout uses: actions/checkout@8edcb1bdb4e267140fa742c62e395cd74f332709 - with: - path: repo - name: Initialise Submodules - working-directory: repo run: git submodule update --init --recursive - name: Install Dependencies [Witness Generator] @@ -300,81 +218,33 @@ jobs: - name: Replace Prover Makefile # TODO: Make a fork generate the appropriate Windows Makefile shell: msys2 {0} - working-directory: repo run: cp .github/resources/prover/Makefile circom_circuits/rapidsnark/Makefile - name: Replace Prover CMakeLists shell: msys2 {0} - working-directory: repo run: cp .github/resources/prover/${{ env.OS }}.src-CMakeLists.txt circom_circuits/rapidsnark/src/CMakeLists.txt - name: Patch Windows mman shell: msys2 {0} - working-directory: repo run: cp .github/resources/prover/${{ env.OS }}.mman_patch.hpp /include/mman_patch.hpp - name: Add uio.h headers shell: msys2 {0} - working-directory: repo run: cp .github/resources/prover/${{ env.OS }}.uio.h /include/sys/uio.h - name: Replace build_gmp shell: msys2 {0} - working-directory: repo run: cp .github/resources/prover/${{ env.OS }}.build_gmp.sh circom_circuits/rapidsnark/build_gmp.sh - name: Compile Prover and Verifier shell: msys2 {0} - working-directory: repo/circom_circuits/rapidsnark + working-directory: circom_circuits/rapidsnark run: | ./build_gmp.sh host make host_windows_x86_64_static - - name: Generate PoL - working-directory: repo/circom_circuits/Mantle - run: circom --c --r1cs --no_asm pol.circom - - - name: Replace PoL Makefile # TODO: Make a fork generate the appropriate Windows Makefile - shell: msys2 {0} - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Mantle/pol_cpp/Makefile - - - name: Compile PoL - shell: msys2 {0} - working-directory: repo/circom_circuits/Mantle/pol_cpp - run: make PROJECT=pol windows - - - name: Generate PoQ - working-directory: repo/circom_circuits/Blend - run: circom --c --r1cs --no_asm poq.circom - - - name: Replace PoQ Makefile # TODO: Make a fork generate the appropriate Windows Makefile - shell: msys2 {0} - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Blend/poq_cpp/Makefile - - - name: Compile PoQ - shell: msys2 {0} - working-directory: repo/circom_circuits/Blend/poq_cpp - run: make PROJECT=poq windows - - - name: Generate ZKSign - working-directory: repo/circom_circuits/Mantle - run: circom --c --r1cs --no_asm signature.circom - - - name: Replace ZKSign Makefile # TODO: Make a fork generate the appropriate Windows Makefile - shell: msys2 {0} - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Mantle/signature_cpp/Makefile - - - name: Compile ZKSign - shell: msys2 {0} - working-directory: repo/circom_circuits/Mantle/signature_cpp - run: make PROJECT=signature windows - - name: Bundle Rapidsnark Prover shell: msys2 {0} - working-directory: repo env: BINARY_NAME: prover BUNDLE_NAME: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} @@ -389,7 +259,6 @@ jobs: - name: Bundle Rapidsnark Verifier shell: msys2 {0} - working-directory: repo env: BINARY_NAME: verifier BUNDLE_NAME: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} @@ -402,86 +271,47 @@ jobs: tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - name: Bundle PoL Witness Generator - shell: msys2 {0} - working-directory: repo - env: - CIRCUIT_NAME: pol - PLATFORM_BINARY_NAME: pol.exe - BUNDLE_NAME: pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Mantle/pol_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - - name: Bundle PoQ Witness Generator - shell: msys2 {0} - working-directory: repo - env: - CIRCUIT_NAME: poq - PLATFORM_BINARY_NAME: poq.exe - BUNDLE_NAME: poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Blend/poq_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - - name: Bundle ZKSign Witness Generator - shell: msys2 {0} - working-directory: repo - env: - CIRCUIT_NAME: signature - PLATFORM_BINARY_NAME: zksign.exe - BUNDLE_NAME: zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Mantle/signature_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - name: Upload Rapidsnark Prover uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 with: name: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + path: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - name: Upload Rapidsnark Verifier uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 with: name: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + path: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - - name: Upload PoL Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle PoL + uses: ./.github/actions/compile-and-bundle with: - name: pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "PoL" + circuit-name-binary: "pol" + circuit-path: "circom_circuits/Mantle/pol.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} - - name: Upload PoQ Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle PoQ + uses: ./.github/actions/compile-and-bundle with: - name: poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "PoQ" + circuit-name-binary: "poq" + circuit-path: "circom_circuits/Blend/poq.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} - - name: Upload ZKSign Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle ZKSign + uses: ./.github/actions/compile-and-bundle with: - name: zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "ZKSign" + circuit-name-binary: "zksign" + circuit-path: "circom_circuits/Mantle/signature.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} build-macos: name: Build MacOS Binaries (Native) @@ -490,7 +320,7 @@ jobs: - setup env: VERSION: ${{ needs.setup.outputs.version }} - ARCH: arm64 + ARCH: aarch64 OS: macos steps: - name: Install Rust Toolchain @@ -509,11 +339,8 @@ jobs: - name: Checkout uses: actions/checkout@8edcb1bdb4e267140fa742c62e395cd74f332709 - with: - path: repo - name: Initialise Submodules - working-directory: repo run: git submodule update --init --recursive - name: Setup Dependencies @@ -526,61 +353,12 @@ jobs: run: brew install nasm m4 - name: Compile Prover and Verifier - working-directory: repo/circom_circuits/rapidsnark + working-directory: circom_circuits/rapidsnark run: | ./build_gmp.sh macos_arm64 make macos_arm64 - - name: Generate PoL - working-directory: repo/circom_circuits/Mantle - run: circom --c --r1cs --no_asm --O2 pol.circom - - - name: Replace PoL's Makefile # TODO: Make a fork generate the appropriate MacOS Makefile - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Mantle/pol_cpp/Makefile - - - name: Patch MacOS GMP - working-directory: repo - run: cp .github/resources/witness-generator/${{ env.OS }}.gmp_patch.hpp circom_circuits/Mantle/pol_cpp/gmp_patch.hpp - - - name: Compile PoL - working-directory: repo/circom_circuits/Mantle/pol_cpp - run: make PROJECT=pol macos - - - name: Generate PoQ - working-directory: repo/circom_circuits/Blend - run: circom --c --r1cs --no_asm --O2 poq.circom - - - name: Replace PoQ's Makefile # TODO: Make a fork generate the appropriate MacOS Makefile - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Blend/poq_cpp/Makefile - - - name: Patch MacOS GMP - working-directory: repo - run: cp .github/resources/witness-generator/${{ env.OS }}.gmp_patch.hpp circom_circuits/Blend/poq_cpp/gmp_patch.hpp - - - name: Compile PoQ - working-directory: repo/circom_circuits/Blend/poq_cpp - run: make PROJECT=poq macos - - - name: Generate ZKSign - working-directory: repo/circom_circuits/Mantle - run: circom --c --r1cs --no_asm --O2 signature.circom - - - name: Replace ZKSign's Makefile # TODO: Make a fork generate the appropriate MacOS Makefile - working-directory: repo - run: cp .github/resources/witness-generator/Makefile circom_circuits/Mantle/signature_cpp/Makefile - - - name: Patch MacOS GMP - working-directory: repo - run: cp .github/resources/witness-generator/${{ env.OS }}.gmp_patch.hpp circom_circuits/Mantle/signature_cpp/gmp_patch.hpp - - - name: Compile ZKSign - working-directory: repo/circom_circuits/Mantle/signature_cpp - run: make PROJECT=signature macos - - name: Bundle Rapidsnark Prover - working-directory: repo env: BINARY_NAME: prover BUNDLE_NAME: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} @@ -594,7 +372,6 @@ jobs: tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - name: Bundle Rapidsnark Verifier - working-directory: repo env: BINARY_NAME: verifier BUNDLE_NAME: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} @@ -607,84 +384,47 @@ jobs: tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - name: Bundle PoL Witness Generator - working-directory: repo - env: - CIRCUIT_NAME: pol - PLATFORM_BINARY_NAME: pol - BUNDLE_NAME: pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Mantle/pol_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - ls -la ${WITNESS_GENERATOR_DIR} - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - - name: Bundle PoQ Witness Generator - working-directory: repo - env: - CIRCUIT_NAME: poq - PLATFORM_BINARY_NAME: poq - BUNDLE_NAME: poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Blend/poq_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - - name: Bundle ZKSign Witness Generator - working-directory: repo - env: - CIRCUIT_NAME: signature - PLATFORM_BINARY_NAME: zksign - BUNDLE_NAME: zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }} - WITNESS_GENERATOR_DIR: circom_circuits/Mantle/signature_cpp - run: | - BUNDLE_DIR="${BUNDLE_NAME}/witness-generator" - mkdir -p "$BUNDLE_DIR" - - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}" - mv "${WITNESS_GENERATOR_DIR}/${CIRCUIT_NAME}.dat" "$BUNDLE_DIR/${PLATFORM_BINARY_NAME}.dat" - - tar -czf "${BUNDLE_NAME}.tar.gz" "${BUNDLE_NAME}" - - name: Upload Rapidsnark Prover uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 with: name: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + path: prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - name: Upload Rapidsnark Verifier uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 with: name: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + path: verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - - name: Upload PoL Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle PoL + uses: ./.github/actions/compile-and-bundle with: - name: pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/pol-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "PoL" + circuit-name-binary: "pol" + circuit-path: "circom_circuits/Mantle/pol.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} - - name: Upload PoQ Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle PoQ + uses: ./.github/actions/compile-and-bundle with: - name: poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/poq-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "PoQ" + circuit-name-binary: "poq" + circuit-path: "circom_circuits/Blend/poq.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} - - name: Upload ZKSign Witness Generator - uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 + - name: Compile and Bundle ZKSign + uses: ./.github/actions/compile-and-bundle with: - name: zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz - path: repo/zksign-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz + circuit-name-display: "ZKSign" + circuit-name-binary: "zksign" + circuit-path: "circom_circuits/Mantle/signature.circom" + version: ${{ env.VERSION }} + os: ${{ env.OS }} + arch: ${{ env.ARCH }} publish-release: name: Create Release @@ -737,7 +477,7 @@ jobs: - os: linux arch: x86_64 - os: macos - arch: arm64 + arch: aarch64 - os: windows arch: x86_64 artifact: @@ -764,4 +504,3 @@ jobs: asset_path: ${{ env.ARTIFACT_NAME }} asset_name: ${{ env.ARTIFACT_NAME }} asset_content_type: application/octet-stream - diff --git a/.gitignore b/.gitignore index d761806..59be11d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Cargo.lock target/ .vscode.DS_Store +.idea/ \ No newline at end of file