Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly include proof producer #8

Merged
merged 112 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
f64ea36
Initial single-thread implementation added.
nkaskov Jul 24, 2023
23c4e43
Blueprint dependency removed. Submodules crypto3, DBMS application, m…
nkaskov Jul 25, 2023
db41d41
Blueprint 102-two-blueprints temporary added until Mina state proof i…
nkaskov Jul 25, 2023
219ab01
Transpiler submodule temporary added to reuse assignment table deseri…
nkaskov Jul 26, 2023
a9e57b8
Prover input changed. Assigner duplicated logic removed. #1
nkaskov Jul 26, 2023
fbf2cb6
Crypto3 submodule updated after zk module update.
nkaskov Jul 26, 2023
d06737b
Usage of deprecated boost::filesystem functionality removed.
nkaskov Jul 26, 2023
7ac73c2
deleted mina-state proof support, blueprint_mc and updated dependencies
g-arakelov Aug 30, 2023
cd5f8c7
Merge pull request #7 from NilFoundation/2-remove-mina-circuit-logic-…
g-arakelov Oct 3, 2023
4fed832
Create README.md
g-arakelov Oct 19, 2023
4aa3479
Update README.md
g-arakelov Oct 19, 2023
e520ed4
Update README.md
g-arakelov Oct 20, 2023
a3d1eff
marshalling update #9
SK0M0R0H Oct 23, 2023
d4d09ec
update prover with new interfaces
SK0M0R0H Oct 23, 2023
f3841b0
Merge pull request #12 from NilFoundation/9-adjustable-placeholder-pa…
SK0M0R0H Nov 10, 2023
fbcf856
dependencies update
SK0M0R0H Nov 10, 2023
7481add
docker: build an image with zkLLVM and proof-generator
NickVolynkin Nov 13, 2023
e006f05
added basic CI
g-arakelov Sep 20, 2023
af1e5bf
ci: build deb always, push on tags
NickVolynkin Nov 15, 2023
4129fd1
Dependency from blueprint and transpiler removed.
nkaskov Nov 15, 2023
5f77258
Lambda value updated from 2 to 9.
nkaskov Nov 15, 2023
56bd34a
release: 0.1.1
NickVolynkin Nov 15, 2023
6fea0f6
deb: get version from VERSION file
NickVolynkin Nov 15, 2023
0083939
docker: bring back the WORKDIR instruction
NickVolynkin Nov 16, 2023
fd6c3b7
Crypto3 updated to master.
nkaskov Dec 8, 2023
c2b2cad
create_fri_params function updated to the new version from the transp…
nkaskov Dec 8, 2023
fd603bd
Columns amount change to the new version from the transpiler
nkaskov Dec 8, 2023
4122dbf
Crypto3 updated to get last version of the Placeholder prover
nkaskov Dec 18, 2023
b80eb7d
Add reusable workflow for proofs generation
x-mass Dec 7, 2023
78790d5
Exit with non-zero code on proof fail
x-mass Dec 14, 2023
83ff25d
Fix linking phase
x-mass Dec 18, 2023
ce08def
Add output artifact name as input
x-mass Dec 18, 2023
bc41526
Leave only Linux
x-mass Dec 18, 2023
af67299
Upload only proofs from a single configuration, fix matrix
x-mass Dec 20, 2023
402e67e
Add consistent testing
x-mass Dec 19, 2023
e4a3ddb
Read circuit/assignment in binary format
Dec 22, 2023
6ba4672
CLI boost options updated. Boost log usage added instead of cout and …
nkaskov Dec 20, 2023
597cd41
Add multithreaded actor
g-arakelov Nov 14, 2023
a69f231
README updated
x-mass Nov 22, 2023
9f4fd45
Support multithreaded actor in workflows
x-mass Nov 24, 2023
823d240
Update submodules to latest master.
x-mass Dec 15, 2023
65a8fb3
Don't skip build workflow on push
x-mass Dec 25, 2023
4320572
CPack added for single-threaded proof-generator.
nkaskov Dec 29, 2023
806542e
Multithreaded proof generator added to the deb package.
nkaskov Dec 30, 2023
c0194a6
Multhreaded version dependencies added to the deb package dependencies.
nkaskov Dec 30, 2023
7379a36
Package versioning updated to be the same with zkLLVM packages.
nkaskov Jan 2, 2024
4ce1825
libfmt-dev added to the deb package dependencies
nkaskov Jan 2, 2024
361f570
Boost_USE_STATIC_LIBS set True by default.
nkaskov Jan 2, 2024
a6914dc
The name of the github release updated.
nkaskov Jan 2, 2024
c39ba89
Setting GIT_EXECUTABLE value in CMake.
martun Jan 3, 2024
114d794
All the files of proof-generator and proof-generator-multithreaded de…
nkaskov Jan 4, 2024
6697949
Binaries for symlinks renamed after the interface generalization.
nkaskov Jan 4, 2024
c3a14ff
README updated with the binary instalation instruction.
nkaskov Jan 5, 2024
f0d9aa4
CPACK_PACKAGING_INSTALL_PREFIX changed to /usr/lib/proof-producer
nkaskov Jan 8, 2024
4bff48c
CMAKE_INSTALL_PREFIX processing added.
nkaskov Jan 9, 2024
0622c17
Fixing all versions of actor prover dependencies, so it will work on …
minstrel1983 Jan 5, 2024
3d50b54
Make fixed versions less strict
x-mass Jan 8, 2024
3051ab0
Fix testing script for multithreaded generator
x-mass Jan 8, 2024
fc81823
Update Boost, move its static linkage to CMake flag
x-mass Jan 10, 2024
eb4c86d
Fixing namespace, updating actor-zk.
martun Jan 10, 2024
24edeb7
Set default Boost version to 1.83.0
x-mass Jan 10, 2024
a252124
Add integration testing with zkLLVM artifacts
x-mass Jan 11, 2024
5cf5d6a
zkLLVM proof2json recursive verifier input creation tool added
nkaskov Jan 11, 2024
5b54d20
Version print added to the proof generators.
nkaskov Jan 11, 2024
3d06d26
Proof loading functions changed to older format
ETatuzova Jan 12, 2024
e32be57
add cutve-type comand line argument to jsonizer
CblPOK-git Jan 16, 2024
1483640
Add curve-type command line argument to proof-generator
x-mass Jan 17, 2024
7efaf16
Fix GH Actions build
x-mass Jan 17, 2024
12d6338
Fix build when recursive checkout takes action
x-mass Jan 30, 2024
b1e3800
Yet another recursive checkout fix to reusable workflow
x-mass Jan 31, 2024
69e432a
Submodules updated #60
ETatuzova Jan 31, 2024
b921ea4
Actor submodules reverted #60
ETatuzova Jan 31, 2024
b5a26ec
Add manual unzip step in testing workflow
x-mass Jan 31, 2024
b1cce74
Permutation size updated #63
ETatuzova Jan 31, 2024
d342464
actor-zk updated #63
ETatuzova Jan 31, 2024
ac6ebad
Actor-zk updated #63
ETatuzova Jan 31, 2024
63e568a
Added comment #63
ETatuzova Jan 31, 2024
dbd9ec2
actor zk updated #63
ETatuzova Feb 1, 2024
0924fe0
Minor fixes#63
ETatuzova Feb 1, 2024
98c69a5
Add --verification-only mode
x-mass Feb 9, 2024
7ed0ff3
Fix release workflow dependencies
x-mass Feb 9, 2024
c0b9a78
Fix CMake configuration in release
x-mass Feb 9, 2024
e90bff9
Fix CMake configuration in release
x-mass Feb 9, 2024
3478db6
Adjust number of Selector columns
Jan 29, 2024
876eba3
LPC batching updated #65
ETatuzova Feb 12, 2024
498f1cf
Refactoring. Add configurable arithmetization params
x-mass Feb 12, 2024
38c73ac
Add clang-format check to PR
x-mass Feb 13, 2024
9916a65
Store .deb package from PR workflow if generation passed
x-mass Feb 13, 2024
0cac135
New actor in proof producer.
martun Feb 14, 2024
eb21fbb
Save preprocessed common data to file. Temp solution
x-mass Feb 15, 2024
8796e9c
Add columns arithmetization param
x-mass Feb 19, 2024
fc4e13f
Add more arithmetization params
martun Feb 19, 2024
6ddb405
Add expand factor option
x-mass Feb 20, 2024
b8a36ab
Remove jsonizer
x-mass Mar 4, 2024
c975db4
Style adjustments
x-mass Feb 22, 2024
d6d8d18
Move columns params from templates to runtime
x-mass Feb 22, 2024
4ddd858
Update crypto3 on the latest master
Mar 18, 2024
6c92fb0
JSON generation added #86
ETatuzova Mar 27, 2024
fe2e4f7
Recursion friendly changes, submodules update (includes Poseidon refa…
ETatuzova Mar 3, 2024
ef8cd91
Disable actor checks
x-mass Apr 20, 2024
580b0a3
Update crypto3, actor to pre-multiprecision-refactor state
x-mass May 31, 2024
60af5f5
Update crypto3, actor. New multiprecision. Update CI Boost to 1.83
x-mass May 31, 2024
f3e985d
Add nix, use it in CI
x-mass Jun 16, 2024
3a45ee1
fix: erase nix-created flags for multithreaded
x-mass Jul 12, 2024
406dcd4
chore: udpate crypto3 libs to latest
x-mass Jul 12, 2024
9928ef4
chore: use new zkLLVM workflow to get artifacts for CI from
x-mass Jul 25, 2024
829b901
Move all files into proof-producer directory
AndreyMlashkin Sep 9, 2024
edca7d7
Merge remote-tracking branch 'proof-producer/migration' into directly…
AndreyMlashkin Sep 10, 2024
f808b77
remove unneded files
AndreyMlashkin Sep 10, 2024
5084122
implement flake for proof-producer
AndreyMlashkin Sep 10, 2024
0ea8e07
correct transpiler cmake
AndreyMlashkin Sep 10, 2024
b3b1772
Implement CI for proof-producer
AndreyMlashkin Sep 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 243 additions & 0 deletions .github/workflows/check-proof-producer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
name: Check Proof producer

on:
workflow_call:

env:
CAA_ARTIFACT_NAME: circuits-and-assignments
TO_ARTIFACT_NAME: transpiler-output
INTEGRATION_TESTING_TARGETS: |
arithmetics_cpp_example
polynomial_cpp_example
poseidon_cpp_example
merkle_tree_poseidon_cpp_example
uint_remainder_cpp
compare_eq_cpp
private_input_cpp
# uint_shift_left
# uint_bit_decomposition
# uint_bit_composition

jobs:
prepare-targets:
name: Prepare targets strings
runs-on: ubuntu-22.04
if: |
always() && !cancelled()
outputs:
evm-targets: ${{ steps.get-targets.outputs.evm-targets }}
prover-targets: ${{ steps.get-targets.outputs.prover-targets }}
steps:
- name: Set targets for integration testing
id: get-targets
run: |
targets_str=$(echo "${{ env.INTEGRATION_TESTING_TARGETS }}" | awk 'NF {print "transpiler_output_" $1}')
echo "evm-targets<<EOF" >> $GITHUB_OUTPUT
echo "${targets_str}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

echo "prover-targets<<EOF" >> $GITHUB_OUTPUT
echo "${{ env.INTEGRATION_TESTING_TARGETS }}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT


get-zkllvm-run:
name: Get zkLLVM run to use artifacts from
if: |
always() && !cancelled()
runs-on: ubuntu-22.04
outputs:
run-id: ${{ steps.get-run-id.outputs.run-id }}
steps:
- name: Get run ID of zkLLVM
id: get-run-id
env:
GH_TOKEN: ${{ github.token }}
run: |
zkllvm_ref="master"
zkllvm_repo="NilFoundation/zkLLVM"

while read -r line; do
echo "$line"
if [[ $line == "${zkllvm_repo}:"* ]]; then
zkllvm_ref=$(echo "$line" | cut -d ' ' -f 2)
break
fi
done <<< "$prs_refs"

if [[ $zkllvm_ref == refs/pull/* ]]; then
echo "Considering reference ${zkllvm_ref} a pr ref"
pr_number=${zkllvm_ref#refs/pull/}
pr_number=${pr_number%/merge}
sha=$(gh api repos/${zkllvm_repo}/pulls/$pr_number --jq '.head.sha')
elif [[ $zkllvm_ref == refs/tags/* ]]; then
echo "Considering reference ${zkllvm_ref} a tag"
tag=${zkllvm_ref#refs/tags/}
sha=$(gh api repos/${zkllvm_repo}/git/ref/tags/$tag --jq '.object.sha')
else
echo "Considering reference ${zkllvm_ref} a branch"
branch=${zkllvm_ref#refs/heads/}
# We can already fetch run_id here, but better fit to common approach with extra query by sha
sha=$(gh api "repos/${zkllvm_repo}/actions/workflows/nix_build_linux.yml/runs?branch=${branch}&status=completed&per_page=1" \
--jq '.workflow_runs[0].head_sha')
fi

echo "Using head sha: ${sha}"
run_id=$(gh api "repos/${zkllvm_repo}/actions/workflows/nix_build_linux.yml/runs?head_sha=${sha}&status=completed&per_page=1" \
--jq '.workflow_runs[0].id')
if [ -z "${run_id}" ]; then
echo no run ID fetched
exit 1
fi
echo "Run ID: ${run_id}"
for artifact in "${{ env.CAA_ARTIFACT_NAME }}" "${{ env.TO_ARTIFACT_NAME }}"; do
# Check if the artifact exists in the run
if ! gh run view ${run_id} --repo ${zkllvm_repo} | grep "$artifact"; then
echo "Artifact '$artifact' not found in run ${run_id}"
exit 1
fi
done
echo "run-id=${run_id}" >> $GITHUB_OUTPUT

build-and-generate-proofs:
name: Build prover, generate proofs for circuits
runs-on: [self-hosted, Linux, X64, aws_autoscaling]
needs:
- get-zkllvm-run
- prepare-targets
if: |
always() && !cancelled() &&
(needs.get-zkllvm-run.result == 'success' || needs.get-zkllvm-run.result == 'skipped') &&
(needs.prepare-targets.result == 'success' || needs.prepare-targets.result == 'skipped')
outputs:
artifact-name: ${{ steps.artifact-name.outputs.merged }}

steps:
# https://github.com/actions/checkout/issues/1552
- name: Clean up after previous checkout
run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*;

- name: Checkout Proof Producer
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Checkout submodules to specified refs
if: inputs.submodules-refs != ''
uses: NilFoundation/ci-cd/actions/[email protected]
with:
paths: |
${{ github.workspace }}/**
!${{ github.workspace }}/
!${{ github.workspace }}/**/.git/**

- name: Run checks
run: nix build -L .?#packages.x86_64-linux.proof-producer

- name: Set usefull strings
id: strings
run: |
echo "artifact-dir=$(realpath ${{ github.workspace }}/../artifacts)" >> $GITHUB_OUTPUT
echo "artifact-dir=$(realpath ${{ github.workspace }}/../artifacts)"

- name: Download circuits and assignments artifact
uses: dawidd6/action-download-artifact@v3
with:
repo: NilFoundation/zkLLVM
name: ${{ env.CAA_ARTIFACT_NAME }}
path: ${{ steps.strings.outputs.artifact-dir }}
run_id: ${{ needs.get-zkllvm-run.outputs.run-id }}
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_unpack: true # It can't unpack such large files (>2Gb for some circuits)

- name: Extract circuits and assignments artifact
working-directory: ${{ steps.strings.outputs.artifact-dir }}
run: |
unzip -o ${{ env.CAA_ARTIFACT_NAME }}.zip

- name: List artifacts
working-directory: ${{ steps.strings.outputs.artifact-dir }}
run: find .

- name: Make proofs for pairs
working-directory: ${{ steps.strings.outputs.artifact-dir }}
run: |
extra_args=""
if [[ "true" == "true" ]]; then
extra_args="--multithreaded "
fi
targets_str=$(echo "${{ needs.prepare-targets.outputs.prover-targets }}" | awk '{$1=$1};1' | sed '/^$/d' | tr '\n' ' ' | sed 's/ $//')
echo "targets from input: ${targets_str}"
${{ github.workspace }}/proof-producer/tests/make_proof_for_pairs.sh --use-nix ${extra_args} ${targets_str}

- name: Download transpiler output artifact
id: download-to-artifact
uses: dawidd6/action-download-artifact@v3
with:
repo: NilFoundation/zkLLVM
name: ${{ env.TO_ARTIFACT_NAME }}
path: ${{ steps.strings.outputs.artifact-dir }}
run_id: ${{ needs.get-zkllvm-run.outputs.run-id }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Merge proofs into transpiler output
working-directory: ${{ steps.strings.outputs.artifact-dir }}
run: |
copy_failed=0
while read dir; do
base_name=${dir#./transpiler_output_}

if [[ -d "$base_name" ]]; then
if ! cp "${base_name}/proof.bin" "${dir}/"; then
# fails if artifact contains dirs targets we didn't produce proofs for
echo "Failed to copy proof.bin to ${dir}" >&2
copy_failed=1
else
echo "proof.bin added to ${dir}"
fi
else
echo "Error: No matching directory found for ${dir}" >&2
fi
done < <(find . -type d -name "transpiler_output_*")

if [ $copy_failed -eq 1 ]; then
echo "One or more copy operations failed." >&2
fi

- name: Set aritfact name
id: artifact-name
run: |
echo "merged=transpiler-output-merged-proofs" >> $GITHUB_OUTPUT

- name: Upload merged artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact-name.outputs.merged }}
path: |
${{ steps.strings.outputs.artifact-dir }}/transpiler_output_*

# TODO: add package derivation to nix, upload its result
# - name: Upload .deb package
# if: matrix.cpp-compiler == 'clang++' && matrix.build-type == 'Release'
# uses: actions/upload-artifact@v4
# with:
# name: proof-producer.deb
# path: |
# ${{ steps.strings.outputs.build-dir }}/proof-producer*.deb


verify-proof-producer-proofs:
name: Verify proof-producer proofs with EVM-placeholder
needs:
- build-and-generate-proofs
- prepare-targets
if: |
always() && !cancelled() &&
(needs.build-and-generate-proofs.result == 'success' || needs.build-and-generate-proofs.result == 'skipped') &&
(needs.prepare-targets.result == 'success' || needs.prepare-targets.result == 'skipped')
uses: NilFoundation/evm-placeholder-verification/.github/workflows/reusable-verify-proofs.yml@2a0ef5fc67e97be8e3c7b59338cf9eecd030c57d
with:
artifact-name: ${{ needs.build-and-generate-proofs.outputs.artifact-name }}
evm-placeholder-verification-ref: 2a0ef5fc67e97be8e3c7b59338cf9eecd030c57d
test-names: ${{ needs.prepare-targets.outputs.evm-targets }}
7 changes: 7 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ jobs:
always() && !cancelled()
secrets: inherit

check-proof-producer:
name: Check Proof Producer
uses: ./.github/workflows/check-proof-producer.yml
if: |
always() && !cancelled()
secrets: inherit

54 changes: 51 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,35 @@
crypto3 = crypto3;
});

proof-producer = (pkgs.callPackage ./proof-producer/proof-producer.nix {
runTests = false;
enableDebug = false;
crypto3 = crypto3;
transpiler = transpiler;
parallel-crypto3 = parallel-crypto3;
});
proof-producer-tests = (pkgs.callPackage ./proof-producer/proof-producer.nix {
runTests = true;
enableDebug = false;
crypto3 = crypto3;
transpiler = transpiler;
parallel-crypto3 = parallel-crypto3;
});
proof-producer-debug-tests = (pkgs.callPackage ./proof-producer/proof-producer.nix {
enableDebug = true;
runTests = true;
crypto3 = crypto3;
transpiler = transpiler;
parallel-crypto3 = parallel-crypto3;
});

# The "all" package will build all packages. Convenient for CI,
# so that "nix build" will check that all packages are correct.
# The packages that have no changes will not be rebuilt, and instead
# fetched from the cache.
all = pkgs.symlinkJoin {
name = "all";
paths = [ crypto3 evm-assigner zkevm-framework transpiler];
paths = [ crypto3 evm-assigner zkevm-framework transpiler proof-producer];
};
default = all;
};
Expand Down Expand Up @@ -167,15 +189,41 @@
crypto3 = crypto3-clang;
});

proof-producer-gcc = (pkgs.callPackage ./proof-producer/proof-producer.nix {
runTests = true;
enableDebug = false;
crypto3 = packages.crypto3;
transpiler = packages.transpiler;
parallel-crypto3 = packages.parallel-crypto3;
});
proof-producer-clang = (pkgs.callPackage ./proof-producer/proof-producer.nix {
stdenv = pkgs.llvmPackages_18.stdenv;
runTests = true;
enableDebug = false;
crypto3 = crypto3-clang;
transpiler = transpiler-clang;
parallel-crypto3 = parallel-crypto3-clang;
});

all-clang = pkgs.symlinkJoin {
name = "all";
paths = [ crypto3-clang parallel-crypto3-clang evm-assigner-clang transpiler-clang ];
paths = [ crypto3-clang parallel-crypto3-clang evm-assigner-clang transpiler-clang proof-producer-clang ];
};
all-gcc = pkgs.symlinkJoin {
name = "all";
paths = [ crypto3-gcc parallel-crypto3-gcc evm-assigner-gcc zkevm-framework-gcc transpiler-gcc ];
paths = [ crypto3-gcc parallel-crypto3-gcc evm-assigner-gcc zkevm-framework-gcc transpiler-gcc proof-producer-gcc ];
};
default = all-gcc;
};
apps = {
single-threaded = {
type = "app";
program = "${self.packages.${system}.proof-producer}/bin/proof-producer-single-threaded";
};
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/proof-producer-multi-threaded";
};
};
}));
}
12 changes: 12 additions & 0 deletions proof-producer/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v18.1.6' # Use the sha / tag you want to point at
hooks:
- id: clang-format
Loading
Loading