Skip to content

Commit

Permalink
Merge branch 'master' into 02-26-feat_PublicImmutable_impl
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Feb 29, 2024
2 parents c0f75b8 + 0699612 commit d9f5983
Show file tree
Hide file tree
Showing 631 changed files with 11,912 additions and 7,861 deletions.
35 changes: 23 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
build-system/scripts/generate_circleci_config.py > .circleci/generated_config.yml
- continuation/continue:
configuration_path: .circleci/generated_config.yml

# Noir
noir-x86_64:
docker:
Expand Down Expand Up @@ -145,7 +146,7 @@ jobs:
- run:
name: "Build"
command: cond_spot_run_build noir-compile-acir-tests 32
aztec_manifest_key: noir
aztec_manifest_key: noir-compile-acir-tests

avm-transpiler:
docker:
Expand Down Expand Up @@ -207,7 +208,7 @@ jobs:
name: "Build"
command: cond_spot_run_build barretenberg-x86_64-linux-clang-fuzzing 128
aztec_manifest_key: barretenberg-x86_64-linux-clang-fuzzing

barretenberg-x86_64-linux-clang-assert:
docker:
- image: aztecprotocol/alpine-build-image
Expand Down Expand Up @@ -674,6 +675,19 @@ jobs:
command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_token_contract.test.ts
aztec_manifest_key: end-to-end

e2e-authwit-test:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_authwit.test.ts
aztec_manifest_key: end-to-end


e2e-blacklist-token-contract:
docker:
- image: aztecprotocol/alpine-build-image
Expand Down Expand Up @@ -1118,17 +1132,12 @@ jobs:
fi
- run:
name: "Build docs"
command: build docs
aztec_manifest_key: docs
- run:
name: "Deploy docs"
command: |
if [ "$CIRCLE_BRANCH" == "master" ]; then
echo "Deploying docs (on master)."
docs/deploy_netlify.sh
else
echo "Skipping doc deploy (not on master)."
fi
echo "Building docs"
build docs
echo "Deploying docs"
docs/deploy_netlify.sh $BRANCH $PULL_REQUEST
yellow-paper:
machine:
Expand Down Expand Up @@ -1436,6 +1445,7 @@ workflows:
- e2e-deploy-contract: *e2e_test
- e2e-lending-contract: *e2e_test
- e2e-token-contract: *e2e_test
- e2e-authwit-test: *e2e_test
- e2e-blacklist-token-contract: *e2e_test
# TODO(3458): Investigate intermittent failure
# - e2e-slow-tree: *e2e_test
Expand Down Expand Up @@ -1483,6 +1493,7 @@ workflows:
- e2e-deploy-contract
- e2e-lending-contract
- e2e-token-contract
- e2e-authwit-test
- e2e-blacklist-token-contract
- e2e-sandbox-example
- e2e-state-vars
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/mirror_noir_subrepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,54 +27,55 @@ jobs:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}

- name: Setup env
- name: Check for existing PR
run: |
set -xue # print commands
# Enable gh executable. We spread out the API requests between the github actions bot token, and aztecbot
export GH_TOKEN="${{ secrets.GITHUB_TOKEN }}"
# Do we have a PR active?
PR_URL=$(gh pr list --repo noir-lang/noir --head aztec-packages --json url --jq ".[0].url")
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
- name: Generate PR body
run: |
set -xue # print commands
# compute_commit_message: Create a filtered git log for release-please changelog / metadata
function compute_commit_message() {
# Get the last sync PR's last commit state
LAST_MERGED_PR_HASH=`gh pr list --repo=noir-lang/noir --state merged --head aztec-packages --json headRefOid --jq=.[0].headRefOid`
# Use a commit heuristic where we look at when .gitrepo first started to look at that commit state (through a push)
COMMIT_HEURISTIC=$(git log -p -S"$LAST_MERGED_PR_HASH" --reverse --source -- noir/.gitrepo | grep -m 1 '^commit' | awk '{print $2}' || true)
BASE_AZTEC_COMMIT=`git config --file=noir/.gitrepo subrepo.parent`
if [[ "$COMMIT_HEURISTIC" = "" ]] ; then
# It it fails, just use our gitrepo parent commit (last time we pushed or pulled)
COMMIT_HEURISTIC=$BASE_AZTEC_COMMIT
# Detect our last sync commit (written by this action before pushing) with a fallback for the first time we ever do this
AZTEC_SYNC_COMMIT=$(curl https://raw.githubusercontent.com/noir-lang/noir/master/.aztec-sync-commit)
if [ "$AZTEC_SYNC_COMMIT" = "404: Not Found" ] ; then
AZTEC_SYNC_COMMIT="a7889f8d21684099306b72a87e0fb57b3bba0cb4"
fi
# Create a filtered git log for release-please changelog / metadata
RAW_MESSAGE=$(git log --pretty=format:"%s" $COMMIT_HEURISTIC..HEAD -- noir/ ':!noir/.gitrepo' | grep -v 'git subrepo' || true)
RAW_MESSAGE=$(git log --pretty=format:"%s" $AZTEC_SYNC_COMMIT..HEAD -- noir/ ':!noir/.gitrepo' | grep -v 'git subrepo' || true)
# Fix Aztec PR links and output message
echo "$RAW_MESSAGE" | sed -E 's/\(#([0-9]+)\)/(https:\/\/github.com\/AztecProtocol\/aztec-packages\/pull\/\1)/g'
}
echo "$(compute_commit_message)" >> .COMMIT_MESSAGE
echo "$(compute_commit_message)" >> .PR_BODY_MESSAGE
- name: Set git configure for commits
run: |
# identify ourselves, needed to commit
git config --global user.name AztecBot
git config --global user.email tech@aztecprotocol.com
# We push using git subrepo (https://github.com/ingydotnet/git-subrepo)
# and push all Aztec commits as a single commit with metadata.
- name: Push to branch
run: |
set -xue # print commands
# Enable gh executable. We spread out the API requests between the github actions bot token, and aztecbot
export GH_TOKEN="${{ secrets.GITHUB_TOKEN }}"
SUBREPO_PATH=noir
BRANCH=aztec-packages
if [[ "$PR_URL" == "" ]]; then
# if no staging branch, we can overwrite
STAGING_BRANCH=$BRANCH
else
else
# otherwise we first reset our staging branch
STAGING_BRANCH=$BRANCH-staging
fi
# identify ourselves, needed to commit
git config --global user.name AztecBot
git config --global user.email tech@aztecprotocol.com
BASE_NOIR_COMMIT=`git config --file=noir/.gitrepo subrepo.commit`
BASE_AZTEC_COMMIT=`git config --file=noir/.gitrepo subrepo.parent`
COMMIT=$(git rev-parse HEAD)
COMMIT_MESSAGE=$(git log -1 --pretty=format:%B)
# clone noir repo for manipulations, we use aztec bot token for writeability
git clone https://x-access-token:${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}@github.com/noir-lang/noir.git noir-repo
Expand All @@ -90,13 +91,13 @@ jobs:
}
# force_sync_staging: Push to our aztec-packages staging branch.
function force_sync_staging() {
MESSAGE=$(cat .COMMIT_MESSAGE)
git commit --allow-empty -m"chore: Sync to noir-lang/noir" -m"$MESSAGE"
COMMIT=$(git rev-parse HEAD)
echo "$COMMIT" > noir/.aztec-sync-commit && git add noir/.aztec-sync-commit
# make a new commit with our previous message
git commit -am "$COMMIT_MESSAGE"
# Now push to it with subrepo with computed commit messages
if ./scripts/git-subrepo/lib/git-subrepo push $SUBREPO_PATH --squash --branch=$STAGING_BRANCH; then
# We don't push a commit to aztec anymore so that we can maintain the 'commit' as our last pull branch
git reset $COMMIT
git reset "$COMMIT"
else
echo "Problems syncing noir. We may need to pull the subrepo."
exit 1
Expand All @@ -108,7 +109,7 @@ jobs:
cd noir-repo
git fetch # see recent change
git checkout $BRANCH || git checkout -b $BRANCH
git merge -Xtheirs origin/$STAGING_BRANCH
git merge -Xtheirs origin/$STAGING_BRANCH -m "$COMMIT_MESSAGE"
git push origin $BRANCH
cd ..
}
Expand All @@ -121,10 +122,9 @@ jobs:
- name: Update PR
run: |
set -xue # print commands
MESSAGE=$(cat .COMMIT_MESSAGE)
# Formatted for updating the PR, overrides for release-please commit message parsing
PR_BODY="""BEGIN_COMMIT_OVERRIDE
$MESSAGE
$(cat .PR_BODY_MESSAGE)
END_COMMIT_OVERRIDE"""
# for cross-opening PR in noir repo, we use aztecbot's token
export GH_TOKEN=${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
Expand Down
13 changes: 1 addition & 12 deletions avm-transpiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion avm-transpiler/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ if [ -n "$CMD" ]; then
fi

# Attempt to just pull artefacts from CI and exit on success.
./bootstrap_cache.sh && exit
[ -n "${USE_CACHE:-}" ] && ./bootstrap_cache.sh && exit

./scripts/bootstrap_native.sh
2 changes: 0 additions & 2 deletions avm-transpiler/bootstrap_cache.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
set -eu

[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1

cd "$(dirname "$0")"
source ../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null

Expand Down
4 changes: 2 additions & 2 deletions avm-transpiler/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.72"
components = [ "rust-src" ]
channel = "1.73"
components = ["rust-src"]
targets = []
profile = "default"
35 changes: 35 additions & 0 deletions avm-transpiler/src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ fn handle_foreign_call(
destinations,
inputs,
),
"nullifierExists" => handle_nullifier_exists(avm_instrs, destinations, inputs),
"keccak256" | "sha256" => {
handle_2_field_hash_instruction(avm_instrs, function, destinations, inputs)
}
Expand Down Expand Up @@ -298,6 +299,40 @@ fn handle_emit_note_hash_or_nullifier(
});
}

/// Handle an AVM NULLIFIEREXISTS instruction
/// (a nullifierExists brillig foreign call was encountered)
/// Adds the new instruction to the avm instructions list.
fn handle_nullifier_exists(
avm_instrs: &mut Vec<AvmInstruction>,
destinations: &Vec<ValueOrArray>,
inputs: &Vec<ValueOrArray>,
) {
if destinations.len() != 1 || inputs.len() != 1 {
panic!("Transpiler expects ForeignCall::CHECKNULLIFIEREXISTS to have 1 destinations and 1 input, got {} and {}", destinations.len(), inputs.len());
}
let nullifier_offset_operand = match &inputs[0] {
ValueOrArray::MemoryAddress(offset) => offset.to_usize() as u32,
_ => panic!("Transpiler does not know how to handle ForeignCall::EMITNOTEHASH with HeapArray/Vector inputs"),
};
let exists_offset_operand = match &destinations[0] {
ValueOrArray::MemoryAddress(offset) => offset.to_usize() as u32,
_ => panic!("Transpiler does not know how to handle ForeignCall::EMITNOTEHASH with HeapArray/Vector inputs"),
};
avm_instrs.push(AvmInstruction {
opcode: AvmOpcode::NULLIFIEREXISTS,
indirect: Some(ALL_DIRECT),
operands: vec![
AvmOperand::U32 {
value: nullifier_offset_operand,
},
AvmOperand::U32 {
value: exists_offset_operand,
},
],
..Default::default()
});
}

/// Two field hash instructions represent instruction's that's outputs are larger than a field element
///
/// This includes:
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 = b0e822f0e1e7dfbb51033e2e8a15a6c18661015a
parent = d44d9f11be2a2d2652b70b1d333322440c6ef06c
commit = e26973fa4884d59fe7fde6a98ce1e74cd9d0a0f0
parent = 035cff451ca2171e08279b9d36b23f38b840efea
method = merge
cmdver = 0.4.6
6 changes: 3 additions & 3 deletions barretenberg/acir_tests/Dockerfile.bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-compile-acir-tests as noir-acir-tests
FROM aztecprotocol/barretenberg-x86_64-linux-clang-assert
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0-alpine
RUN apk update && apk add git bash curl jq coreutils
Expand All @@ -10,7 +10,7 @@ COPY . .
# Run every acir test through native bb build prove_then_verify flow for UltraPlonk.
# This ensures we test independent pk construction through real/garbage witness data paths.
RUN FLOW=prove_then_verify ./run_acir_tests.sh
# This flow is essentially the GoblinUltraHonk equivalent to the UltraPlonk "prove and verify". (This functionality is
# This flow is essentially the GoblinUltraHonk equivalent to the UltraPlonk "prove and verify". (This functionality is
# accessed via the goblin "accumulate" mechanism).
RUN FLOW=accumulate_and_verify_goblin ./run_acir_tests.sh
# This is a "full" Goblin flow. It constructs and verifies four proofs: GoblinUltraHonk, ECCVM, Translator, and merge
Expand Down
4 changes: 2 additions & 2 deletions barretenberg/acir_tests/Dockerfile.bb.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/bb.js
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-compile-acir-tests as noir-acir-tests
FROM aztecprotocol/bb.js
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0
COPY --from=0 /usr/src/barretenberg/ts-build /usr/src/barretenberg/ts
Expand Down
6 changes: 3 additions & 3 deletions barretenberg/acir_tests/Dockerfile.bb.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang-sol
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-compile-acir-tests as noir-acir-tests
FROM aztecprotocol/barretenberg-x86_64-linux-clang-assert
FROM aztecprotocol/barretenberg-x86_64-linux-clang-sol
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0-alpine
RUN apk update && apk add git bash curl jq
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/acir_tests/Dockerfile.noir_acir_tests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# However, the noir subrepo has no concept of the aztec build pipeline, so the Dockerfile wouldn't make sense there.
# So, it lives here.
# This chains off the nargo build, and creates a container with a compiled set of acir tests.
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir
FROM aztecprotocol/noir
RUN apt update && apt install -y jq && rm -rf /var/lib/apt/lists/* && apt-get clean
ENV PATH="/usr/src/noir/target/release:${PATH}"
WORKDIR /usr/src/noir/test_programs
Expand Down
Loading

0 comments on commit d9f5983

Please sign in to comment.