Skip to content
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

Merged
merged 43 commits into from
Feb 26, 2025
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1140b31
fix: support multiple L1 node URLs
spypsy Feb 12, 2025
b2faca5
leftovers
spypsy Feb 12, 2025
16146ca
more fixes
spypsy Feb 12, 2025
4f79daf
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 12, 2025
286954a
fix --rpc-url usage
spypsy Feb 12, 2025
f0e23a1
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 12, 2025
0fad63b
fix imports + tests
spypsy Feb 12, 2025
09ea2b1
undo test change
spypsy Feb 12, 2025
d6334bb
update --l1-rpc-urls
spypsy Feb 12, 2025
dd1e0ef
fix imports
spypsy Feb 13, 2025
6d45015
another import
spypsy Feb 13, 2025
4fb917e
externalHosts
spypsy Feb 13, 2025
d129c99
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 20, 2025
4836dd9
post-merge fixes
spypsy Feb 20, 2025
bbacaaf
more post-merge fixes
spypsy Feb 20, 2025
4a91b45
fix e2e test
spypsy Feb 20, 2025
8714406
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 21, 2025
29a1311
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 24, 2025
24ccc68
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 24, 2025
da0e3cb
PR Fixes
spypsy Feb 24, 2025
842ae5d
update docs
spypsy Feb 24, 2025
685d0c5
update docs
spypsy Feb 24, 2025
12cc436
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 24, 2025
688014a
fix typings
spypsy Feb 25, 2025
aa5fa6c
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 25, 2025
8e79c39
fix wallet client types
spypsy Feb 25, 2025
e438592
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 25, 2025
eca0f24
use multi-urls in cheatcode
spypsy Feb 25, 2025
889caad
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 25, 2025
fe3d7d3
fix helper spartan script
spypsy Feb 25, 2025
c489937
fix e2e cheat_codes
spypsy Feb 25, 2025
85c007f
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 25, 2025
1547a62
rm unused import
spypsy Feb 25, 2025
67c81a9
PR Fixes
spypsy Feb 26, 2025
d58918e
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 26, 2025
fc382de
deploy l1 contracts fixes
spypsy Feb 26, 2025
bb6975c
fix type imports
spypsy Feb 26, 2025
9405407
update gh secret names
spypsy Feb 26, 2025
36c9e22
break, don't return
spypsy Feb 26, 2025
b111170
no need to retry get-chain-id
spypsy Feb 26, 2025
da839b8
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 26, 2025
4be11a4
Merge branch 'master' into spy/multi-rpc-urls
spypsy Feb 26, 2025
3bd421e
merge fix
spypsy Feb 26, 2025
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
18 changes: 10 additions & 8 deletions spartan/aztec-network/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -210,14 +210,16 @@ if [ -n "${EXTERNAL_ETHEREUM_HOSTS}" ]; then
export ETHEREUM_HOSTS="${EXTERNAL_ETHEREUM_HOSTS}"
fi
echo "Awaiting any ethereum node from: ${ETHEREUM_HOSTS}"
for HOST in $(echo "${ETHEREUM_HOSTS}" | tr ',' '\n'); do
if curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":67}' \
"${HOST}" | grep -q 0x; then
echo "Ethereum node ${HOST} is ready!"
break
fi
echo "Waiting for Ethereum node ${HOST}..."
while true; do
for HOST in $(echo "${ETHEREUM_HOSTS}" | tr ',' '\n'); do
if curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":67}' \
"${HOST}" | grep -q 0x; then
echo "Ethereum node ${HOST} is ready!"
return 0
fi
echo "Waiting for Ethereum node ${HOST}..."
done
sleep 5
done
{{- end -}}
Original file line number Diff line number Diff line change
@@ -27,29 +27,24 @@ export PRIVATE_KEY=${PRIVATE_KEY:-""}
export SALT=${SALT:-"1337"}

echo "Waiting for Ethereum node to be up..."
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
while true; do
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 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

fi
echo "Waiting for Ethereum node ${HOST}..."
done
sleep 5
done

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"

# Construct base command
COMMAND="node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js \
deploy-l1-contracts \
1 change: 0 additions & 1 deletion yarn-project/ethereum/package.json
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@
},
"scripts": {
"build": "yarn clean && tsc -b",
"b": "tsc -b ./src/try.ts",
"build:dev": "tsc -b --watch",
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
6 changes: 0 additions & 6 deletions yarn-project/ethereum/src/eth_cheat_codes.ts
Original file line number Diff line number Diff line change
@@ -29,13 +29,7 @@ export class EthCheatCodes {

async rpcCall(method: string, params: any[]) {
const paramsString = JSON.stringify(params);
// const content = {
// body: `{"jsonrpc":"2.0", "method": "${method}", "params": ${paramsString}, "id": 1}`,
// method: 'POST',
// headers: { 'Content-Type': 'application/json' },
// };
this.logger.info(`Calling ${method} with params: ${paramsString} on ${this.rpcUrls.join(', ')}`);
// return await (await fetch(this.rpcUrl, content)).json();
return (await this.publicClient.transport.request({
method,
params,