Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/scripts/extract_l1_addresses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

FILE_PATH=./script_output

# Read the file line by line
while IFS= read -r line; do
# Extract the hexadecimal address using awk
address=$(echo "$line" | awk '{print $NF}')

# Assign the address to the respective variable based on the line content
if [[ $line == *"Rollup Address"* ]]; then
export TF_VAR_ROLLUP_CONTRACT_ADDRESS=$address
echo "TF_VAR_ROLLUP_CONTRACT_ADDRESS=$TF_VAR_ROLLUP_CONTRACT_ADDRESS"
elif [[ $line == *"Registry Address"* ]]; then
export TF_VAR_REGISTRY_CONTRACT_ADDRESS=$address
echo "TF_VAR_REGISTRY_CONTRACT_ADDRESS=$TF_VAR_REGISTRY_CONTRACT_ADDRESS"
elif [[ $line == *"Inbox Address"* ]]; then
export TF_VAR_INBOX_CONTRACT_ADDRESS=$address
echo "TF_VAR_INBOX_CONTRACT_ADDRESS=$TF_VAR_INBOX_CONTRACT_ADDRESS"
elif [[ $line == *"Outbox Address"* ]]; then
export TF_VAR_OUTBOX_CONTRACT_ADDRESS=$address
echo "TF_VAR_OUTBOX_CONTRACT_ADDRESS=$TF_VAR_OUTBOX_CONTRACT_ADDRESS"
elif [[ $line == *"Oracle Address"* ]]; then
export TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$address
echo "TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS"
elif [[ $line == *"Gas Token Address"* ]]; then
export TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS=$address
echo "TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS=$TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS"
elif [[ $line == *"Gas Portal Address"* ]]; then
export TF_VAR_GAS_PORTAL_CONTRACT_ADDRESS=$address
echo "TF_VAR_GAS_PORTAL_CONTRACT_ADDRESS=$TF_VAR_GAS_PORTAL_CONTRACT_ADDRESS"
else
echo "Unknown contract address: $line"
fi
done <"$FILE_PATH"

# echo all addresses into github env
echo "TF_VAR_ROLLUP_CONTRACT_ADDRESS=$TF_VAR_ROLLUP_CONTRACT_ADDRESS" >>$GITHUB_ENV
echo "TF_VAR_REGISTRY_CONTRACT_ADDRESS=$TF_VAR_REGISTRY_CONTRACT_ADDRESS" >>$GITHUB_ENV
echo "TF_VAR_INBOX_CONTRACT_ADDRESS=$TF_VAR_INBOX_CONTRACT_ADDRESS" >>$GITHUB_ENV
echo "TF_VAR_OUTBOX_CONTRACT_ADDRESS=$TF_VAR_OUTBOX_CONTRACT_ADDRESS" >>$GITHUB_ENV
echo "TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS" >>$GITHUB_ENV
echo "TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS=$TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS" >>$GITHUB_ENV
echo "TF_VAR_GAS_PORTAL_CONTRACT_ADDRESS=$TF_VAR_GAS_PORTAL_CONTRACT_ADDRESS" >>$GITHUB_ENV

# Set global variable for redeployment of contracts
echo "CONTRACTS_DEPLOYED=1" >>$GITHUB_ENV
30 changes: 29 additions & 1 deletion .github/workflows/devnet-deploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ concurrency:
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
GIT_COMMIT: ${{ github.sha }}
DEPLOY_TAG: devnet
FILE_PATH: ./l1-contracts/addresses.txt
# TF Vars
TF_VAR_DOCKERHUB_ACCOUNT: aztecprotocol
TF_VAR_CHAIN_ID: 31337
Expand All @@ -35,8 +37,8 @@ jobs:
with: { ref: "${{ env.GIT_COMMIT }}" }
- uses: ./.github/ci-setup-action
with:
dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}"
concurrency_key: build-release-artifacts-${{ github.actor }}
dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}"
- name: "Build & Push images"
timeout-minutes: 40
# Run the build steps for each image with version and arch, push to dockerhub
Expand All @@ -60,6 +62,32 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Check if L1 contracts need deployment
id: check_changes
uses: actions/github-script@v6
with:
script: |
const { execSync } = require('child_process');
const changedFiles = execSync('git diff --name-only ${{ github.event.before }} ${{ github.sha }}').toString().split('\n');
const fileChanged = changedFiles.includes('l1-contracts/REDEPLOY');
return { fileChanged };

- name: Deploy L1 Contracts
if: steps.check_changes.outputs.fileChanged == 'true'
run: |
earthly-ci --no-output ./yarn-project/cli+deploy-l1-contracts \
--PRIVATE_KEY=${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} \
--RPC_URL=https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ secrets.FORK_API_KEY }} \
| tee ${{ env.FILE_PATH }}
./scripts/extract_l1_addresses.sh ${{ env.FILE_PATH }}

- name: Apply l1-contracts Terraform
if: steps.check_changes.outputs.fileChanged == 'true'
working-directory: ./l1-contracts/terraform
run: |
terraform init -input=false -backend-config="key=devnet/l1-contracts"
terraform apply -input=false -auto-approve

- name: Deploy P2P Bootstrap Nodes
working-directory: ./yarn-project/p2p-bootstrap/terraform
run: |
Expand Down
2 changes: 1 addition & 1 deletion iac/mainnet-fork/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ resource "aws_ecs_task_definition" "aztec_mainnet_fork" {
[
{
"name": "${var.DEPLOY_TAG}-mainnet-fork",
"image": "${var.DOCKERHUB_ACCOUNT}/mainnet-fork:${var.DEPLOY_TAG}",
"image": "${var.DOCKERHUB_ACCOUNT}/mainnet-fork:aztec-dev",
"essential": true,
"environment": [
{
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ VERSION 0.8
build:
FROM ../build-images+build
WORKDIR /usr/src/l1-contracts
COPY --dir lib scripts src terraform test *.json *.toml *.sh .
COPY --dir lib src terraform test *.json *.toml *.sh .
#RUN git init && git add . && yarn lint && yarn slither && yarn slither-has-diff
# "slither": "forge clean && forge build --build-info --skip '*/test/**' --force && slither . --checklist --ignore-compile --show-ignored-findings --config-file ./slither.config.json | tee slither_output.md",
# "slither-has-diff": "./slither_has_diff.sh"
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/REDEPLOY
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Append value to force redeploy
5
1
96 changes: 0 additions & 96 deletions l1-contracts/scripts/ci_deploy_contracts.sh

This file was deleted.

4 changes: 2 additions & 2 deletions yarn-project/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ rollup-verifier-contract:
RUN --entrypoint write-contract -c RootRollupArtifact -n UltraVerifier.sol
SAVE ARTIFACT /usr/src/bb /usr/src/bb

txe:
txe:
FROM +build
RUN yarn workspaces focus @aztec/txe --production && yarn cache clean
# Remove a bunch of stuff that we don't need that takes up space.
Expand Down Expand Up @@ -179,7 +179,7 @@ aztec-faucet-build:
aztec-faucet:
FROM ubuntu:noble
RUN apt update && apt install nodejs curl -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY +aztec-faucet/usr/src /usr/src
COPY +aztec-faucet-build/usr/src /usr/src
ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/aztec-faucet/dest/bin/index.js"]
LET port=8080

Expand Down
20 changes: 20 additions & 0 deletions yarn-project/cli/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
VERSION 0.8


aztec-cli:
FROM ../+build
RUN yarn workspaces focus @aztec/cli --production && yarn cache clean

RUN mkdir /cache && chmod 777 /cache
ENV XDG_CACHE_HOME /cache
VOLUME "/cache"
ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/cli/dest/bin/index.js"]

deploy-l1-contracts:
FROM +aztec-cli
ARG PRIVATE_KEY
ARG RPC_URL
ENV PRIVATE_KEY=$PRIVATE_KEY
ENV ETHEREUM_HOST=$RPC_URL
RUN echo "Deploying L1 contracts with PRIVATE_KEY=$PRIVATE_KEY and RPC_URL=$RPC_URL"
RUN --entrypoint deploy-l1-contracts
2 changes: 1 addition & 1 deletion yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function createL1Clients(
}

/**
* Deploys the aztec L1 contracts; Rollup, Contract Deployment Emitter & (optionally) Decoder Helper.
* Deploys the aztec L1 contracts; Rollup & (optionally) Decoder Helper.
* @param rpcUrl - URL of the ETH RPC to use for deployment.
* @param account - Private Key or HD Account that will deploy the contracts.
* @param chain - The chain instance to deploy to.
Expand Down