-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore!: enable multiple L1 nodes to be used #11945
Changes from 1 commit
1140b31
b2faca5
16146ca
4f79daf
286954a
f0e23a1
0fad63b
09ea2b1
d6334bb
dd1e0ef
6d45015
4fb917e
d129c99
4836dd9
bbacaaf
4a91b45
8714406
29a1311
24ccc68
da0e3cb
842ae5d
685d0c5
12cc436
688014a
aa5fa6c
8e79c39
e438592
eca0f24
889caad
fe3d7d3
c489937
85c007f
1547a62
67c81a9
d58918e
fc382de
bb6975c
9405407
36c9e22
b111170
da839b8
4be11a4
3bd421e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,16 +27,29 @@ export PRIVATE_KEY=${PRIVATE_KEY:-""} | |
export SALT=${SALT:-"1337"} | ||
|
||
echo "Waiting for Ethereum node to be up..." | ||
until curl -s -X POST -H 'Content-Type: application/json' \ | ||
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ | ||
$ETHEREUM_HOSTS 2>/dev/null | grep -q 'result'; do | ||
found_node=0 | ||
for HOST in $(echo "${ETHEREUM_HOSTS}" | tr ',' '\n'); do | ||
if curl -s -X POST -H 'Content-Type: application/json' \ | ||
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ | ||
"$HOST" 2>/dev/null | grep -q 'result'; then | ||
echo "Node $HOST is ready" | ||
found_node=1 | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heads up this is not equivalent to the previous one: the new one will exit if the node is not immediately available, while the previous one will retry. Given this is called simultaneously to |
||
|
||
if [ $found_node -eq 0 ]; then | ||
echo "No Ethereum nodes available" | ||
exit 1 | ||
fi | ||
echo "Done waiting." | ||
|
||
# Fetch chain ID from the Ethereum node | ||
source "$REPO"/yarn-project/end-to-end/scripts/native-network/utils/get-chain-id.sh | ||
|
||
echo "L1_CHAIN_ID: $L1_CHAIN_ID" | ||
spypsy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Construct base command | ||
COMMAND="node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js \ | ||
deploy-l1-contracts \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
export L1_CHAIN_ID=$(curl -s -X POST -H "Content-Type: application/json" \ | ||
--data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \ | ||
$ETHEREUM_HOSTS | grep -o '"result":"0x[^"]*"' | cut -d'"' -f4 | xargs printf "%d\n") | ||
#!/bin/sh | ||
|
||
echo "Using L1 chain ID: $L1_CHAIN_ID" | ||
# Split on commas and try each host | ||
for HOST in $(echo "${ETHEREUM_HOSTS}" | tr ',' '\n'); do | ||
RESULT=$(curl -s -X POST -H "Content-Type: application/json" \ | ||
--data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \ | ||
"$HOST") | ||
if echo "$RESULT" | grep -q '"result":"0x'; then | ||
export L1_CHAIN_ID=$(echo "$RESULT" | grep -o '"result":"0x[^"]*"' | cut -d'"' -f4 | xargs printf "%d\n") | ||
echo "Using L1 chain ID: $L1_CHAIN_ID from $HOST" | ||
return 0 | ||
fi | ||
done | ||
|
||
echo "Error: Could not get chain ID from any host in: $ETHEREUM_HOSTS" | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the scope of this exit 0? IIUC this template gets pasted as-is where it is
include
d, so any operations after this helper would not run due to the early exit. This would affect egdeploy-l1-contracts
:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, reviewed this in an outdated commit and it was already fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, I think the new version doesn't do what we expect. I understand it loops over every host, waiting for 5s inbetween them, and exits once the first one replies. But it doesn't go back to the first one to retry if all failed, it just goes through, right?