Skip to content

Commit

Permalink
Merge branch 'master' into cg/analyze-field-ops-time
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad authored Feb 12, 2024
2 parents 60d2a7c + 26918de commit c86d248
Show file tree
Hide file tree
Showing 551 changed files with 14,447 additions and 7,299 deletions.
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,17 @@ jobs:
name: "Test"
command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_card_game.test.ts

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

pxe:
docker:
- image: aztecprotocol/alpine-build-image
Expand Down Expand Up @@ -1275,6 +1286,7 @@ workflows:
- e2e-persistence: *e2e_test
- e2e-browser: *e2e_test
- e2e-card-game: *e2e_test
- e2e-avm-simulator: *e2e_test
- pxe: *e2e_test
- cli-docs-sandbox: *e2e_test
- guides-writing-an-account-contract: *e2e_test
Expand Down Expand Up @@ -1313,6 +1325,7 @@ workflows:
- e2e-persistence
- e2e-browser
- e2e-card-game
- e2e-avm-simulator
- pxe
- boxes-blank
- boxes-blank-react
Expand Down
110 changes: 80 additions & 30 deletions .github/workflows/mirror_noir_subrepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@ jobs:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}


- name: Setup env
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
# 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)
if [[ " $COMMIT_HEURISTIC" = "" ]] ; then
# It it fails, just use our gitrepo parent commit (last time we pushed or pulled)
COMMIT_HEURISTIC=$BASE_AZTEC_COMMIT
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)
# 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
# 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
Expand All @@ -48,47 +75,70 @@ jobs:
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
# 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 [email protected]
BASE_NOIR_COMMIT=`git config --file=noir/.gitrepo subrepo.commit`
BASE_AZTEC_COMMIT=`git config --file=noir/.gitrepo subrepo.parent`
# Fix PR branch
# 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
cd noir-repo
git checkout $BRANCH || git checkout -b $BRANCH
git reset --hard "$BASE_NOIR_COMMIT"
# Reset our branch to our expected target
git push origin $BRANCH --force
cd ..
# 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)
if [[ " $COMMIT_HEURISTIC" = "" ]] ; then
# It it fails, just use our gitrepo parent commit (last time we pushed or pulled)
COMMIT_HEURISTIC=$BASE_AZTEC_COMMIT
fi
# Create a filtered git log for release-please changelog / metadata
MESSAGE=$(git log --pretty=format:"%s" $COMMIT_HEURISTIC..HEAD -- noir/ ':!noir/.gitrepo' | grep -v 'git subrepo' || true)
# Fix Aztec PR links
MESSAGE=$(echo "$MESSAGE" | sed -E 's/\(#([0-9]+)\)/(https:\/\/github.com\/AztecProtocol\/aztec-packages\/pull\/\1)/g')
git commit --allow-empty -m"chore: Sync to noir-lang/noir" -m"$MESSAGE"
COMMIT=$(git rev-parse HEAD)
# Now push to it with subrepo with computed commit messages
if ./scripts/git_subrepo.sh push $SUBREPO_PATH --squash --branch=$BRANCH; then
git reset $COMMIT
git commit --amend -am "$(git log -1 --pretty=%B) [skip ci]"
git push
else
echo "Problems syncing noir. We may need to pull the subrepo."
exit 1
# reset_pr: Reset aztec-packages staging. If no PR, this is the PR branch.
function reset_noir_staging_branch() {
cd noir-repo
git checkout $STAGING_BRANCH || git checkout -b $STAGING_BRANCH
git reset --hard "$BASE_NOIR_COMMIT"
# Reset our branch to our expected target
git push origin $STAGING_BRANCH --force
cd ..
}
# 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)
# 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
git reset $COMMIT
git commit --allow-empty --amend -am "$(git log -1 --pretty=%B) [skip ci]"
git push
else
echo "Problems syncing noir. We may need to pull the subrepo."
exit 1
fi
}
# merge_staging_branch: Merge our staging branch into aztec-packages.
function merge_staging_branch() {
# Fix PR branch
cd noir-repo
git fetch # see recent change
git checkout $BRANCH || git checkout -b $BRANCH
git merge -Xtheirs $STAGING_BRANCH
git push origin $BRANCH
cd ..
}
reset_noir_staging_branch
force_sync_staging
if [[ "$PR_URL" != "" ]]; then
merge_staging_branch
fi
- 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
END_COMMIT_OVERRIDE"""
PR_URL=$(gh pr list --repo noir-lang/noir --head aztec-packages --json url --jq ".[0].url")
# for cross-opening PR in noir repo, we use aztecbot's token
export GH_TOKEN=${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
if [[ "$PR_URL" == "" ]]; then
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/publish-bb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,15 @@ jobs:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- name: Create Mac Build Environment
run: brew install cmake ninja
run: brew install cmake ninja llvm@16

- name: Compile Barretenberg
working-directory: barretenberg/cpp
run: |
cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert
export PATH="/usr/local/opt/llvm@16/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm@16/lib"
export CPPFLAGS="-I/usr/local/opt/llvm@16/include"
cmake -DCMAKE_BUILD_TYPE=RelWithAssert --preset default
cmake --build --preset default --target bb
- name: Package barretenberg artifact
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,5 @@
"C_Cpp.vcpkg.enabled": false,
"C_Cpp.default.includePath": [
"barretenberg/cpp/src"
],
"cmake.sourceDirectory": "/mnt/user-data/adam/aztec-packages/barretenberg/cpp",
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ All the packages that make up [Aztec](https://docs.aztec.network).

## Issues Board

All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/about_aztec/roadmap/main) section of our docs.
All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/misc/roadmap/main) section of our docs.

## Development Setup

Expand Down
16 changes: 16 additions & 0 deletions avm-transpiler/Cargo.lock

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

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 = 68137e4dbd4c7a9c288e253e371bd9ddef9f9abb
parent = 295cd5564048ca27316c508766a2dcfc3cc1bf7e
commit = eedee2077b4932ae2814c3c38c2b267102a7cfc6
parent = fecf3f7618d1e016ea5c3afc97e4253639c1d983
method = merge
cmdver = 0.4.6
27 changes: 21 additions & 6 deletions barretenberg/cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,23 @@
}
},
{
"name": "op-counting",
"displayName": "Release build with operation counts for benchmarks",
"name": "op-count-track",
"displayName": "Release build with operation counts",
"description": "Build with op counting",
"inherits": "clang16",
"binaryDir": "build-op-counting",
"binaryDir": "build-op-count-track",
"environment": {
"CXXFLAGS": "-DBB_USE_OP_COUNT"
"CXXFLAGS": "-DBB_USE_OP_COUNT -DBB_USE_OP_COUNT_TRACK_ONLY"
}
},
{
"name": "op-count-time",
"displayName": "Release build with time and clock counts",
"description": "Build with op counting",
"inherits": "clang16",
"binaryDir": "build-op-count-time",
"environment": {
"CXXFLAGS": "-DBB_USE_OP_COUNT -DBB_USE_OP_COUNT_TIME_ONLY"
}
},
{
Expand Down Expand Up @@ -311,9 +321,14 @@
"configurePreset": "clang16"
},
{
"name": "op-counting",
"name": "op-count-time",
"inherits": "default",
"configurePreset": "op-count-time"
},
{
"name": "op-count-track",
"inherits": "default",
"configurePreset": "op-counting"
"configurePreset": "op-count-track"
},
{
"name": "clang16-dbg",
Expand Down
1 change: 0 additions & 1 deletion barretenberg/cpp/scripts/stdlib-tests
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ stdlib_aes128_tests
stdlib_blake2s_tests
stdlib_blake3s_tests
stdlib_ecdsa_tests
stdlib_merkle_tree_tests
stdlib_pedersen_commitment_tests
stdlib_pedersen_hash_tests
stdlib_poseidon2_tests
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ set(BARRETENBERG_TARGET_OBJECTS
$<TARGET_OBJECTS:stdlib_blake2s_objects>
$<TARGET_OBJECTS:stdlib_blake3s_objects>
$<TARGET_OBJECTS:stdlib_keccak_objects>
$<TARGET_OBJECTS:stdlib_merkle_tree_objects>
$<TARGET_OBJECTS:crypto_merkle_tree_objects>
$<TARGET_OBJECTS:stdlib_pedersen_commitment_objects>
$<TARGET_OBJECTS:stdlib_pedersen_hash_objects>
$<TARGET_OBJECTS:stdlib_poseidon2_objects>
Expand Down
13 changes: 9 additions & 4 deletions barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
add_subdirectory(basics_bench)
add_subdirectory(decrypt_bench)
add_subdirectory(goblin_bench)
add_subdirectory(ipa_bench)
add_subdirectory(ivc_bench)
add_subdirectory(pippenger_bench)
add_subdirectory(plonk_bench)
add_subdirectory(ultra_bench)
add_subdirectory(goblin_bench)
add_subdirectory(basics_bench)
add_subdirectory(protogalaxy_bench)
add_subdirectory(relations_bench)
add_subdirectory(widgets_bench)
add_subdirectory(protogalaxy_bench)
add_subdirectory(poseidon2_bench)
add_subdirectory(merkle_tree_bench)
add_subdirectory(indexed_tree_bench)
add_subdirectory(append_only_tree_bench)
add_subdirectory(ultra_bench)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
barretenberg_module(append_only_tree_bench crypto_poseidon2 crypto_merkle_tree)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "barretenberg/crypto/merkle_tree/append_only_tree/append_only_tree.hpp"
#include "barretenberg/crypto/merkle_tree/array_store.hpp"
#include "barretenberg/crypto/merkle_tree/hash.hpp"
#include "barretenberg/numeric/random/engine.hpp"
#include <benchmark/benchmark.h>

using namespace benchmark;
using namespace bb::crypto::merkle_tree;

using Pedersen = AppendOnlyTree<ArrayStore, PedersenHashPolicy>;
using Poseidon2 = AppendOnlyTree<ArrayStore, Poseidon2HashPolicy>;

const size_t TREE_DEPTH = 32;
const size_t MAX_BATCH_SIZE = 128;

namespace {
auto& random_engine = bb::numeric::get_randomness();
} // namespace

template <typename TreeType> void perform_batch_insert(TreeType& tree, const std::vector<fr>& values)
{
tree.add_values(values);
}

template <typename TreeType> void append_only_tree_bench(State& state) noexcept
{
const size_t batch_size = size_t(state.range(0));
const size_t depth = TREE_DEPTH;

ArrayStore store(depth, 1024 * 1024);
TreeType tree = TreeType(store, depth);

for (auto _ : state) {
state.PauseTiming();
std::vector<fr> values(batch_size);
for (size_t i = 0; i < batch_size; ++i) {
values[i] = fr(random_engine.get_random_uint256());
}
state.ResumeTiming();
perform_batch_insert(tree, values);
}
}
BENCHMARK(append_only_tree_bench<Pedersen>)
->Unit(benchmark::kMillisecond)
->RangeMultiplier(2)
->Range(2, MAX_BATCH_SIZE)
->Iterations(100);
BENCHMARK(append_only_tree_bench<Poseidon2>)
->Unit(benchmark::kMillisecond)
->RangeMultiplier(2)
->Range(2, MAX_BATCH_SIZE)
->Iterations(1000);

BENCHMARK_MAIN();
Original file line number Diff line number Diff line change
@@ -1 +1 @@
barretenberg_module(goblin_bench ultra_honk eccvm stdlib_recursion stdlib_sha256 stdlib_merkle_tree stdlib_primitives)
barretenberg_module(goblin_bench ultra_honk eccvm stdlib_recursion stdlib_sha256 crypto_merkle_tree stdlib_primitives)
Loading

0 comments on commit c86d248

Please sign in to comment.