Skip to content

Commit

Permalink
Merge branch 'master' into is/bigfield_fixes_from_3_venodors
Browse files Browse the repository at this point in the history
  • Loading branch information
Rumata888 authored Oct 31, 2024
2 parents a695988 + 737c573 commit a728268
Show file tree
Hide file tree
Showing 176 changed files with 2,383 additions and 1,162 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/bb-msan.yml

This file was deleted.

98 changes: 98 additions & 0 deletions .github/workflows/bb-sanitizers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Checks bb (barretenberg prover library) prover with sanitizers
# Unlike most jobs uses free 4 core github runners of which we have lots of capacity (of total 1000 concurrency).
name: BB MSAN
on:
push:
branches:
- master
- "*/bb-sanitizers*"
pull_request:
types: [opened, synchronize, reopened, labeled]
paths:
- 'barretenberg/**'
workflow_dispatch:
inputs: {}

concurrency:
# force parallelism in master
group: ci-${{ github.ref_name == 'master' && github.run_id || github.ref_name }}
cancel-in-progress: true
jobs:
# acts as prover performance baseline
bb-baseline:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'bb-msan-check')
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "Barretenberg Baseline Performance Check"
run: earthly --no-cache ./barretenberg/cpp/+preset-check --preset=clang16

# memory sanitzer for prover
bb-msan-check:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'bb-msan-check')
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "Barretenberg Prover MSAN Check"

run: earthly --no-cache ./barretenberg/cpp/+preset-msan-check || true

# address sanitzer for prover
bb-asan-check:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'bb-asan-check')
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "Barretenberg Prover ASAN Check"
timeout-minutes: 720 # 12 hour timeout (proving)
run: earthly --no-cache ./barretenberg/cpp/+preset-check --preset=asan

# address sanitzer for prover
bb-tsan-check:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'bb-tsan-check')
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "Barretenberg Prover TSAN Check"
timeout-minutes: 720 # 12 hour timeout (proving)
run: earthly --no-cache ./barretenberg/cpp/+preset-check --preset=tsan || true

# undefined behavior sanitzer for prover
bb-ubsan-check:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'bb-ubsan-check')
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "Barretenberg Prover TSAN Check"
timeout-minutes: 720 # 12 hour timeout (proving)
run: earthly --no-cache ./barretenberg/cpp/+preset-check --preset=ubsan
1 change: 0 additions & 1 deletion .github/workflows/publish-aztec-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- master
- "*/release-master*"
- ludamad-patch-2
workflow_dispatch:
inputs:
tag:
Expand Down
25 changes: 25 additions & 0 deletions Dockerfile.end-to-end.fast
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use an ARG to define the architecture, defaulting to amd64
ARG ARCH=amd64
# aztec must be built from Dockerfile.fast
FROM aztecprotocol/aztec AS aztec
FROM aztecprotocol/build:1.0-${ARCH}

# Install additional dependencies
RUN apt-get update && apt-get install -y software-properties-common \
&& add-apt-repository ppa:xtradeb/apps -y && apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=$(dpkg --print-architecture)] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt update && apt install -y curl chromium netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*

ENV CHROME_BIN="/usr/bin/chromium"
ENV PATH=/opt/foundry/bin:$PATH
ENV HARDWARE_CONCURRENCY=""
ENV FAKE_PROOFS=""
ENV PROVER_AGENT_CONCURRENCY=8

COPY --from=aztec /usr/src/ /usr/src/
WORKDIR /usr/src/yarn-project/end-to-end

ENTRYPOINT ["yarn", "test"]
66 changes: 25 additions & 41 deletions Dockerfile.fast
Original file line number Diff line number Diff line change
Expand Up @@ -20,99 +20,83 @@ RUN git init -b master \
&& git config user.email '[email protected]'

# ---------- EXTRACT BUILD-SYSTEM ----------
COPY build-system.tar.gz .
RUN tar -xzf build-system.tar.gz \
&& rm build-system.tar.gz && git add . \
COPY build-system build-system
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null

# ---------- BUILD BARRETENBERG ----------
COPY barretenberg.tar.gz .
RUN tar -xzf barretenberg.tar.gz \
&& rm barretenberg.tar.gz && git add . \
COPY barretenberg barretenberg
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null

# Bootstrap cache for barretenberg/cpp
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
cd barretenberg/cpp \
bash -c 'cd barretenberg \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh \
&& echo "barretenberg/cpp: Success"

# Bootstrap cache for barretenberg/ts
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
cd barretenberg/ts \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh \
&& echo "barretenberg/ts: Success"
./bootstrap_cache.sh' \
&& echo "barretenberg: Success"

# ---------- BUILD NOIR ----------
COPY noir.tar.gz .
RUN tar -xzf noir.tar.gz \
&& rm noir.tar.gz && git add . \
ADD noir noir
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null

# Bootstrap cache for Noir
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
cd noir \
bash -c 'cd noir \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh \
./bootstrap_cache.sh' \
&& echo "noir: Success"

# ---------- BUILD L1 CONTRACTS ----------
COPY l1-contracts.tar.gz .
RUN tar -xzf l1-contracts.tar.gz \
&& rm l1-contracts.tar.gz && git add . \
ADD l1-contracts l1-contracts
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null

# Bootstrap cache for L1 Contracts
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
cd l1-contracts \
bash -c 'cd l1-contracts \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh \
./bootstrap_cache.sh' \
&& echo "l1-contracts: Success"

# ---------- BUILD AVM TRANSPILER ----------
COPY avm-transpiler.tar.gz .
RUN tar -xzf avm-transpiler.tar.gz \
&& rm avm-transpiler.tar.gz && git add . \
ADD avm-transpiler avm-transpiler
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null

# Bootstrap cache for AVM Transpiler
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
cd avm-transpiler \
bash -c 'cd avm-transpiler \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh \
./bootstrap_cache.sh' \
&& echo "avm-transpiler: Success"

# ---------- BUILD NOIR PROJECTS ----------
COPY noir-projects.tar.gz .
RUN tar -xzf noir-projects.tar.gz \
&& rm noir-projects.tar.gz && git add . \
ADD noir-projects noir-projects
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null

# Bootstrap cache for Noir Projects
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
cd noir-projects \
bash -c 'cd noir-projects \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh \
./bootstrap_cache.sh' \
&& echo "noir-projects: Success"

# ---------- BUILD YARN PROJECT ----------
COPY yarn-project.tar.gz .
RUN tar -xzf yarn-project.tar.gz \
&& rm yarn-project.tar.gz && git add . \
ADD yarn-project yarn-project
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null

# Build yarn-project directly (no cache script)
Expand Down
8 changes: 4 additions & 4 deletions avm-transpiler/src/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub enum AvmOpcode {
RETURNDATASIZE,
RETURNDATACOPY,
// Control flow
JUMP_16,
JUMPI_16,
JUMP_32,
JUMPI_32,
INTERNALCALL,
INTERNALRETURN,
// Memory
Expand Down Expand Up @@ -130,8 +130,8 @@ impl AvmOpcode {

// Machine State
// Machine State - Internal Control Flow
AvmOpcode::JUMP_16 => "JUMP_16",
AvmOpcode::JUMPI_16 => "JUMPI_16",
AvmOpcode::JUMP_32 => "JUMP_32",
AvmOpcode::JUMPI_32 => "JUMPI_32",
AvmOpcode::INTERNALCALL => "INTERNALCALL",
AvmOpcode::INTERNALRETURN => "INTERNALRETURN",
// Machine State - Memory
Expand Down
10 changes: 5 additions & 5 deletions avm-transpiler/src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,20 @@ pub fn brillig_to_avm(
BrilligOpcode::Jump { location } => {
let avm_loc = brillig_pcs_to_avm_pcs[*location];
avm_instrs.push(AvmInstruction {
opcode: AvmOpcode::JUMP_16,
operands: vec![make_operand(16, &avm_loc)],
opcode: AvmOpcode::JUMP_32,
operands: vec![make_operand(32, &avm_loc)],
..Default::default()
});
}
BrilligOpcode::JumpIf { condition, location } => {
let avm_loc = brillig_pcs_to_avm_pcs[*location];
avm_instrs.push(AvmInstruction {
opcode: AvmOpcode::JUMPI_16,
opcode: AvmOpcode::JUMPI_32,
indirect: Some(
AddressingModeBuilder::default().direct_operand(condition).build(),
),
operands: vec![
make_operand(16, &avm_loc),
make_operand(32, &avm_loc),
make_operand(16, &condition.to_usize()),
],
..Default::default()
Expand Down Expand Up @@ -298,7 +298,7 @@ pub fn brillig_to_avm(
let avm_loc = brillig_pcs_to_avm_pcs[*location];
avm_instrs.push(AvmInstruction {
opcode: AvmOpcode::INTERNALCALL,
operands: vec![AvmOperand::U16 { value: avm_loc as u16 }],
operands: vec![AvmOperand::U32 { value: avm_loc as u32 }],
..Default::default()
});
}
Expand Down
4 changes: 2 additions & 2 deletions barretenberg/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/AztecProtocol/barretenberg
branch = master
commit = 8b4fa8cbcb9e3bf94962569aa3f9857fe8452a7a
parent = 9d66c1abca1af9ddb0715627fad87c2efc612a1d
commit = b7f1c6ad51722d30e60f93035d675098d69da8eb
parent = 39cda86c3576c5cb94a7beb123b875a2ba37c26b
method = merge
cmdver = 0.4.6
17 changes: 17 additions & 0 deletions barretenberg/bootstrap_cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eu

cd "$(dirname "$0")"

# Run both tasks in the background
(cd cpp && ./bootstrap_cache.sh "$@") &
pid_cpp=$!
(cd ts && ./bootstrap_cache.sh "$@") &
pid_ts=$!

# Wait for both processes and capture any non-zero exit codes
wait $pid_cpp || exit_code=$?
wait $pid_ts || exit_code=$?

# Exit with the first non-zero exit code, if any
exit ${exit_code:-0}
10 changes: 9 additions & 1 deletion barretenberg/cpp/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,15 @@ preset-msan-check:
# install SRS needed for proving
COPY --dir ./srs_db/+build/. srs_db
RUN echo "Warning: If ./bin/client_ivc_tests is not found, there may be build failures above."
RUN cd build && ./bin/client_ivc_tests --gtest_also_run_disabled_tests
RUN cd build && ./bin/client_ivc_tests --gtest_filter="*BasicStructured"

preset-check:
ARG preset
FROM +source
RUN cmake --preset $preset -Bbuild && cmake --build build --target client_ivc_tests
# install SRS needed for proving
COPY --dir ./srs_db/+build/. srs_db
RUN cd build && ./bin/client_ivc_tests --gtest_filter="*BasicStructured"

preset-wasm:
ARG TARGETARCH
Expand Down
Loading

0 comments on commit a728268

Please sign in to comment.