diff --git a/.github/workflows/vm_full_tests.yml b/.github/workflows/vm_full_tests.yml new file mode 100644 index 000000000000..a831a5b8c70a --- /dev/null +++ b/.github/workflows/vm_full_tests.yml @@ -0,0 +1,63 @@ +name: AVM Full Tests + +on: + push: #TODO: REMOVE BEFOre MERGING + schedule: + - cron: "15 4 * * 1-5" # Monday to Friday at 4:15 AM UTC + workflow_dispatch: + inputs: + username: + description: 'Username (optional)' + required: false + action: + description: "Default to 'start'" + required: false + default: 'start' + inputs: {} + +concurrency: + # force parallelism in master + group: avm-full-tests-${{ github.ref }} + cancel-in-progress: true + +env: + DOCKERHUB_PASSWORD: "${{ secrets.DOCKERHUB_PASSWORD }}" + RUN_ID: ${{ github.run_id }} + RUN_ATTEMPT: ${{ github.run_attempt }} + USERNAME: ${{ github.event.pull_request.user.login || github.actor }} + GITHUB_TOKEN: ${{ github.token }} + GH_SELF_HOSTED_RUNNER_TOKEN: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }} + GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }} + # kludge until we move away from runners + WAIT_FOR_RUNNERS: false + +jobs: + setup: + uses: ./.github/workflows/setup-runner.yml + with: + username: ${{ github.event.pull_request.user.login || github.actor }} + runner_type: builder-x86 + secrets: inherit + + # barretenberg (prover) native and AVM (public VM) tests + # only ran on x86 for resource reasons (memory intensive) + avm-full-tests: + needs: [setup] + runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 + #if: ${{ needs.changes.outputs.barretenberg-cpp == 'true' }} + steps: + - uses: actions/checkout@v4 + with: { ref: "${{ env.GIT_COMMIT }}" } + # Only allow one memory-hunger prover test to use this runner + - uses: ./.github/ci-setup-action + with: + # must be globally unique for build x runner + concurrency_key: avm-full-tests-x86 + - name: "AVM Full Tests" + working-directory: ./barretenberg/cpp/ + timeout-minutes: 60 + # limit our parallelism to half our cores + run: earthly-ci --no-output +vm-full-test --hardware_concurrency=64 diff --git a/barretenberg/cpp/Earthfile b/barretenberg/cpp/Earthfile index 831eb535d83b..6e6df6244e6a 100644 --- a/barretenberg/cpp/Earthfile +++ b/barretenberg/cpp/Earthfile @@ -247,6 +247,23 @@ test: END RUN cd build && GTEST_COLOR=1 ctest -j$(nproc) --output-on-failure +vm-full-test: + ARG hardware_concurrency="" + # prefetch + BUILD +test-binaries + BUILD +preset-release-assert-test + BUILD +test-clang-format + BUILD ./srs_db/+build # prefetch + FROM +source + COPY --dir +test-binaries/build build + FROM +preset-release-assert-test + COPY --dir ./srs_db/+build/. srs_db + # limit hardware concurrency, if provided + IF [ "$HARDWARE_CONCURRENCY" != "" ] + ENV HARDWARE_CONCURRENCY=$hardware_concurrency + END + RUN cd build && GTEST_COLOR=1 AVM_TESTS_ENABLE_PROVING=1 ctest -j4 --test-dir src/barretenberg/vm --output-on-failure + build: BUILD +preset-wasm BUILD +preset-wasm-threads diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp index 40dde3ae6e98..74659b44262a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp @@ -15,9 +15,8 @@ namespace bb::avm_trace { using Flavor = bb::AvmFlavor; using FF = Flavor::FF; -} // namespace bb::avm_trace - -namespace bb::avm_trace { +// To toggle all relevant unit tests with proving, set the env variable "AVM_TESTS_ENABLE_PROVING". +static const bool ENABLE_PROVING = std::getenv("AVM_TESTS_ENABLE_PROVING") != nullptr; // There are 4 public input columns, 1 for context inputs, and 3 for emitting side effects using VmPublicInputs = std::tuple, // Input: Kernel context inputs diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp index aa2ff3c9900a..1b5b3f0b8e46 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp @@ -33,7 +33,7 @@ class AvmTraceBuilder { ExecutionHints execution_hints = {}, uint32_t side_effect_counter = 0); - std::vector finalize(uint32_t min_trace_size = 0, bool range_check_required = false); + std::vector finalize(uint32_t min_trace_size = 0, bool range_check_required = ENABLE_PROVING); void reset(); uint32_t getPc() const { return pc; } diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp index 6c8aa4fd0689..cd7c010b94b6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp @@ -21,16 +21,13 @@ using ThreeOpParam = std::array; using ThreeOpParamRow = std::tuple; using VmPublicInputs = bb::avm_trace::VmPublicInputs; -// To toggle all relevant unit tests with proving, set the env variable "AVM_TESTS_ENABLE_PROVING". -static const bool ENABLE_PROVING = std::getenv("AVM_TESTS_ENABLE_PROVING") != nullptr; - // If the test is expecting a relation to fail, then use validate_trace_check_circuit. // Otherwise, use validate_trace with a single argument. If the proving needs to be // enabled all the time in a given test, use validate_trace with setting with_proof = true. void validate_trace_check_circuit(std::vector&& trace, VmPublicInputs public_inputs = {}); void validate_trace(std::vector&& trace, VmPublicInputs const& public_inputs = {}, - bool with_proof = ENABLE_PROVING); + bool with_proof = bb::avm_trace::ENABLE_PROVING); void mutate_ic_in_trace(std::vector& trace, std::function&& selectRow, FF const& newValue,