Skip to content

Commit

Permalink
Merge dd88e3d into 7f95ee7
Browse files Browse the repository at this point in the history
  • Loading branch information
just-mitch authored Aug 23, 2024
2 parents 7f95ee7 + dd88e3d commit c0394dd
Show file tree
Hide file tree
Showing 39 changed files with 914 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
# (Note ARM uses just 2 tests as a smoketest)
- name: Create list of non-bench end-to-end jobs
id: e2e_list
run: echo "list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+bench' | grep -v 'devnet' | sed 's/+//' | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT
run: echo "list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+bench' | grep -v "+network" | grep -v 'devnet' | sed 's/+//' | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT
- name: Create list of bench end-to-end jobs
id: bench_list
run: echo "list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT
Expand Down
23 changes: 23 additions & 0 deletions helm-charts/aztec-network/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions helm-charts/aztec-network/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: aztec-network
description: A Helm chart for deploying the aztec network
type: application
version: 0.1.0
appVersion: "1.0.0"
59 changes: 59 additions & 0 deletions helm-charts/aztec-network/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "aztec-network.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "aztec-network.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "aztec-network.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "aztec-network.labels" -}}
helm.sh/chart: {{ include "aztec-network.chart" . }}
{{ include "aztec-network.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "aztec-network.selectorLabels" -}}
app.kubernetes.io/name: {{ include "aztec-network.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "aztec-network.ethereumHost" -}}
http://{{ include "aztec-network.fullname" . }}-ethereum.{{ .Release.Namespace }}:{{ .Values.ethereum.service.port }}
{{- end -}}

{{- define "aztec-network.pxeUrl" -}}
http://{{ include "aztec-network.fullname" . }}-pxe.{{ .Release.Namespace }}:{{ .Values.pxe.service.port }}
{{- end -}}
58 changes: 58 additions & 0 deletions helm-charts/aztec-network/templates/anvil.deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "aztec-network.fullname" . }}-ethereum
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.ethereum.replicas }}
selector:
matchLabels:
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: ethereum
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: ethereum
spec:
containers:
- name: ethereum
image: "{{ .Values.images.foundry.image }}"
imagePullPolicy: {{ .Values.images.foundry.pullPolicy }}
command: ["/bin/sh", "-c"]
args:
- |
[ -n "$FORK_URL" ] && ARGS="$ARGS --fork-url $FORK_URL";
[ -n "$FORK_BLOCK_NUMBER" ] && ARGS="$ARGS --fork-block-number $FORK_BLOCK_NUMBER";
echo anvil -p $ANVIL_PORT --host 0.0.0.0 --chain-id {{ .Values.ethereum.chainId }} $ARGS;
anvil -p $ANVIL_PORT --host 0.0.0.0 --chain-id {{ .Values.ethereum.chainId }} $ARGS;
ports:
- containerPort: {{ .Values.ethereum.service.port }}
name: anvil
env:
- name: FORK_URL
value: {{ .Values.ethereum.forkUrl | quote }}
- name: FORK_BLOCK_NUMBER
value: {{ .Values.ethereum.forkBlockNumber | quote }}
- name: ANVIL_PORT
value: {{ .Values.ethereum.service.port | quote }}
- name: ARGS
value: {{ .Values.ethereum.args | quote }}
readinessProbe:
exec:
command:
- sh
- -c
- |
wget -qO- --post-data='{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' \
--header='Content-Type: application/json' \
127.0.0.1:{{ .Values.ethereum.service.port }} \
| grep -q '"result":"anvil'
initialDelaySeconds: {{ .Values.ethereum.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.ethereum.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.ethereum.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.ethereum.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.ethereum.readinessProbe.failureThreshold }}
resources:
{{- toYaml .Values.ethereum.resources | nindent 12 }}
18 changes: 18 additions & 0 deletions helm-charts/aztec-network/templates/anvil.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "aztec-network.fullname" . }}-ethereum
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
type: {{ .Values.ethereum.service.type }}
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: ethereum
ports:
- protocol: TCP
port: {{ .Values.ethereum.service.port }}
targetPort: {{ .Values.ethereum.service.targetPort }}
{{- if and (eq .Values.ethereum.service.type "NodePort") .Values.ethereum.service.nodePort }}
nodePort: {{ .Values.ethereum.service.nodePort }}
{{- end }}
16 changes: 16 additions & 0 deletions helm-charts/aztec-network/templates/boot-node.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "aztec-network.fullname" . }}-boot-node
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
clusterIP: None
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: boot-node
ports:
- port: {{ .Values.bootNode.service.p2pPort }}
name: p2p
- port: {{ .Values.bootNode.service.nodePort }}
name: node
103 changes: 103 additions & 0 deletions helm-charts/aztec-network/templates/boot-node.stateful-set.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "aztec-network.fullname" . }}-boot-node
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
serviceName: {{ include "aztec-network.fullname" . }}-boot-node
replicas: {{ .Values.bootNode.replicas }}
selector:
matchLabels:
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: boot-node
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: boot-node
spec:
initContainers:
- name: wait-for-ethereum
image: {{ .Values.images.curl.image }}
command:
- /bin/sh
- -c
- |
until curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' \
{{ include "aztec-network.ethereumHost" . }} | grep -q anvil; do
echo "Waiting for Ethereum node..."
sleep 5
done
echo "Ethereum node is ready!"
- name: deploy-contracts
image: {{ .Values.images.aztec.image }}
command:
[
"/bin/sh",
"-c",
"cp /scripts/deploy-contracts.sh /tmp/deploy-contracts.sh && chmod +x /tmp/deploy-contracts.sh && /tmp/deploy-contracts.sh",
]
volumeMounts:
- name: shared-volume
mountPath: /shared
- name: scripts
mountPath: /scripts
env:
- name: ETHEREUM_HOST
value: {{ include "aztec-network.ethereumHost" . | quote }}
containers:
- name: aztec
image: {{ .Values.images.aztec.image }}
command:
[
"/bin/bash",
"-c",
"source /shared/contracts.env && env && node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --node --archiver --sequencer",
]
volumeMounts:
- name: shared-volume
mountPath: /shared
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_DNS_NAME
value: "$(POD_NAME).{{ include "aztec-network.fullname" . }}-boot-node.$(POD_NAMESPACE).svc.cluster.local"
- name: PORT
value: "{{ .Values.bootNode.service.nodePort }}"
- name: LOG_LEVEL
value: "{{ .Values.bootNode.logLevel }}"
- name: DEBUG
value: "{{ .Values.bootNode.debug }}"
- name: ETHEREUM_HOST
value: {{ include "aztec-network.ethereumHost" . | quote }}
- name: P2P_ENABLED
value: "{{ .Values.bootNode.p2p.enabled }}"
- name: P2P_TCP_ANNOUNCE_ADDR
value: "$(POD_DNS_NAME):{{ .Values.bootNode.service.p2pPort }}"
- name: P2P_UDP_ANNOUNCE_ADDR
value: "$(POD_DNS_NAME):{{ .Values.bootNode.service.p2pPort }}"
- name: P2P_TCP_LISTEN_ADDR
value: "0.0.0.0:{{ .Values.bootNode.service.p2pPort }}"
- name: P2P_UDP_LISTEN_ADDR
value: "0.0.0.0:{{ .Values.bootNode.service.p2pPort }}"
- name: VALIDATOR_PRIVATE_KEY
value: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"
ports:
- containerPort: "{{ .Values.bootNode.service.nodePort }}"
- containerPort: "{{ .Values.bootNode.service.p2pPort }}"
resources:
{{- toYaml .Values.bootNode.resources | nindent 12 }}
volumes:
- name: shared-volume
emptyDir: {}
- name: scripts
configMap:
name: {{ include "aztec-network.fullname" . }}-deploy-contracts-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "aztec-network.fullname" . }}-configure-validator-env
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
data:
configure-validator-env.sh: |
#!/bin/sh
set -e
# Ask the bootnode for l1 contract addresses
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js get-node-info -u http://{{ include "aztec-network.fullname" . }}-boot-node-0.{{ include "aztec-network.fullname" . }}-boot-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.bootNode.service.nodePort }})
echo "$output"
boot_node_enr=$(echo "$output" | grep -oP 'Node ENR: \Kenr:[a-zA-Z0-9\-\_\.]+')
rollup_address=$(echo "$output" | grep -oP 'Rollup Address: \K0x[a-fA-F0-9]{40}')
registry_address=$(echo "$output" | grep -oP 'Registry Address: \K0x[a-fA-F0-9]{40}')
inbox_address=$(echo "$output" | grep -oP 'L1 -> L2 Inbox Address: \K0x[a-fA-F0-9]{40}')
outbox_address=$(echo "$output" | grep -oP 'L2 -> L1 Outbox Address: \K0x[a-fA-F0-9]{40}')
availability_oracle_address=$(echo "$output" | grep -oP 'Availability Oracle Address: \K0x[a-fA-F0-9]{40}')
fee_juice_address=$(echo "$output" | grep -oP 'Fee Juice Address: \K0x[a-fA-F0-9]{40}')
fee_juice_portal_address=$(echo "$output" | grep -oP 'Fee Juice Portal Address: \K0x[a-fA-F0-9]{40}')
# Write the addresses to a file in the shared volume
cat <<EOF > /shared/contracts.env
export BOOTSTRAP_NODES=$boot_node_enr
export ROLLUP_CONTRACT_ADDRESS=$rollup_address
export REGISTRY_CONTRACT_ADDRESS=$registry_address
export INBOX_CONTRACT_ADDRESS=$inbox_address
export OUTBOX_CONTRACT_ADDRESS=$outbox_address
export AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$availability_oracle_address
export FEE_JUICE_CONTRACT_ADDRESS=$fee_juice_address
export FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$fee_juice_portal_address
EOF
cat /shared/contracts.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "aztec-network.fullname" . }}-deploy-contracts-script
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
data:
deploy-contracts.sh: |
#!/bin/sh
set -e
# Run the deploy-l1-contracts command and capture the output
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts)
echo "$output"
# Extract contract addresses using grep and regex
rollup_address=$(echo "$output" | grep -oP 'Rollup Address: \K0x[a-fA-F0-9]{40}')
registry_address=$(echo "$output" | grep -oP 'Registry Address: \K0x[a-fA-F0-9]{40}')
inbox_address=$(echo "$output" | grep -oP 'L1 -> L2 Inbox Address: \K0x[a-fA-F0-9]{40}')
outbox_address=$(echo "$output" | grep -oP 'L2 -> L1 Outbox Address: \K0x[a-fA-F0-9]{40}')
availability_oracle_address=$(echo "$output" | grep -oP 'Availability Oracle Address: \K0x[a-fA-F0-9]{40}')
fee_juice_address=$(echo "$output" | grep -oP 'Fee Juice Address: \K0x[a-fA-F0-9]{40}')
fee_juice_portal_address=$(echo "$output" | grep -oP 'Fee Juice Portal Address: \K0x[a-fA-F0-9]{40}')
# Write the addresses to a file in the shared volume
cat <<EOF > /shared/contracts.env
export ROLLUP_CONTRACT_ADDRESS=$rollup_address
export REGISTRY_CONTRACT_ADDRESS=$registry_address
export INBOX_CONTRACT_ADDRESS=$inbox_address
export OUTBOX_CONTRACT_ADDRESS=$outbox_address
export AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$availability_oracle_address
export FEE_JUICE_CONTRACT_ADDRESS=$fee_juice_address
export FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$fee_juice_portal_address
EOF
cat /shared/contracts.env
Loading

0 comments on commit c0394dd

Please sign in to comment.