Skip to content

Commit

Permalink
Merge branch 'master' into arv/test_within_unconstrained
Browse files Browse the repository at this point in the history
  • Loading branch information
sirasistant authored May 23, 2024
2 parents edf891d + 7dfc369 commit c9e97b6
Show file tree
Hide file tree
Showing 11 changed files with 1,147 additions and 637 deletions.
52 changes: 43 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ jobs:
concurrency_key: boxes-${{ github.event.pull_request.user.login || github.actor }}-build
- name: Build
working-directory: ./boxes
timeout-minutes: 10
timeout-minutes: 20
run: earthly-ci +export-boxes

boxes-test:
Expand Down Expand Up @@ -531,9 +531,8 @@ jobs:

merge-check:
runs-on: ubuntu-latest
permissions:
actions: write
needs:
# Must be in sync with rerun-check
- setup
# - bench-e2e # does not block merge
# - bench-summary # does not block merge
Expand Down Expand Up @@ -561,21 +560,56 @@ jobs:
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') || contains(needs.*.result, 'skipped') }}
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
if [[ $FAIL == true ]]; then
echo "At least one job failed (or skipped/cancelled), merging not allowed."
if [[ $RUN_ATTEMPT -lt 2 ]] && [[ "${{ contains(needs.*.result, 'failure') }}" == true ]] ; 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
exit 1
else
echo "All jobs succeeded, merge allowed."
exit 0
fi
rerun-check:
runs-on: ubuntu-latest
permissions:
actions: write
needs:
# Must be in sync with merge-check
- setup
# - bench-e2e # does not block merge
# - bench-summary # does not block merge
- e2e
- acir-bench
- bb-bench
- bb-gcc
- bb-js-test
- bb-native-tests
- yarn-project-formatting
- yarn-project-test
- prover-client-test
- bb-acir-tests-bb-js
- bb-acir-tests-bb
- bb-acir-tests-sol
- noir-test
- noir-projects
- l1-contracts-test
- noir-packages-test
- docs-preview
# - protocol-circuit-gates-report # does not block merge
if: ${{ !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 [[ $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
notify:
needs:
- merge-check
Expand Down
1 change: 1 addition & 0 deletions barretenberg/cpp/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ test:
COPY --dir +test-binaries/build build
FROM +preset-release-assert-test
COPY --dir ./srs_db/+build/. srs_db
COPY ../../noir/+build-acir-tests/ /usr/src/acir_tests/acir_tests/
# limit hardware concurrency, if provided
IF [ "$HARDWARE_CONCURRENCY" != "" ]
ENV HARDWARE_CONCURRENCY=$hardware_concurrency
Expand Down
13 changes: 5 additions & 8 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,15 @@ template <IsUltraFlavor Flavor> bool proveAndVerifyHonk(const std::string& bytec
template <IsUltraFlavor Flavor>
bool proveAndVerifyHonkProgram(const std::string& bytecodePath, const std::string& witnessPath)
{
auto constraint_systems = get_constraint_systems(bytecodePath);
auto witness_stack = get_witness_stack(witnessPath);
auto program_stack = acir_format::get_acir_program_stack(bytecodePath, witnessPath);

while (!witness_stack.empty()) {
auto witness_stack_item = witness_stack.back();
auto witness = witness_stack_item.second;
auto constraint_system = constraint_systems[witness_stack_item.first];
while (!program_stack.empty()) {
auto stack_item = program_stack.back();

if (!proveAndVerifyHonkAcirFormat<Flavor>(constraint_system, witness)) {
if (!proveAndVerifyHonkAcirFormat<Flavor>(stack_item.constraints, stack_item.witness)) {
return false;
}
witness_stack.pop_back();
program_stack.pop_back();
}
return true;
}
Expand Down
30 changes: 30 additions & 0 deletions barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,36 @@ struct AcirFormat {
using WitnessVector = std::vector<fr, ContainerSlabAllocator<fr>>;
using WitnessVectorStack = std::vector<std::pair<uint32_t, WitnessVector>>;

struct AcirProgram {
AcirFormat constraints;
WitnessVector witness;
};

/**
* @brief Storage for constaint_systems/witnesses for a stack of acir programs
* @details In general the number of items in the witness stack will be equal or greater than the number of constraint
* systems because the program may consist of multiple calls to the same function.
*
*/
struct AcirProgramStack {
std::vector<AcirFormat> constraint_systems;
WitnessVectorStack witness_stack;

size_t size() const { return witness_stack.size(); }
bool empty() const { return witness_stack.empty(); }

AcirProgram back()
{
auto witness_stack_item = witness_stack.back();
auto witness = witness_stack_item.second;
auto constraint_system = constraint_systems[witness_stack_item.first];

return { constraint_system, witness };
}

void pop_back() { witness_stack.pop_back(); }
};

template <typename Builder = UltraCircuitBuilder>
Builder create_circuit(const AcirFormat& constraint_system,
size_t size_hint = 0,
Expand Down
Loading

0 comments on commit c9e97b6

Please sign in to comment.