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

ci: nightly proving key generation workflow #804

Merged
merged 4 commits into from
Nov 21, 2023
Merged

ci: nightly proving key generation workflow #804

merged 4 commits into from
Nov 21, 2023

Conversation

baumstern
Copy link
Member

@baumstern baumstern commented Nov 2, 2023

This PR introduces a nightly proving key generation workflow. It will help us maintain the ability to generate the proving key and ensure that it remains functional even if no new changes are made to the circuits. It provides an additional layer of assurance for the codebase and allows others to build their own proving keys without any issues.

@baumstern baumstern force-pushed the pbuild branch 4 times, most recently from 86790ce to 52d25ac Compare November 3, 2023 07:50
@samajammin
Copy link
Member

@baumstern I assume this is aimed to solve #803 ?

Moving forward, please provide PR descriptions & reference the relevant issue

@samajammin
Copy link
Member

FYI @baumstern looks like this PR includes a bunch of miscellaneous commits. Why? Perhaps you didn't branch of the latest dev?

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should use Node 18 now, correct? See #775

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for unit tests. But e2e test has problem with Node 18. See #775 (comment)

@baumstern baumstern force-pushed the pbuild branch 3 times, most recently from 9ad667e to d4b2703 Compare November 13, 2023 15:32
@baumstern baumstern force-pushed the pbuild branch 2 times, most recently from 19b0dd4 to 8c28133 Compare November 20, 2023 12:46
@baumstern baumstern linked an issue Nov 20, 2023 that may be closed by this pull request
    - Test generated proving key for correctness
    - Run tests for each sub-package:
      - maci-circuits
      - maci-contracts
      - maci-core
      - maci-crypto
      - maci-domainobjs
@baumstern baumstern marked this pull request as ready for review November 20, 2023 15:56
@baumstern
Copy link
Member Author

FYI @baumstern looks like this PR includes a bunch of miscellaneous commits. Why? Perhaps you didn't branch of the latest dev?

The reason for this is that the PR was created from the previous default branch, which was the master. GitHub Actions schedule triggers only work on the default branch. But the default branch has now been changed to the dev so things are sorted out well now.

@baumstern baumstern changed the title ci: build proving key nightly ci: nightly proving key generation workflow Nov 20, 2023
@@ -2,28 +2,26 @@ name: Circuit

on:
push:
branches: [ master, audit, dev ]
branches: [ master, dev ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch there



jobs:
generate-proving-key:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit: would call it "generate-proving-keys" as it's > 1 key

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reflected in 20676ac

libgmp-dev \
libsodium-dev \
nasm \
nlohmann-json3-dev
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nlohmann-json3-dev is not needed anymore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that removing nlohmann-json3-dev leads to a compilation failure. Here's the error we encounter:

main.cpp:9:10: fatal error: nlohmann/json.hpp: No such file or directory
    9 | #include <nlohmann/json.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

Copy link
Collaborator

@ctrlc03 ctrlc03 Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm it'd be nice to do some checks on a fresh VM. Looks like rapidnsark does not need this, but zkey-manager does, however where does it use it? is it here: https://github.com/privacy-scaling-explorations/zkey-manager/blob/master/ts/compile.ts#L102?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's needed when computing witness with c++: https://docs.circom.io/getting-started/computing-the-witness/


# To prevent `npm install` failure of circuit package,
# it has to checkout manually because version of `circomlib` has pinned to a specific commit
- name: Checkout circomlib
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come this is not something we do while working locally but it's needed here?

Copy link
Member Author

@baumstern baumstern Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The step to manually checkout circomlib was introduced in April 2022, as part of a pull request (see PR #403). The reason for this step was due to a specific requirement at the time. maci-circuits imports circomlib and pins it to a specific commit (as indicated here in the package.json). Back then, the direct pulling of this dependency with a pinned commit like https://github.com/weijiekoh/circomlib#ac85e82c1914d47789e2032fb11ceb2cfdd38a2b failed.

This issue could have been related to the behavior of npm.js or changes in GitHub's security policy, as outlined in this GitHub blog post or specific to the GitHub Actions Runner environment.

However, I've re-triggered the CI run without this manual checkout step and it worked smoothly, indicating that this step may no longer be necessary. It seems that the underlying issue has been resolved, either through updates to npm.js or GitHub's handling of dependencies.


# # To prevent `npm install` failure of circuit package,
# # it has to checkout manually because version of `circomlib` has pinned to a specific commit
# - name: Checkout circomlib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this now commented out?

If not needed, can we delete this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 20676ac

@baumstern baumstern requested a review from ctrlc03 November 21, 2023 15:00
Copy link
Collaborator

@ctrlc03 ctrlc03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@baumstern baumstern merged commit 1148263 into dev Nov 21, 2023
8 checks passed
@baumstern baumstern deleted the pbuild branch November 21, 2023 17:07
@baumstern baumstern self-assigned this Nov 27, 2023
ctrlc03 pushed a commit that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up nightly build for proving key
3 participants