-
Notifications
You must be signed in to change notification settings - Fork 265
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
feat: bb.js tests of ClientIVC #9412
Merged
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
cab6cbb
Squash
codygunton da8a13a
Unfortunately this does not detect any issue
codygunton 4a12e5a
This makes the wasm test pass
codygunton 8f8f371
Copy to browser tests
codygunton 637c214
Use as libary
codygunton 51441ff
This works (but no logs still?)
codygunton 8b55e07
Adjust logging to be more useful
codygunton 0bf4a58
Merge remote-tracking branch 'origin/master' into cg/browser-civc
codygunton 5368fb4
Fix compilation
codygunton 7f89016
Reuse code and make more complex browser test
codygunton 4d15a4f
Make button app
codygunton 291f521
Try reverting + loader
codygunton 982c12a
Revert-ish yarn.lock
codygunton 8ae873a
Revert headless test
codygunton 19eef28
Actually who cares just revert all of this
codygunton cf314d3
Let's just remember we can use raw-loader
codygunton d6785af
more cleanup
codygunton 5fcae5f
Revert a bit more
codygunton 762996d
Try to revert huge yarn.lock change
codygunton 0de79bb
More diff tidying
codygunton ae2c36d
Make sure test still pass
codygunton f866895
Merge remote-tracking branch 'origin/master' into cg/browser-civc
codygunton d4b3ecd
Do some more yarn
codygunton d61dc26
Lock update..?
codygunton 24c1fd0
Fix formatting
codygunton 3931cc1
Again??
codygunton 104ead0
Reinstate missing flow
codygunton 1990e56
Holy crap
codygunton 18982a0
Fix Grumpkin CRS dl
codygunton 6969d3a
Revert accidental change to run_acir_tests
codygunton d684f74
How do I still have formatting to fix?
codygunton 551b01c
Revert to non-asserts build
codygunton a974756
How yet again
codygunton 8771a9f
Try adding this dep that didn't break the build?
codygunton fc9c912
Had to update lock file
codygunton 3422e30
Delete unused (redundant with benchmarking script).
codygunton 66ced97
Reinstate use of options
codygunton b4e2245
Try this to build playwright
codygunton 1bdeec0
Try extra build step after bootstrap
codygunton afcbdb4
Merge branch 'master' into cg/browser-civc
codygunton 537ebb2
Merge remote-tracking branch 'origin/master' into cg/browser-civc
codygunton 7ed8b0c
Make it use a real browser and fix CRS issue
codygunton 71d33ba
Local package.json
codygunton 6426f87
Rename script
codygunton cd3b72c
Continue script rename & try chmod with &&
codygunton f7d81d9
Merge branch 'master' into cg/browser-civc
codygunton 556247f
Update local package.json
codygunton f90a4b4
Merge branch 'master' into cg/browser-civc
codygunton 54b3993
Revert "chore: more descriptive slack alert (#9739)"
ludamad f321564
Merge remote-tracking branch 'origin/revert-9739-ad/ci/yaml' into cg/…
codygunton b4bab19
Merge remote-tracking branch 'origin/master' into cg/browser-civc
codygunton d495f5b
Only run the WASM tests
codygunton 13577a0
Merge remote-tracking branch 'origin/master' into cg/browser-civc
codygunton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -948,6 +948,7 @@ jobs: | |
merge-check: | ||
runs-on: ubuntu-20.04 | ||
needs: | ||
# must be kept in sync with rerun-check | ||
- setup | ||
- configure | ||
- build | ||
|
@@ -985,30 +986,15 @@ jobs: | |
- boxes-test | ||
# - protocol-circuits-gates-report # non-blocking | ||
if: always() | ||
outputs: | ||
failure: ${{ steps.set_failed_jobs.outputs.failure }} | ||
failed_jobs: ${{ steps.set_failed_jobs.outputs.failed_jobs }} | ||
steps: | ||
- name: Check for Failures and Set Output | ||
id: set_failed_jobs | ||
env: | ||
# Collect needed jobs | ||
NEEDS_JOBS_JSON: ${{ toJson(needs) }} | ||
run: | | ||
echo "Processing failed jobs..." | ||
failed_jobs=$(echo "$NEEDS_JOBS_JSON" | jq -r 'to_entries[] | select(.value.result == "failure") | .key' | paste -sd "," -) | ||
echo "$failed_jobs" > .failed | ||
echo "failure=${{contains(needs.*.result, 'failure')}}" >> $GITHUB_OUTPUT | ||
echo "failed_jobs=$failed_jobs" >> $GITHUB_OUTPUT | ||
|
||
- name: Report overall success (non-draft) | ||
if: github.event.pull_request.draft == false | ||
env: | ||
# We treat any skipped or failing jobs as a failure for the workflow as a whole. | ||
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | ||
run: | | ||
if [[ $FAIL == true ]]; then | ||
echo "Jobs failed: $(cat .failed), merging not allowed." | ||
echo "At least one job failed (or cancelled), merging not allowed." | ||
exit 1 | ||
else | ||
echo "All jobs succeeded, merge allowed." | ||
|
@@ -1023,44 +1009,69 @@ jobs: | |
permissions: | ||
actions: write | ||
needs: | ||
- merge-check | ||
# must be kept in sync with merge-check | ||
- setup | ||
- configure | ||
- build | ||
- e2e | ||
# - bench-e2e # non-blocking | ||
# - acir-bench # non-blocking | ||
# - bench-summary # non-blocking | ||
- bb-gcc | ||
- bb-native-tests | ||
- bb-js-test | ||
- noir-build-acir-tests | ||
- bb-acir-tests-bb | ||
- bb-acir-tests-bb-ultra-plonk | ||
- bb-acir-tests-bb-ultra-honk | ||
- bb-acir-tests-bb-mega-honk | ||
- bb-acir-tests-sol | ||
- bb-acir-tests-sol-honk | ||
- bb-acir-tests-bb-js | ||
- noir-format | ||
- noir-test | ||
- noir-examples | ||
- noir-packages-test | ||
- noir-projects | ||
- avm-format | ||
- yarn-project-formatting | ||
- yarn-project-test | ||
- prover-client-test | ||
- network-test | ||
- kind-network-test | ||
- l1-contracts-test | ||
- docs-preview | ||
# - bb-bench # non-blocking | ||
- boxes | ||
- boxes-test | ||
# - protocol-circuits-gates-report # non-blocking | ||
if: github.event.pull_request.draft == false && !cancelled() | ||
steps: | ||
- name: Check for Rerun | ||
env: | ||
# We treat any skipped or failing jobs as a failure for the workflow as a whole. | ||
HAD_FAILURE: ${{ contains(needs.*.result, 'failure') }} | ||
GH_REPO: ${{ github.repository }} | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
if [[ ${{ needs.merge-check.outputs.failure }} == true ]] && [[ $RUN_ATTEMPT -lt 2 ]] ; then | ||
if [[ $HAD_FAILURE == true ]] && [[ $RUN_ATTEMPT -lt 2 ]] ; then | ||
echo "Retrying first workflow failure. This is a stop-gap until things are more stable." | ||
gh workflow run rerun.yml -F run_id=${{ github.run_id }} | ||
fi | ||
|
||
# NOTE: we only notify failures after a rerun has occurred | ||
notify: | ||
runs-on: ubuntu-20.04 | ||
needs: | ||
- merge-check | ||
runs-on: ubuntu-20.04 | ||
if: github.event.pull_request.draft == false && github.ref == 'refs/heads/master' && failure() && github.run_attempt >= 2 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get Authors of Recent Commit | ||
id: get_authors | ||
run: | | ||
git fetch --depth=1 origin ${{ github.sha }} | ||
authors=$(git log -1 --pretty=format:'%an <%ae>' ${{ github.sha }}) | ||
echo "authors=${authors}" >> $GITHUB_OUTPUT | ||
|
||
- name: Send notification to aztec3-ci channel if workflow failed on master | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"text": "Master Github Actions failure", | ||
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", | ||
"authors": "${{ steps.get_authors.outputs.authors }}", | ||
"failed_jobs": "${{ needs.merge-check.outputs.failed_jobs }}" | ||
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WORKFLOW_TRIGGER_URL2 }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WORKFLOW_TRIGGER_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
#include "barretenberg/dsl/acir_format/acir_format.hpp" | ||
#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" | ||
#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" | ||
#include "barretenberg/serialize/msgpack.hpp" | ||
#include "barretenberg/srs/global_crs.hpp" | ||
#include <cstdint> | ||
#include <memory> | ||
|
@@ -218,6 +219,60 @@ WASM_EXPORT void acir_serialize_verification_key_into_fields(in_ptr acir_compose | |
write(out_key_hash, vk_hash); | ||
} | ||
|
||
WASM_EXPORT void acir_prove_and_verify_aztec_client(uint8_t const* acir_stack, | ||
uint8_t const* witness_stack, | ||
bool* verified) | ||
{ | ||
using Program = acir_format::AcirProgram; | ||
|
||
std::vector<std::vector<uint8_t>> witnesses = from_buffer<std::vector<std::vector<uint8_t>>>(witness_stack); | ||
std::vector<std::vector<uint8_t>> acirs = from_buffer<std::vector<std::vector<uint8_t>>>(acir_stack); | ||
std::vector<Program> folding_stack; | ||
|
||
for (auto [bincode, wit] : zip_view(acirs, witnesses)) { | ||
acir_format::WitnessVector witness = acir_format::witness_buf_to_witness_data(wit); | ||
acir_format::AcirFormat constraints = | ||
acir_format::circuit_buf_to_acir_format(bincode, /*honk_recursion=*/false); | ||
folding_stack.push_back(Program{ constraints, witness }); | ||
} | ||
// TODO(#7371) dedupe this with the rest of the similar code | ||
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1101): remove use of auto_verify_mode | ||
ClientIVC ivc; | ||
ivc.auto_verify_mode = true; | ||
ivc.trace_structure = TraceStructure::E2E_FULL_TEST; | ||
|
||
// Accumulate the entire program stack into the IVC | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just carrying along this todo bc this second was basically a copy and paste from main.cpp. |
||
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1116): remove manual setting of is_kernel once databus | ||
// has been integrated into noir kernel programs | ||
bool is_kernel = false; | ||
auto start = std::chrono::steady_clock::now(); | ||
for (Program& program : folding_stack) { | ||
// Construct a bberg circuit from the acir representation then accumulate it into the IVC | ||
vinfo("constructing circuit..."); | ||
auto circuit = acir_format::create_circuit<MegaCircuitBuilder>( | ||
program.constraints, false, 0, program.witness, false, ivc.goblin.op_queue); | ||
|
||
// Set the internal is_kernel flag based on the local mechanism only if it has not already been set to true | ||
if (!circuit.databus_propagation_data.is_kernel) { | ||
circuit.databus_propagation_data.is_kernel = is_kernel; | ||
} | ||
is_kernel = !is_kernel; | ||
|
||
vinfo("done constructing circuit. calling ivc.accumulate..."); | ||
ivc.accumulate(circuit); | ||
vinfo("done accumulating."); | ||
} | ||
auto end = std::chrono::steady_clock::now(); | ||
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); | ||
vinfo("time to construct and accumulate all circuits: ", diff); | ||
|
||
vinfo("calling ivc.prove_and_verify..."); | ||
bool result = ivc.prove_and_verify(); | ||
info("verified?: ", result); | ||
|
||
*verified = result; | ||
} | ||
|
||
WASM_EXPORT void acir_prove_ultra_honk(uint8_t const* acir_vec, | ||
bool const* recursive, | ||
uint8_t const* witness_vec, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added asserts build for wasm, much faster to build than dbg. Considered making it the default but idk, might affect performance if we use heavy asserts.