Skip to content

Commit

Permalink
refactor: add --faucet to aztec start
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Dec 10, 2024
1 parent 2fea087 commit f5d078b
Show file tree
Hide file tree
Showing 19 changed files with 412 additions and 345 deletions.
49 changes: 0 additions & 49 deletions spartan/aztec-network/files/config/await-service.sh

This file was deleted.

41 changes: 32 additions & 9 deletions spartan/aztec-network/templates/faucet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ spec:
source /shared/config/service-addresses
cat /shared/config/service-addresses
/shared/scripts/await-service.sh "Ethereum" "$ETHEREUM_HOST"
echo "Awaiting ethereum node at ${ETHEREUM_HOST}"
until curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' \
${ETHEREUM_HOST} | grep -q reth; do
echo "Waiting for Ethereum node ${ETHEREUM_HOST}..."
sleep 5
done
echo "Ethereum node is ready!"
volumeMounts:
- name: config
mountPath: /shared/config
Expand All @@ -58,18 +65,18 @@ spec:
- |
source /shared/config/service-addresses
cat /shared/config/service-addresses
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --faucet
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --faucet --faucet.apiServer --faucet.apiServerPort {{ .Values.faucet.apiServerPort }}
env:
- name: FAUCET_PORT
- name: AZTEC_PORT
value: "{{ .Values.faucet.service.nodePort }}"
- name: L1_CHAIN_ID
value: "${{ .Values.ethereum.chainId }}"
value: "{{ .Values.ethereum.chainId }}"
- name: MNEMONIC
value: "${{ .Values.aztec.l1DeploymentMnemonic }}"
- name: MNEMONIC_ACCOUNT_INDEX
value: "${{ .Values.faucet.accountIndex }}"
- name: EXTRA_ASSETS
value: "${{ .Values.faucet.extraAssets }}"
value: "{{ .Values.aztec.l1DeploymentMnemonic }}"
- name: FAUCET_MNEMONIC_ACCOUNT_INDEX
value: "{{ .Values.faucet.accountIndex }}"
- name: FAUCET_L1_ASSETS
value: "{{ .Values.faucet.l1Assets }}"
- name: LOG_JSON
value: "1"
- name: LOG_LEVEL
Expand Down Expand Up @@ -99,3 +106,19 @@ spec:
{{- if and (eq .Values.faucet.service.type "NodePort") .Values.faucet.service.nodePort }}
nodePort: {{ .Values.faucet.service.nodePort }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "aztec-network.fullname" . }}-faucet-api
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
type: ClusterIP
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: faucet
ports:
- protocol: TCP
port: {{ .Values.faucet.apiServerPort }}
targetPort: {{ .Values.faucet.apiServerPort }}
2 changes: 0 additions & 2 deletions spartan/aztec-network/templates/scripts-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ data:
{{ .Files.Get "files/config/config-prover-env.sh" | nindent 4 }}
deploy-l1-contracts.sh: |
{{ .Files.Get "files/config/deploy-l1-contracts.sh" | nindent 4 }}
await-service.sh: |
{{ .Files.Get "files/config/await-service.sh" | nindent 4 }}
3 changes: 2 additions & 1 deletion spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,6 @@ jobs:
faucet:
service:
nodePort: 8085
apiServerPort: 8086
accountIndex: 0
extraAssets: ""
l1Assets: ""
5 changes: 4 additions & 1 deletion yarn-project/aztec-faucet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"main": "dest/bin/index.js",
"type": "module",
"bin": "./dest/bin/index.js",
"exports": {
".": "./dest/index.js"
},
"typedocOptions": {
"entryPoints": [
"./src/bin/index.ts"
Expand Down Expand Up @@ -62,8 +65,8 @@
"@aztec/ethereum": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/l1-artifacts": "workspace:^",
"@koa/cors": "^5.0.0",
"koa": "^2.14.2",
"koa-cors": "^0.0.16",
"koa-router": "^12.0.0",
"viem": "^2.7.15"
},
Expand Down
Loading

0 comments on commit f5d078b

Please sign in to comment.