Skip to content

Commit

Permalink
Merge branch 'master' into revert-10887-revert-10881-md/back-off-fail…
Browse files Browse the repository at this point in the history
…ed-dials
  • Loading branch information
Maddiaa0 authored Dec 19, 2024
2 parents 4f061a6 + 8cb26e9 commit 115cdce
Show file tree
Hide file tree
Showing 31 changed files with 245 additions and 137 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ jobs:
- name: Copy Network Logs
if: always()
run: scripts/copy_from_tester yarn-project/end-to-end/scripts/network-test.log network-test.log || true

- name: Upload Network Logs
if: always()
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -490,6 +491,7 @@ jobs:
run: scripts/copy_from_tester barretenberg/cpp/bench.json bench.json || true
- name: Store benchmark result
if: github.ref == 'refs/heads/master'
continue-on-error: true
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
with:
name: C++ Benchmark
Expand Down
4 changes: 2 additions & 2 deletions avm-transpiler/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function build {
}

function test {
cargo fmt --check
cargo clippy
denoise cargo fmt --check
denoise cargo clippy
}

case "$cmd" in
Expand Down
6 changes: 3 additions & 3 deletions barretenberg/acir_tests/browser-test-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ __metadata:
cacheKey: 10c0

"@aztec/bb.js@file:../../ts::locator=browser-test-app%40workspace%3A.":
version: 0.67.0
resolution: "@aztec/bb.js@file:../../ts#../../ts::hash=e236e3&locator=browser-test-app%40workspace%3A."
version: 0.67.1
resolution: "@aztec/bb.js@file:../../ts#../../ts::hash=29e47a&locator=browser-test-app%40workspace%3A."
dependencies:
comlink: "npm:^4.4.1"
commander: "npm:^12.1.0"
Expand All @@ -17,7 +17,7 @@ __metadata:
tslib: "npm:^2.4.0"
bin:
bb.js: ./dest/node/main.js
checksum: 10c0/4ca2234f9d1a4b59a60733979f97c5ca09f508e4d3091bf33755ee6a80f03f733e393ea848b812bc73bc1f0673a3d92f96462a1cbd5aa01eeca4e9d5a3be367f
checksum: 10c0/c01128ff74f29b6bbc5c46362792525ef5612c5fc8787341551bcf457ba9816a971e24a74292ab230c47b0b9efe8d7e0d1cabd44247e1b6e718727d0b6372400
languageName: node
linkType: hard

Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ case "$cmd" in
test
;;
"ci")
build_native
build
test
;;
"hash")
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ case "$cmd" in
;;
"test-boxes")
github_group "test-boxes"
bootstrap_local "CI=1 SKIP_BB_CRS=1 ./bootstrap.sh fast && ./boxes/bootstrap.sh test";
bootstrap_local_noninteractive "CI=1 SKIP_BB_CRS=1 ./bootstrap.sh fast && ./boxes/bootstrap.sh test";
exit
;;
"image-aztec")
Expand Down
2 changes: 1 addition & 1 deletion build-images/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source $(git rev-parse --show-toplevel)/ci3/source_bootstrap

cmd=${1:-}
hash=$(REBUILD_PATTERNS="^build-images/Earthfile" cache_content_hash)
hash=$(cache_content_hash "^build-images/Earthfile")

function build {
github_group "build-images build"
Expand Down
20 changes: 7 additions & 13 deletions ci3/bootstrap_local
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,24 @@

root=$(git rev-parse --show-toplevel)
source $root/ci3/source
current_commit=$(git rev-parse HEAD)
cmd=${1:-"CI=1 ./bootstrap.sh fast || exec bash"}
cmd=${1:-"./bootstrap.sh ci || exec bash"}

if ! git diff --quiet; then
echo "There are local changes to tracked files."
exit 1
echo -e "${yellow}WARNING: There are local changes to tracked files.${reset}"
fi

interactive_args=""
# Only add -ti and a name if we are not in CI.
[ "${CI:-0}" = "0" ] && interactive_args="--name aztec_build -ti"
docker run $interactive_args --rm \
docker run --name aztec_build -ti --rm \
--privileged \
-v bootstrap_ci_local_docker:/var/lib/docker \
-v $root:/aztec-packages-host:ro \
-v $HOME/.aws:/root/.aws \
aztecprotocol/ci:2.0 bash -c "
set -e
/usr/local/share/docker-init.sh &> /dev/null
git config --global --add safe.directory /aztec-packages-host/.git
mkdir -p /root/aztec-packages && cd /root/aztec-packages
cd /root
# Ensure we get a clean clone of the repo.
git init &>/dev/null
git remote add origin https://github.com/aztecprotocol/aztec-packages
git fetch --depth 1 origin $current_commit 2>/dev/null || (echo 'The commit was not pushed, run aborted.' && exit 1)
git checkout FETCH_HEAD &>/dev/null
git clone --depth 1 file:///aztec-packages-host aztec-packages
cd aztec-packages
$cmd
"
30 changes: 30 additions & 0 deletions ci3/bootstrap_local_noninteractive
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Launches our CI image locally and runs the bootstrap.
# This is used interim while we have CI runners that are not launched with bootstrap_ec2.
# It uses docker-in-docker as some test flows require it (e.g. e2e).
# We use a volume on /var/lib/docker as overlayfs trashes performance (in fact it just breaks).
# We mount in aws credentials to leverage the s3 cache.
# The host repository is mounted in read-only, and a clone is taken to ensure a clean start.
# If anything goes wrong during the run, the container will drop into a shell.

root=$(git rev-parse --show-toplevel)
source $root/ci3/source
current_commit=$(git rev-parse HEAD)
cmd=${1:-"CI=1 ./bootstrap.sh fast"}

docker run --rm \
--privileged \
-v bootstrap_ci_local_docker:/var/lib/docker \
-v $root:/aztec-packages-host:ro \
-v $HOME/.aws:/root/.aws \
aztecprotocol/ci:2.0 bash -c "
/usr/local/share/docker-init.sh &> /dev/null
git config --global --add safe.directory /aztec-packages-host/.git
mkdir -p /root/aztec-packages && cd /root/aztec-packages
# Ensure we get a clean clone of the repo.
git init &>/dev/null
git remote add origin https://github.com/aztecprotocol/aztec-packages
git fetch --depth 1 origin $current_commit 2>/dev/null || (echo 'The commit was not pushed, run aborted.' && exit 1)
git checkout FETCH_HEAD &>/dev/null
$cmd
"
25 changes: 15 additions & 10 deletions ci3/cache_content_hash
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
set -euo pipefail
[ "${BUILD_SYSTEM_DEBUG:-}" = 1 ] && set -x

# Ensure REBUILD_PATTERNS or args are set
if [[ -z "${REBUILD_PATTERNS:-}" && "$#" = 0 ]]; then
echo "Error: No arguments provided and REBUILD_PATTERNS environment variable is not set."
# Ensure args are set
if [[ "$#" = 0 ]]; then
echo "Error: No arguments provided."
exit 1
fi

# If too many spurious cache misses: can be customized to pin artifacts to a specific version
AZTEC_CACHE_COMMIT=${AZTEC_CACHE_COMMIT:-HEAD}
PLATFORM_TAG="${PLATFORM_TAG:-${OSTYPE:-unknown}-$(uname -m)}"
# Literal patterns can be provided with REBUILD_PATTERNS
REBUILD_PATTERNS=${REBUILD_PATTERNS:-}
if [ "$#" != 0 ]; then
REBUILD_PATTERNS+=$'\n'$(cat "$@")
fi

rebuild_patterns=()
for arg in "$@"; do
if [[ -f "$arg" ]]; then
rebuild_patterns+=$(cat "$arg")
rebuild_patterns+=$'\n'
else
rebuild_patterns+="$arg"$'\n'
fi
done

# Concatenate patterns with '|' and double escape backslashes for AWK
# filter empty lines
AWK_PATTERN=$(echo "$REBUILD_PATTERNS" | grep -v '^$' | sed 's/\\/\\\\/g' | tr '\n' '|' | sed 's/|$//')
AWK_PATTERN=$(echo "$rebuild_patterns" | grep -v '^$' | sed 's/\\/\\\\/g' | tr '\n' '|' | sed 's/|$//')

# use git repo root because that is where our patterns are focused
cd $(git rev-parse --show-toplevel)
Expand All @@ -30,7 +35,7 @@ CONTENT_HASH=$(git ls-tree -r $AZTEC_CACHE_COMMIT | awk -v pattern="($AWK_PATTER
# Check if file list was empty by comparing against the result of 'echo '' | git hash-object --stdin | cut -c1-16'
ECHO_BLANK_HASH="8b137891791fe969"
if [ "$CONTENT_HASH" = "$ECHO_BLANK_HASH" ]; then
echo "No files matched the rebuild patterns $REBUILD_PATTERNS."
echo "No files matched the rebuild patterns $rebuild_patterns."
echo "Awk pattern expanded: $AWK_PATTERN."
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion ci3/dump_fail
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ "$status" -ne 0 ]; then
cat "$stderr"
} >&2
else
echo "$output"
echo -n "$output"
fi

exit $status
7 changes: 6 additions & 1 deletion ci3/source
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ function hash_str {
set -eu
echo $1 | git hash-object --stdin | cut -c1-16 | tr -d '\n'
}
export -f hash_str

function echo_stderr {
echo $@ >&2
}

export -f hash_str echo_stderr

source $ci3/source_color
2 changes: 1 addition & 1 deletion ci3/source_bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ case "${1:-}" in
export DENOISE=${DENOISE:-1}
;;
""|"fast")
export USE_CACHE=1
export USE_CACHE=${USE_CACHE:-1}
;;
"test")
export TEST=1
Expand Down
61 changes: 61 additions & 0 deletions docs/docs/migration_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,67 @@ keywords: [sandbox, aztec, notes, migration, updating, upgrading]
---

Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them.
## 0.68.0
### [archiver, node, pxe] Remove contract artifacts in node and archiver and store function names instead
Contract artifacts were only in the archiver for debugging purposes. Instead function names are now (optionally) emitted
when registering contract classes

Function changes in the Node interface and Contract Data source interface:
```diff
- addContractArtifact(address: AztecAddress, artifact: ContractArtifact): Promise<void>;
+ registerContractFunctionNames(address: AztecAddress, names: Record<string, string>): Promise<void>;
```

So now the PXE registers this when calling `registerContract()`
```
await this.node.registerContractFunctionNames(instance.address, functionNames);
```

Function changes in the Archiver
```diff
- addContractArtifact(address: AztecAddress, artifact: ContractArtifact)
- getContractArtifact(address: AztecAddress)
+ registerContractFunctionNames(address: AztecAddress, names: Record<string, string>): Promise<void>
```

### [fees, fpc] Changes in setting up FPC as fee payer on AztecJS and method names in FPC
On AztecJS, setting up `PrivateFeePaymentMethod` and `PublicFeePaymentMethod` are now the same. The don't need to specify a sequencer address or which coin to pay in. The coins are set up in the FPC contract!

```diff
- paymentMethod: new PrivateFeePaymentMethod(bananaCoin.address,bananaFPC.address,aliceWallet,sequencerAddress),
+ paymentMethod: new PrivateFeePaymentMethod(bananaFPC.address, aliceWallet),

- paymentMethod: new PublicFeePaymentMethod(bananaCoin.address, bananaFPC.address, aliceWallet),
+ paymentMethod: new PublicFeePaymentMethod(bananaFPC.address, aliceWallet),
```

Changes in `FeePaymentMethod` class in AztecJS
```diff
- getAsset(): AztecAddress;
+ getAsset(): Promise<AztecAddress>;
```

Changes in the token contract:
FPC specific methods, `setup_refund()` and `complete_refund()` have minor args rename.

Changes in FPC contract:
Rename of args in all of FPC functions as FPC now stores the accepted token address and admin and making it clearer the amounts are corresponding to the accepted token and not fee juice.
Also created a public function `pull_funds()` for admin to clawback any money in the FPC

Expect more changes in FPC in the coming releases!

### Name change from `contact` to `sender` in PXE API
`contact` has been deemed confusing because the name is too similar to `contract`.
For this reason we've decided to rename it:

```diff
- await pxe.registerContact(address);
+ await pxe.registerSender(address);
- await pxe.getContacts();
+ await pxe.getSenders();
- await pxe.removeContact(address);
+ await pxe.removeSender(address);
```

## 0.67.1

Expand Down
25 changes: 13 additions & 12 deletions noir-projects/noir-contracts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# - The exported functions called by parallel must enable their own flags at the start e.g. set -euo pipefail
# - The exported functions are using stdin/stdout, so be very careful about what's printed where.
# - The exported functions need to have external variables they require, to have been exported first.
# - If you want to echo something, send it to stderr e.g. echo "My debug" >&2
# - If you want to echo something, send it to stderr e.g. echo_stderr "My debug"
# - If you call another script, be sure it also doesn't output something you don't want.
# - Note calls to cache scripts swallow everything with &> /dev/null.
# - Local assignments with subshells don't propagate errors e.g. local capture=$(false). Declare locals separately.
Expand Down Expand Up @@ -58,7 +58,7 @@ function process_function() {
set +e
make_vk=$(echo "$func" | jq -e '(.custom_attributes | index("public") == null) and (.is_unconstrained == false)')
if [ $? -ne 0 ] && [ "$make_vk" != "false" ]; then
echo "Failed to check function $name is neither public nor unconstrained." >&2
echo_stderr "Failed to check function $name is neither public nor unconstrained."
exit 1
fi
set -e
Expand All @@ -70,7 +70,7 @@ function process_function() {
hash=$((echo "$BB_HASH"; echo "$bytecode_b64") | sha256sum | tr -d ' -')
if ! cache_download vk-$hash.tar.gz &> /dev/null; then
# It's not in the cache. Generate the vk file and upload it to the cache.
echo "Generating vk for function: $name..." >&2
echo_stderr "Generating vk for function: $name..."
echo "$bytecode_b64" | base64 -d | gunzip | $BB write_vk_for_ivc -h -b - -o $tmp_dir/$hash 2>/dev/null
cache_upload vk-$hash.tar.gz $tmp_dir/$hash &> /dev/null
fi
Expand All @@ -97,8 +97,12 @@ function compile {
contract_name=$(cat contracts/$1/src/main.nr | awk '/^contract / { print $2 }')
local filename="$contract-$contract_name.json"
local json_path="./target/$filename"
export REBUILD_PATTERNS="^noir-projects/noir-contracts/contracts/$contract/"
contract_hash="$(cache_content_hash ../../noir/.rebuild_patterns ../../avm-transpiler/.rebuild_patterns)"
contract_hash="$(cache_content_hash \
../../noir/.rebuild_patterns \
../../avm-transpiler/.rebuild_patterns \
"^noir-projects/noir-contracts/contracts/$contract/" \
"^noir-projects/aztec-nr/" \
)"
if ! cache_download contract-$contract_hash.tar.gz &> /dev/null; then
$NARGO compile --package $contract --silence-warnings --inliner-aggressiveness 0
$TRANSPILER $json_path $json_path
Expand All @@ -125,7 +129,7 @@ function build {
compile $1
else
set +e
echo "Compiling contracts (bb-hash: $BB_HASH)..."
echo_stderr "Compiling contracts (bb-hash: $BB_HASH)..."
grep -oP '(?<=contracts/)[^"]+' Nargo.toml | \
parallel -j16 --joblog joblog.txt -v --line-buffer --tag --halt now,fail=1 compile {}
code=$?
Expand All @@ -143,15 +147,12 @@ case "$cmd" in
;;
"clean-keys")
for artifact in target/*.json; do
echo "Scrubbing vk from $artifact..."
echo_stderr "Scrubbing vk from $artifact..."
jq '.functions |= map(del(.verification_key))' "$artifact" > "${artifact}.tmp"
mv "${artifact}.tmp" "$artifact"
done
;;
""|"fast"|"ci")
USE_CACHE=1 build
;;
"full")
""|"fast"|"full"|"ci")
build
;;
"compile")
Expand All @@ -163,6 +164,6 @@ case "$cmd" in
exit 0
;;
*)
echo "Unknown command: $cmd"
echo_stderr "Unknown command: $cmd"
exit 1
esac
Loading

0 comments on commit 115cdce

Please sign in to comment.