Skip to content

Commit

Permalink
feat: merge devnet chagnes to master (#7822)
Browse files Browse the repository at this point in the history
Brings the latest set of devnet fixes into the master branch

---------

Co-authored-by: PhilWindle <philip.windle@gmail.com>
Co-authored-by: Aztec Bot <49558828+AztecBot@users.noreply.github.com>
Co-authored-by: sirasistant <sirasistant@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Facundo <fcarreiro@users.noreply.github.com>
Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
Co-authored-by: spypsy <spypsy@users.noreply.github.com>
Co-authored-by: spypsy <spypsy@outlook.com>
  • Loading branch information
11 people authored Aug 8, 2024
1 parent 5ff3554 commit 8021eda
Show file tree
Hide file tree
Showing 86 changed files with 2,164 additions and 1,132 deletions.
62 changes: 28 additions & 34 deletions .github/workflows/devnet-deploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
setup:
uses: ./.github/workflows/setup-runner.yml
with:
username: master
username: ${{ github.actor }}
runner_type: builder-x86
secrets: inherit

Expand All @@ -99,7 +99,6 @@ jobs:
pxe_lb_priority_range_start: ${{ steps.set_network_vars.outputs.pxe_lb_priority_range_start }}
faucet_lb_priority: ${{ steps.set_network_vars.outputs.faucet_lb_priority }}
bot_no_wait: ${{ steps.set_network_vars.outputs.bot_no_wait }}
max_txs_per_block: ${{ steps.set_network_vars.outputs.max_txs_per_block }}
steps:
- name: Set network vars
shell: bash
Expand All @@ -119,21 +118,19 @@ jobs:
echo "pxe_lb_priority_range_start=5100" >> $GITHUB_OUTPUT
echo "faucet_lb_priority=601" >> $GITHUB_OUTPUT
echo "bot_no_wait=false" >> $GITHUB_OUTPUT
echo "max_txs_per_block=64" >> $GITHUB_OUTPUT
elif [ "$BRANCH_NAME" = "provernet" ]
then
echo "deploy_tag=provernet" >> $GITHUB_OUTPUT
echo "branch_name=provernet" >> $GITHUB_OUTPUT
echo "network_api_key=PROVERNET_API_KEY" >> $GITHUB_OUTPUT
echo "agents_per_prover=2" >> $GITHUB_OUTPUT
echo "agents_per_prover=4" >> $GITHUB_OUTPUT
echo "bot_interval=300" >> $GITHUB_OUTPUT
echo "node_tcp_range_start=40200" >> $GITHUB_OUTPUT
echo "node_udp_range_start=45200" >> $GITHUB_OUTPUT
echo "node_lb_priority_range_start=4200" >> $GITHUB_OUTPUT
echo "pxe_lb_priority_range_start=5200" >> $GITHUB_OUTPUT
echo "faucet_lb_priority=602" >> $GITHUB_OUTPUT
echo "bot_no_wait=true" >> $GITHUB_OUTPUT
echo "max_txs_per_block=4" >> $GITHUB_OUTPUT
elif [ "$BRANCH_NAME" = "alphanet" ]
then
echo "deploy_tag=alphanet" >> $GITHUB_OUTPUT
Expand All @@ -147,7 +144,6 @@ jobs:
echo "pxe_lb_priority_range_start=5000" >> $GITHUB_OUTPUT
echo "faucet_lb_priority=600" >> $GITHUB_OUTPUT
echo "bot_no_wait=false" >> $GITHUB_OUTPUT
echo "max_txs_per_block=64" >> $GITHUB_OUTPUT
else
echo "Unrecognized Branch!!"
exit 1
Expand Down Expand Up @@ -190,31 +186,6 @@ jobs:
earthly-ci \
--no-output --push ./iac/mainnet-fork+export-mainnet-fork --DIST_TAG=${{ env.DEPLOY_TAG }}
build-aztec-nargo:
needs: set-network
env:
BRANCH_NAME: ${{ needs.set-network.outputs.branch_name }}
DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
API_KEY_NAME: ${{ needs.set-network.outputs.network_api_key }}
runs-on: ${{ github.actor }}-x86
steps:
- uses: actions/checkout@v4
with:
ref: "${{ env.GIT_COMMIT }}"
fetch-depth: 0
- uses: ./.github/ci-setup-action
with:
concurrency_key: build-aztec-nargo-${{ github.actor }}
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"

- name: Build & push aztec nargo image
run: |
earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ env.DEPLOY_TAG }}
earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ github.sha }}
build-aztec:
needs: set-network
env:
Expand Down Expand Up @@ -268,8 +239,33 @@ jobs:
docker push aztecprotocol/aztec:${{ github.sha }}
build-aztec-nargo:
needs: [set-network, build-aztec]
env:
BRANCH_NAME: ${{ needs.set-network.outputs.branch_name }}
DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
TF_VAR_DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
TF_VAR_API_KEY: ${{ secrets[needs.set-network.outputs.network_api_key] }}
API_KEY_NAME: ${{ needs.set-network.outputs.network_api_key }}
runs-on: ${{ github.actor }}-x86
steps:
- uses: actions/checkout@v4
with:
ref: "${{ env.GIT_COMMIT }}"
fetch-depth: 0
- uses: ./.github/ci-setup-action
with:
concurrency_key: build-aztec-nargo-${{ github.actor }}
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"

- name: Build & push aztec nargo image
run: |
earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ env.DEPLOY_TAG }}
earthly-ci --no-output --push ./aztec-nargo+export-aztec-nargo --DIST_TAG=${{ github.sha }}
build-faucet:
needs: set-network
needs: [set-network, build-aztec]
env:
BRANCH_NAME: ${{ needs.set-network.outputs.branch_name }}
DEPLOY_TAG: ${{ needs.set-network.outputs.deploy_tag }}
Expand Down Expand Up @@ -415,7 +411,6 @@ jobs:
TF_VAR_NODE_LB_RULE_PRIORITY: ${{ needs.set-network.outputs.node_lb_priority_range_start }}
TF_VAR_PXE_LB_RULE_PRIORITY: ${{ needs.set-network.outputs.pxe_lb_priority_range_start }}
TF_VAR_BOT_NO_WAIT_FOR_TRANSFERS: ${{ needs.set-network.outputs.bot_no_wait }}
TF_VAR_SEQ_MAX_TX_PER_BLOCK: ${{ needs.set-network.outputs.max_txs_per_block }}
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -616,7 +611,6 @@ jobs:
TF_VAR_NODE_LB_RULE_PRIORITY: ${{ needs.set-network.outputs.node_lb_priority_range_start }}
TF_VAR_PXE_LB_RULE_PRIORITY: ${{ needs.set-network.outputs.pxe_lb_priority_range_start }}
TF_VAR_BOT_NO_WAIT_FOR_TRANSFERS: ${{ needs.set-network.outputs.bot_no_wait }}
TF_VAR_SEQ_MAX_TX_PER_BLOCK: ${{ needs.set-network.outputs.max_txs_per_block }}
TF_VAR_PROVING_ENABLED: true
TF_VAR_BOT_NO_START: false
steps:
Expand Down
37 changes: 26 additions & 11 deletions aztec-up/bin/.aztec-run
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ shift
DEFAULT_PORT=8080
VERSION=${VERSION:-"latest"}
AZTEC_PORT=${AZTEC_PORT:-$DEFAULT_PORT}
INHERIT_USER=${INHERIT_USER:-1}

if [[ -n "${NETWORK:-}" ]]; then
VERSION=$NETWORK
# enable proving if connecting to a network by default
export PXE_PROVER_ENABLED=${PXE_PROVER_ENABLED:-1}
fi

# preserve arguments to pass to docker run
declare -a preserved_args
Expand Down Expand Up @@ -39,7 +46,7 @@ fi

# If running in rootless docker, don't set uid/gid in container, as it breaks the write perms to the home mount.
# Otherwise we set the uid/gid to be that of user running the container to ensure write perms to the home mount.
if [ -z "${ROOTLESS:-}" ]; then
if [[ -z "${ROOTLESS:-}" && "${INHERIT_USER:-}" == "1" ]]; then
DOCKER_USER="--user $(id -u):$(id -g)"
fi

Expand Down Expand Up @@ -73,16 +80,6 @@ for i in "${!args[@]}"; do
fi
done

DOCKER_ENV="-e HOME=$HOME"
for env in ${ENV_VARS_TO_INJECT:-}; do
if [ -n "${!env:-}" ]; then
# First substitute any reference to localhost with our host gateway.
env=${env//localhost/host.docker.internal}
# Inject into container.
DOCKER_ENV+=" -e $env=${!env:-}"
fi
done

# Parse command-line arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
Expand All @@ -91,13 +88,31 @@ while [[ "$#" -gt 0 ]]; do
preserved_args+=("$1" "$2") # Store both argument and value
shift 2 # Move past argument and value
;;
--pxe.network)
VERSION="$2" # Set version to user-specified network (e.g. 'devnet')
echo "Using aztecprotocol/aztec: $VERSION"
preserved_args+=("$1" "$2") # Store both argument and value
# turn on proving if connecting to a network by default
export PXE_PROVER_ENABLED=${PXE_PROVER_ENABLED:-1}
shift 2
;; # Move past argument and value
*)
preserved_args+=("$1") # Store unrecognized/other arguments
shift # Move to next argument
;;
esac
done

DOCKER_ENV="-e HOME=$HOME"
for env in ${ENV_VARS_TO_INJECT:-}; do
if [ -n "${!env:-}" ]; then
# First substitute any reference to localhost with our host gateway.
env=${env//localhost/host.docker.internal}
# Inject into container.
DOCKER_ENV+=" -e $env=${!env:-}"
fi
done

# Dynamic port assignment
port_assignment=""
if [[ -z "${SKIP_PORT_ASSIGNMENT:-}" ]]; then
Expand Down
38 changes: 35 additions & 3 deletions aztec-up/bin/aztec
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail

# Directory of env_var file
TS_ENV_VAR_FILE=/usr/src/yarn-project/foundation/src/config/env_var.ts
LOCAL_TS_FILE=./env_var.ts
NETWORK=${NETWORK:-}
VERSION=${VERSION:-${NETWORK:-"latest"}}
LOCAL_ENV_VAR_FILE="./.${VERSION}_aztec_cli_vars"

function get_compose {
# Favour 'docker compose', falling back on docker-compose.
CMD="docker compose"
$CMD &>/dev/null || CMD="docker-compose"
$CMD $@
}

# Function to parse the TypeScript file
function parse_ts_file {
grep -oE "\| '[^']+'" "$LOCAL_TS_FILE" | sed "s/| '//; s/'//g" >"$LOCAL_ENV_VAR_FILE"
}

CALLED_FROM=$PWD

if [ "${1:-}" == "test" ]; then
Expand All @@ -24,17 +36,37 @@ elif [ $# == 2 ] && [ "$1" == "start" ] && [ "$2" == "--sandbox" ]; then
# Compose file to use
FILE_ARG="-f $HOME/.aztec/docker-compose.sandbox.yml"

# Function to be executed when SIGINT is received.
# Function to be executed when SIGINT is received.
cleanup() {
get_compose $FILE_ARG down
}

# Set trap to catch SIGINT and call the cleanup function.
trap cleanup SIGINT

get_compose -p sandbox $FILE_ARG up --force-recreate --remove-orphans
get_compose -p sandbox $FILE_ARG up --force-recreate --remove-orphans
elif [ "${1:-}" == "start" ]; then
$(dirname $0)/.aztec-run aztecprotocol/aztec "$@"
# export ENV_VARS_TO_INJECT=$(<.aztec_cli_vars)

# Grab env vars from aztec project
if [[ ! -f "$LOCAL_ENV_VAR_FILE" ]]; then
echo "No env vars file found, creating one..."
# Create temp container
temp_container_id=$(docker create aztecprotocol/aztec:$VERSION)
# Copy env vars file from container
docker cp ${temp_container_id}:$TS_ENV_VAR_FILE $LOCAL_TS_FILE &> /dev/null
# Remove temp container
docker rm $temp_container_id &> /dev/null

# Parse the TypeScript file
parse_ts_file
rm $LOCAL_TS_FILE
fi

# Read env vars from file
readarray -t ENV_VARS_TO_INJECT <"$LOCAL_ENV_VAR_FILE"
export ENV_VARS_TO_INJECT="${ENV_VARS_TO_INJECT[*]}"
ENV_VARS_TO_INJECT="${ENV_VARS_TO_INJECT[*]}" INHERIT_USER=0 $(dirname $0)/.aztec-run aztecprotocol/aztec "$@"
else
SKIP_PORT_ASSIGNMENT=1 $(dirname $0)/.aztec-run aztecprotocol/aztec "$@"
fi
31 changes: 16 additions & 15 deletions aztec-up/bin/aztec-install
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
set -euo pipefail

# Colors
g="\033[32m" # Green
y="\033[33m" # Yellow
b="\033[34m" # Blue
p="\033[35m" # Purple
r="\033[0m" # Reset
g="\033[32m" # Green
y="\033[33m" # Yellow
b="\033[34m" # Blue
p="\033[35m" # Purple
r="\033[0m" # Reset
bold="\033[1m"

# Function to replace characters and add color
function print_colored() {
local b=$'\033[34m' # Blue
local y=$'\033[33m' # Yellow
local r=$'\033[0m' # Reset
echo "$1" | sed -E "s/(█+)/${b}\1${y}/g"
local b=$'\033[34m' # Blue
local y=$'\033[33m' # Yellow
local r=$'\033[0m' # Reset
echo "$1" | sed -E "s/(█+)/${b}\1${y}/g"
}

function title() {
Expand All @@ -32,11 +32,11 @@ function title() {
echo
if [ "$(uname -s)" == "Darwin" ]; then
echo -e "${y}WARNING: For best performance we recommend adjusting your default docker settings:"
echo -e " - Under general, enable VirtioFS."
echo -e " - Under resources, set CPUs to ~80% your maximum."
echo -e " - Under resources, set Memory to ~80% your maximum."
echo -e "You may receive a warning about your home directory being mounted into a container."
echo -e "This is requested so we can read and write project files, that is all."
echo -e " - Under general, enable VirtioFS."
echo -e " - Under resources, set CPUs to ~80% your maximum."
echo -e " - Under resources, set Memory to ~80% your maximum."
echo -e "You may receive a warning about your home directory being mounted into a container."
echo -e "This is requested so we can read and write project files, that is all."
echo -e "${r}"
fi
echo -e "This will install the following scripts and update your PATH if necessary:"
Expand Down Expand Up @@ -126,6 +126,7 @@ install_bin aztec
install_bin aztec-up
install_bin aztec-nargo
install_bin aztec-wallet
install_bin .aztec_cli_vars

function update_path_env_var {
TARGET_DIR="${1}"
Expand Down Expand Up @@ -159,7 +160,7 @@ function update_path_env_var {
fi

# Add the target directory to the user's PATH in their profile.
echo "export PATH=\"\$PATH:$TARGET_DIR\"" >> "$SHELL_PROFILE"
echo "export PATH=\"\$PATH:$TARGET_DIR\"" >>"$SHELL_PROFILE"

if [ -z "${NON_INTERACTIVE:-}" ]; then
info "Done! Starting fresh shell..."
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"acir",
"acvm",
"addrs",
"alphanet",
"archiver",
"assignement",
"asyncify",
Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
PXE_DATA_DIRECTORY: /var/lib/aztec/pxe
NODE_NO_WARNINGS: 1
AZTEC_PORT: 8080
MNEMONIC: "test test test test test test test test test test test junk"
entrypoint: >
sh -c '
export AZTEC_NODE_URL=$$(cat /var/run/secrets/aztec-node-url);
Expand Down Expand Up @@ -61,7 +62,7 @@ services:
P2P_ENABLED: true
PEER_ID_PRIVATE_KEY:
AZTEC_PORT: 8999
TEL_COLLECTOR_BASE_URL: ${TEL_COLLECTOR_BASE_URL:-http://otel-collector:4318}
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
secrets:
- ethereum-host
- p2p-boot-node
Expand All @@ -76,13 +77,13 @@ services:
# if the stack is started with --profile metrics --profile node, give the collector a chance to start before the node
i=0
max=3
while ! curl --head --silent $$TEL_COLLECTOR_BASE_URL > /dev/null; do
while ! curl --head --silent $$OTEL_EXPORTER_OTLP_ENDPOINT > /dev/null; do
echo "OpenTelemetry collector not up. Retrying after 1s";
sleep 1;
i=$$((i+1));
if [ $$i -eq $$max ]; then
echo "OpenTelemetry collector at $$TEL_COLLECTOR_BASE_URL not up after $${max}s. Running without metrics";
unset TEL_COLLECTOR_BASE_URL;
echo "OpenTelemetry collector at $$OTEL_EXPORTER_OTLP_ENDPOINT not up after $${max}s. Running without metrics";
unset OTEL_EXPORTER_OTLP_ENDPOINT;
break
fi;
done;
Expand Down
2 changes: 1 addition & 1 deletion iac/mainnet-fork/redeploy
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3
3
Loading

0 comments on commit 8021eda

Please sign in to comment.