Skip to content

Commit 9c08e00

Browse files
authored
chore: wait for ethereum in each pod (#11238)
Should fix some flake in kind network smoke. Key was the following logs I found in a failing run: ``` spartan-aztec-network-boot-node-0 deploy-create2-deployer Error: spartan-aztec-network-boot-node-0 deploy-create2-deployer error sending request for url (http://spartan-aztec-network-ethereum.smoke:8545/) spartan-aztec-network-boot-node-0 deploy-create2-deployer spartan-aztec-network-boot-node-0 deploy-create2-deployer Context: spartan-aztec-network-boot-node-0 deploy-create2-deployer - Error #0: error sending request for url (http://spartan-aztec-network-ethereum.smoke:8545/) spartan-aztec-network-boot-node-0 deploy-create2-deployer - Error #1: client error (Connect) spartan-aztec-network-boot-node-0 deploy-create2-deployer - Error #2: dns error: failed to lookup address information: Name does not resolve spartan-aztec-network-boot-node-0 deploy-create2-deployer - Error #3: failed to lookup address information: Name does not resolve ```
1 parent dfb0db5 commit 9c08e00

File tree

5 files changed

+21
-33
lines changed

5 files changed

+21
-33
lines changed

spartan/aztec-network/templates/_helpers.tpl

+11
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,14 @@ affinity:
190190
nodeSelector:
191191
cloud.google.com/gke-ephemeral-storage-local-ssd: "true"
192192
{{- end -}}
193+
194+
{{- define "aztec-network.waitForEthereum" -}}
195+
echo "Awaiting ethereum node at ${ETHEREUM_HOST}"
196+
until curl -s -X POST -H 'Content-Type: application/json' \
197+
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":67}' \
198+
${ETHEREUM_HOST} | grep 0x; do
199+
echo "Waiting for Ethereum node ${ETHEREUM_HOST}..."
200+
sleep 5
201+
done
202+
echo "Ethereum node is ready!"
203+
{{- end -}}

spartan/aztec-network/templates/boot-node.yaml

+6-8
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,7 @@ spec:
4747
- |
4848
source /shared/config/service-addresses
4949
cat /shared/config/service-addresses
50-
echo "Awaiting ethereum node at ${ETHEREUM_HOST}"
51-
until curl -s -X POST -H 'Content-Type: application/json' \
52-
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":67}' \
53-
${ETHEREUM_HOST} | grep 0x; do
54-
echo "Waiting for Ethereum node ${ETHEREUM_HOST}..."
55-
sleep 5
56-
done
57-
echo "Ethereum node is ready!"
50+
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
5851
volumeMounts:
5952
- name: config
6053
mountPath: /shared/config
@@ -66,6 +59,10 @@ spec:
6659
- -c
6760
- |
6861
source /shared/config/service-addresses
62+
# it is possible that even though we asserted this above, the DNS resolver of *this* pod
63+
# is not yet ready to resolve the ethereum host.
64+
# so we need to wait for it to be ready.
65+
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
6966
if [ "$(cast code --rpc-url ${ETHEREUM_HOST} 0x4e59b44847b379578588920ca78fbf26c0b4956c)" = "0x" ]; then
7067
echo "Deploying Deterministic Deployment Proxy"
7168
cast publish --rpc-url ${ETHEREUM_HOST} 0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222
@@ -82,6 +79,7 @@ spec:
8279
cp /scripts/deploy-l1-contracts.sh /tmp/deploy-l1-contracts.sh
8380
chmod +x /tmp/deploy-l1-contracts.sh
8481
source /shared/config/service-addresses
82+
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
8583
8684
/tmp/deploy-l1-contracts.sh "{{ .Values.aztec.l1Salt }}" "{{ .Values.ethereum.chainId }}" "{{ join "," .Values.validator.validatorAddresses }}"
8785
volumeMounts:

spartan/aztec-network/templates/faucet.yaml

+1-9
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,7 @@ spec:
4040
- |
4141
source /shared/config/service-addresses
4242
cat /shared/config/service-addresses
43-
44-
echo "Awaiting ethereum node at ${ETHEREUM_HOST}"
45-
until curl -s -X POST -H 'Content-Type: application/json' \
46-
-d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' \
47-
${ETHEREUM_HOST} | grep -q reth; do
48-
echo "Waiting for Ethereum node ${ETHEREUM_HOST}..."
49-
sleep 5
50-
done
51-
echo "Ethereum node is ready!"
43+
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
5244
volumeMounts:
5345
- name: config
5446
mountPath: /shared/config

spartan/aztec-network/templates/prover-node.yaml

+2-7
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,8 @@ spec:
4646
- -c
4747
- |
4848
source /shared/config/service-addresses
49-
until curl -s -X POST -H 'Content-Type: application/json' \
50-
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":67}' \
51-
${ETHEREUM_HOST} | grep 0x; do
52-
echo "Waiting for Ethereum node ${ETHEREUM_HOST}..."
53-
sleep 5
54-
done
55-
echo "Ethereum node is ready!"
49+
cat /shared/config/service-addresses
50+
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
5651
5752
if [ "${PROVER_BROKER_ENABLED}" == "false" ]; then
5853
until curl -s -X POST ${PROVER_BROKER_HOST}/status; do

spartan/aztec-network/templates/validator.yaml

+1-9
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,7 @@ spec:
4949
- |
5050
source /shared/config/service-addresses
5151
cat /shared/config/service-addresses
52-
# First check ethereum node
53-
until curl -s -X POST -H 'Content-Type: application/json' \
54-
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":67}' \
55-
$ETHEREUM_HOST | grep 0x; do
56-
echo "Waiting for Ethereum node ${ETHEREUM_HOST}..."
57-
sleep 5
58-
done
59-
echo "Ethereum node is ready!"
60-
52+
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
6153
6254
if [ "{{ .Values.validator.dynamicBootNode }}" = "true" ]; then
6355
echo "{{ include "aztec-network.pxeUrl" . }}" > /shared/pxe/pxe_url

0 commit comments

Comments
 (0)