mirror of
https://github.com/logos-blockchain/logos-blockchain-circuits.git
synced 2026-05-18 15:29:26 +00:00
Compile libraries instead of binaries.
This commit is contained in:
parent
d6cf41f665
commit
062800b917
@ -9,7 +9,7 @@ inputs:
|
||||
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."
|
||||
description: "The name used for artifact labelling. Should match the circuit's canonical name (e.g. pol, poq)."
|
||||
required: true
|
||||
circuit-path:
|
||||
description: "The path to the Circom circuit file relative to the repository root."
|
||||
@ -45,11 +45,6 @@ runs:
|
||||
CIRCUIT_FILENAME="$(basename ${CIRCUIT_PATH})"
|
||||
CIRCUIT_FILESTEM="${CIRCUIT_FILENAME%.circom}"
|
||||
CIRCUIT_CPP_DIRNAME="${CIRCUIT_FILESTEM}_cpp"
|
||||
|
||||
compiled_binary_name="${CIRCUIT_FILESTEM}"
|
||||
if [ "${OS}" = "windows" ]; then
|
||||
compiled_binary_name="${compiled_binary_name}.exe"
|
||||
fi
|
||||
|
||||
{
|
||||
echo "CIRCUIT_DIRECTORY=${CIRCUIT_DIRECTORY}"
|
||||
@ -59,7 +54,7 @@ runs:
|
||||
echo "CIRCUIT_CPP_PATH=${CIRCUIT_DIRECTORY}/${CIRCUIT_CPP_DIRNAME}"
|
||||
echo "WITNESS_GENERATOR_RESOURCES_PATH=${RESOURCES_PATH}/witness-generator"
|
||||
echo "BUNDLE_TRIPLET=${BUNDLE_TRIPLET}"
|
||||
echo "COMPILED_BINARY_NAME=${compiled_binary_name}"
|
||||
echo "LIB_NAME=libwitness_${CIRCUIT_FILESTEM}.a"
|
||||
} >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Generate ${{ inputs.circuit-name-display }}
|
||||
@ -94,7 +89,7 @@ runs:
|
||||
env:
|
||||
CIRCUIT_FILESTEM: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }}
|
||||
OS: ${{ inputs.os }}
|
||||
run: make PROJECT="${CIRCUIT_FILESTEM}" "${OS}"
|
||||
run: make PROJECT="${CIRCUIT_FILESTEM}" "${OS}-lib"
|
||||
|
||||
- name: Compile ${{ inputs.circuit-name-display }}
|
||||
if: ${{ inputs.os == 'windows' }}
|
||||
@ -103,12 +98,23 @@ runs:
|
||||
env:
|
||||
CIRCUIT_FILESTEM: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }}
|
||||
OS: ${{ inputs.os }}
|
||||
run: make PROJECT="${CIRCUIT_FILESTEM}" "${OS}"
|
||||
run: make PROJECT="${CIRCUIT_FILESTEM}" "${OS}-lib"
|
||||
|
||||
- name: Stage ${{ inputs.circuit-name-display }} Headers
|
||||
shell: bash
|
||||
env:
|
||||
CIRCUIT_CPP_PATH: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }}
|
||||
run: |
|
||||
mkdir -p "${CIRCUIT_CPP_PATH}/include"
|
||||
mv "${CIRCUIT_CPP_PATH}/calcwit.hpp" "${CIRCUIT_CPP_PATH}/include/"
|
||||
mv "${CIRCUIT_CPP_PATH}/circom.hpp" "${CIRCUIT_CPP_PATH}/include/"
|
||||
mv "${CIRCUIT_CPP_PATH}/fr.hpp" "${CIRCUIT_CPP_PATH}/include/"
|
||||
|
||||
- name: Upload ${{ inputs.circuit-name-display }}
|
||||
uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8
|
||||
with:
|
||||
name: ${{ inputs.circuit-name-binary }}-${{ inputs.version }}-${{ inputs.os }}-${{ inputs.arch }}
|
||||
path: |
|
||||
${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }}/${{ steps.parse-circuit-path.outputs.COMPILED_BINARY_NAME }}
|
||||
${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }}/${{ steps.parse-circuit-path.outputs.LIB_NAME }}
|
||||
${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }}/${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }}.dat
|
||||
${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }}/include
|
||||
|
||||
20
.github/resources/witness-generator/Makefile
vendored
20
.github/resources/witness-generator/Makefile
vendored
@ -1,4 +1,4 @@
|
||||
.PHONY: linux macos windows build clean
|
||||
.PHONY: linux macos windows linux-lib macos-lib windows-lib build clean
|
||||
|
||||
# ---- Arguments ----
|
||||
ifndef PROJECT
|
||||
@ -10,8 +10,11 @@ CXX := g++
|
||||
CXXFLAGS_COMMON := -std=c++11 -O3 -I. -Wno-address-of-packed-member
|
||||
SRCS := main.cpp calcwit.cpp fr.cpp $(PROJECT).cpp
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
LIB_SRCS := calcwit.cpp fr.cpp $(PROJECT).cpp
|
||||
LIB_OBJS := $(LIB_SRCS:.cpp=.o)
|
||||
DEPS_HPP := circom.hpp calcwit.hpp fr.hpp
|
||||
BIN := $(PROJECT)
|
||||
LIB := libwitness_$(PROJECT).a
|
||||
|
||||
# ---- Linux (x86_64 and aarch64) ----
|
||||
linux: CXXFLAGS=$(CXXFLAGS_COMMON)
|
||||
@ -19,25 +22,38 @@ linux: LDFLAGS=-static
|
||||
linux: LDLIBS=-lgmp
|
||||
linux: $(BIN)
|
||||
|
||||
linux-lib: CXXFLAGS=$(CXXFLAGS_COMMON) -fPIC
|
||||
linux-lib: $(LIB)
|
||||
|
||||
# ---- macOS ----
|
||||
macos: CXXFLAGS=$(CXXFLAGS_COMMON) -I/opt/homebrew/include -include gmp_patch.hpp
|
||||
macos: LDFLAGS=-Wl,-search_paths_first -Wl,-dead_strip
|
||||
macos: LDLIBS=/opt/homebrew/lib/libgmp.a
|
||||
macos: $(BIN)
|
||||
|
||||
macos-lib: CXXFLAGS=$(CXXFLAGS_COMMON) -fPIC -I/opt/homebrew/include -include gmp_patch.hpp
|
||||
macos-lib: $(LIB)
|
||||
|
||||
# ---- Windows (MinGW) ----
|
||||
windows: CXXFLAGS=$(CXXFLAGS_COMMON) -I/include -Duint="unsigned int"
|
||||
windows: LDFLAGS=-static
|
||||
windows: LDLIBS=-L/lib -lgmp -lmman
|
||||
windows: $(BIN)
|
||||
|
||||
windows-lib: CXXFLAGS=$(CXXFLAGS_COMMON) -fPIC -I/include -Duint="unsigned int"
|
||||
windows-lib: $(LIB)
|
||||
|
||||
# ---- Rules ----
|
||||
$(BIN): $(OBJS)
|
||||
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
|
||||
$(LIB): $(LIB_OBJS)
|
||||
ar rcs $@ $^
|
||||
objcopy --prefix-symbols=$(PROJECT)_ $@
|
||||
|
||||
%.o: %.cpp $(DEPS_HPP)
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(BIN)
|
||||
rm -f $(OBJS) $(LIB_OBJS) $(BIN) $(LIB)
|
||||
|
||||
|
||||
82
.github/workflows/build-circuits.yml
vendored
82
.github/workflows/build-circuits.yml
vendored
@ -140,7 +140,7 @@ jobs:
|
||||
${{ matrix.circuit.dir }}/${{ matrix.circuit.name }}_verification_key.json
|
||||
|
||||
build-linux:
|
||||
name: Build Linux Binaries (Native)
|
||||
name: Build Linux Libraries (Native)
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- setup
|
||||
@ -342,21 +342,19 @@ jobs:
|
||||
chmod +x "${BUNDLE_NAME}/prover"
|
||||
chmod +x "${BUNDLE_NAME}/verifier"
|
||||
|
||||
# Move witness generators into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/pol "${BUNDLE_NAME}/pol/witness_generator"
|
||||
# Move witness libraries into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/libwitness_pol.a "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/pol-artifact/pol.dat "${BUNDLE_NAME}/pol/witness_generator.dat"
|
||||
mv witness-generators/poq-artifact/poq "${BUNDLE_NAME}/poq/witness_generator"
|
||||
cp -r witness-generators/pol-artifact/include "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/poq-artifact/libwitness_poq.a "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/poq-artifact/poq.dat "${BUNDLE_NAME}/poq/witness_generator.dat"
|
||||
mv witness-generators/zksign-artifact/signature "${BUNDLE_NAME}/zksign/witness_generator"
|
||||
cp -r witness-generators/poq-artifact/include "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/zksign-artifact/libwitness_signature.a "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/zksign-artifact/signature.dat "${BUNDLE_NAME}/zksign/witness_generator.dat"
|
||||
mv witness-generators/poc-artifact/poc "${BUNDLE_NAME}/poc/witness_generator"
|
||||
cp -r witness-generators/zksign-artifact/include "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/poc-artifact/libwitness_poc.a "${BUNDLE_NAME}/poc/"
|
||||
mv witness-generators/poc-artifact/poc.dat "${BUNDLE_NAME}/poc/witness_generator.dat"
|
||||
|
||||
# Restore execute permissions on witness generators
|
||||
chmod +x "${BUNDLE_NAME}/pol/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/poq/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/zksign/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/poc/witness_generator"
|
||||
cp -r witness-generators/poc-artifact/include "${BUNDLE_NAME}/poc/"
|
||||
|
||||
# Copy proving keys and verification keys into each circuit directory
|
||||
cp proving-keys/pol-proving-key/pol.zkey "${BUNDLE_NAME}/pol/proving_key.zkey"
|
||||
@ -378,7 +376,7 @@ jobs:
|
||||
path: logos-blockchain-circuits-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz
|
||||
|
||||
build-linux-aarch64:
|
||||
name: Build Linux aarch64 Binaries (Native for RPI5)
|
||||
name: Build Linux aarch64 Libraries (Native for RPI5)
|
||||
runs-on: ubuntu-22.04-arm
|
||||
needs:
|
||||
- setup
|
||||
@ -582,21 +580,19 @@ jobs:
|
||||
chmod +x "${BUNDLE_NAME}/prover"
|
||||
chmod +x "${BUNDLE_NAME}/verifier"
|
||||
|
||||
# Move witness generators into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/pol "${BUNDLE_NAME}/pol/witness_generator"
|
||||
# Move witness libraries into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/libwitness_pol.a "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/pol-artifact/pol.dat "${BUNDLE_NAME}/pol/witness_generator.dat"
|
||||
mv witness-generators/poq-artifact/poq "${BUNDLE_NAME}/poq/witness_generator"
|
||||
cp -r witness-generators/pol-artifact/include "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/poq-artifact/libwitness_poq.a "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/poq-artifact/poq.dat "${BUNDLE_NAME}/poq/witness_generator.dat"
|
||||
mv witness-generators/zksign-artifact/signature "${BUNDLE_NAME}/zksign/witness_generator"
|
||||
cp -r witness-generators/poq-artifact/include "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/zksign-artifact/libwitness_signature.a "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/zksign-artifact/signature.dat "${BUNDLE_NAME}/zksign/witness_generator.dat"
|
||||
mv witness-generators/poc-artifact/poc "${BUNDLE_NAME}/poc/witness_generator"
|
||||
cp -r witness-generators/zksign-artifact/include "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/poc-artifact/libwitness_poc.a "${BUNDLE_NAME}/poc/"
|
||||
mv witness-generators/poc-artifact/poc.dat "${BUNDLE_NAME}/poc/witness_generator.dat"
|
||||
|
||||
# Restore execute permissions on witness generators
|
||||
chmod +x "${BUNDLE_NAME}/pol/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/poq/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/zksign/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/poc/witness_generator"
|
||||
cp -r witness-generators/poc-artifact/include "${BUNDLE_NAME}/poc/"
|
||||
|
||||
# Copy proving keys and verification keys into each circuit directory
|
||||
cp proving-keys/pol-proving-key/pol.zkey "${BUNDLE_NAME}/pol/proving_key.zkey"
|
||||
@ -618,7 +614,7 @@ jobs:
|
||||
path: logos-blockchain-circuits-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz
|
||||
|
||||
build-windows:
|
||||
name: Build Windows Binaries (Native)
|
||||
name: Build Windows Libraries (Native)
|
||||
runs-on: windows-latest
|
||||
needs:
|
||||
- setup
|
||||
@ -859,15 +855,19 @@ jobs:
|
||||
mv prover-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}/prover/prover.exe "${BUNDLE_NAME}/prover.exe"
|
||||
mv verifier-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}/verifier/verifier.exe "${BUNDLE_NAME}/verifier.exe"
|
||||
|
||||
# Move witness generators into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/pol.exe "${BUNDLE_NAME}/pol/witness_generator.exe"
|
||||
# Move witness libraries into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/libwitness_pol.a "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/pol-artifact/pol.dat "${BUNDLE_NAME}/pol/witness_generator.dat"
|
||||
mv witness-generators/poq-artifact/poq.exe "${BUNDLE_NAME}/poq/witness_generator.exe"
|
||||
cp -r witness-generators/pol-artifact/include "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/poq-artifact/libwitness_poq.a "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/poq-artifact/poq.dat "${BUNDLE_NAME}/poq/witness_generator.dat"
|
||||
mv witness-generators/zksign-artifact/signature.exe "${BUNDLE_NAME}/zksign/witness_generator.exe"
|
||||
cp -r witness-generators/poq-artifact/include "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/zksign-artifact/libwitness_signature.a "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/zksign-artifact/signature.dat "${BUNDLE_NAME}/zksign/witness_generator.dat"
|
||||
mv witness-generators/poc-artifact/poc.exe "${BUNDLE_NAME}/poc/witness_generator.exe"
|
||||
cp -r witness-generators/zksign-artifact/include "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/poc-artifact/libwitness_poc.a "${BUNDLE_NAME}/poc/"
|
||||
mv witness-generators/poc-artifact/poc.dat "${BUNDLE_NAME}/poc/witness_generator.dat"
|
||||
cp -r witness-generators/poc-artifact/include "${BUNDLE_NAME}/poc/"
|
||||
|
||||
# Copy proving keys and verification keys into each circuit directory
|
||||
cp proving-keys/pol-proving-key/pol.zkey "${BUNDLE_NAME}/pol/proving_key.zkey"
|
||||
@ -889,7 +889,7 @@ jobs:
|
||||
path: logos-blockchain-circuits-${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz
|
||||
|
||||
build-macos:
|
||||
name: Build MacOS Binaries (Native)
|
||||
name: Build MacOS Libraries (Native)
|
||||
runs-on: macos-latest
|
||||
needs:
|
||||
- setup
|
||||
@ -1087,21 +1087,19 @@ jobs:
|
||||
chmod +x "${BUNDLE_NAME}/prover"
|
||||
chmod +x "${BUNDLE_NAME}/verifier"
|
||||
|
||||
# Move witness generators into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/pol "${BUNDLE_NAME}/pol/witness_generator"
|
||||
# Move witness libraries into their respective circuit directories
|
||||
mv witness-generators/pol-artifact/libwitness_pol.a "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/pol-artifact/pol.dat "${BUNDLE_NAME}/pol/witness_generator.dat"
|
||||
mv witness-generators/poq-artifact/poq "${BUNDLE_NAME}/poq/witness_generator"
|
||||
cp -r witness-generators/pol-artifact/include "${BUNDLE_NAME}/pol/"
|
||||
mv witness-generators/poq-artifact/libwitness_poq.a "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/poq-artifact/poq.dat "${BUNDLE_NAME}/poq/witness_generator.dat"
|
||||
mv witness-generators/zksign-artifact/signature "${BUNDLE_NAME}/zksign/witness_generator"
|
||||
cp -r witness-generators/poq-artifact/include "${BUNDLE_NAME}/poq/"
|
||||
mv witness-generators/zksign-artifact/libwitness_signature.a "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/zksign-artifact/signature.dat "${BUNDLE_NAME}/zksign/witness_generator.dat"
|
||||
mv witness-generators/poc-artifact/poc "${BUNDLE_NAME}/poc/witness_generator"
|
||||
cp -r witness-generators/zksign-artifact/include "${BUNDLE_NAME}/zksign/"
|
||||
mv witness-generators/poc-artifact/libwitness_poc.a "${BUNDLE_NAME}/poc/"
|
||||
mv witness-generators/poc-artifact/poc.dat "${BUNDLE_NAME}/poc/witness_generator.dat"
|
||||
|
||||
# Restore execute permissions on witness generators
|
||||
chmod +x "${BUNDLE_NAME}/pol/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/poq/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/zksign/witness_generator"
|
||||
chmod +x "${BUNDLE_NAME}/poc/witness_generator"
|
||||
cp -r witness-generators/poc-artifact/include "${BUNDLE_NAME}/poc/"
|
||||
|
||||
# Copy proving keys and verification keys into each circuit directory
|
||||
cp proving-keys/pol-proving-key/pol.zkey "${BUNDLE_NAME}/pol/proving_key.zkey"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user