-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into cg/analyze-field-ops-time
- Loading branch information
Showing
551 changed files
with
14,447 additions
and
7,299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
1 change: 1 addition & 0 deletions
1
barretenberg/cpp/src/barretenberg/benchmark/append_only_tree_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
barretenberg_module(append_only_tree_bench crypto_poseidon2 crypto_merkle_tree) |
54 changes: 54 additions & 0 deletions
54
...etenberg/cpp/src/barretenberg/benchmark/append_only_tree_bench/append_only_tree.bench.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
2 changes: 1 addition & 1 deletion
2
barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.