Skip to content

Commit

Permalink
uses geth binary instead of docker
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Jan 22, 2025
1 parent 8271bb8 commit 23eb81d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 39 deletions.
54 changes: 31 additions & 23 deletions web/packages/test/scripts/electra-deploy-ethereum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,38 @@
set -eu

source scripts/set-env.sh
export output_electra_dir="/tmp/electra"

start_geth() {
rm -rf $output_electra_dir
mkdir -p $output_electra_dir
mkdir -p $output_electra_dir/ethereum
cp config/genesis-electra.json $output_electra_dir
cp config/jwtsecret $output_electra_dir
pushd "$root_dir/.."

GETH_PATH="go-ethereum-lightclient/build/bin/geth"

# Install Electra geth binary
if [ ! -f "$GETH_PATH" ]; then
echo "Local geth binary not found at $GETH_PATH."
echo "Cloning and building go-ethereum-lightclient..."

git clone https://github.com/lightclient/go-ethereum.git go-ethereum-lightclient
pushd go-ethereum-lightclient
git checkout prague-devnet-4
make geth

./build/bin/geth version

popd
else
echo "Local geth binary already exists at $GETH_PATH. Skipping clone and build."
fi

echo "Starting geth local node"
docker run --rm \
-v "${output_electra_dir}:/mnt" \
docker.io/ethpandaops/geth:lightclient-prague-devnet-4 \
--datadir /mnt/ethereum \
./go-ethereum-lightclient/build/bin/geth \
--datadir "$output_dir/ethereum" \
--state.scheme=hash \
init /mnt/genesis-electra.json
docker run --rm -m=12g --memory-reservation=8g --cpus 2 \
-v "${output_electra_dir}:/mnt" \
-p 8551:8551 \
-p 8545:8545 \
-p 8546:8546 \
--env 'NODE_OPTIONS=--max-old-space-size=8192' \
docker.io/ethpandaops/geth:lightclient-prague-devnet-4 \
init "$config_dir/genesis-electra.json"
./go-ethereum-lightclient/build/bin/geth \
--networkid 11155111 \
--vmdebug \
--datadir /mnt/ethereum \
--datadir "$output_dir/ethereum" \
--http \
--http.api debug,personal,eth,net,web3,txpool,engine \
--ws --ws.api debug,eth,net,web3 \
Expand All @@ -44,14 +50,16 @@ start_geth() {
--ws.addr 0.0.0.0 \
--ws.origins "*" \
--allow-insecure-unlock \
--authrpc.jwtsecret mnt/jwtsecret \
--authrpc.jwtsecret "$config_dir/jwtsecret" \
--password /dev/null \
--rpc.gascap 0 \
--ws.origins "*" \
--gcmode archive \
--syncmode=full \
--state.scheme=hash \
> "$output_electra_dir/geth.log" 2>&1 &
> "$output_dir/geth.log" 2>&1 &

popd
}

start_lodestar() {
Expand Down Expand Up @@ -79,8 +87,8 @@ start_lodestar() {
--startValidators "0..7" \
--enr.ip6 "127.0.0.1" \
--rest.address "0.0.0.0" \
--eth1.providerUrls "http://$HOST:8545" \
--execution.urls "http://$HOST:8551" \
--eth1.providerUrls "http://127.0.0.1:8545" \
--execution.urls "http://127.0.0.1:8551" \
--dataDir "$ethereum_data_dir" \
--reset \
--terminal-total-difficulty-override 0 \
Expand Down
15 changes: 3 additions & 12 deletions web/packages/test/scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,10 @@ zombienet_data_dir="$output_dir/zombienet"
export PATH="$output_bin_dir:$PATH"
export polkadot_sdk_dir="${POLKADOT_SDK_DIR:-../polkadot-sdk}"

if [ "$is_electra" == "true" ]; then
HOST=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
eth_endpoint_http="${ETH_RPC_ENDPOINT:-http://$HOST:8545}/${INFURA_PROJECT_ID:-}"
eth_endpoint_ws="${ETH_WS_ENDPOINT:-ws://$HOST:8546}/${INFURA_PROJECT_ID:-}"
eth_writer_endpoint="${ETH_WRITER_ENDPOINT:-http://$HOST:8545}/${INFURA_PROJECT_ID:-}"
else
eth_endpoint_http="${ETH_RPC_ENDPOINT:-http://127.0.0.1:8545}/${INFURA_PROJECT_ID:-}"
eth_endpoint_ws="${ETH_WS_ENDPOINT:-ws://127.0.0.1:8546}/${INFURA_PROJECT_ID:-}"
eth_writer_endpoint="${ETH_WRITER_ENDPOINT:-http://127.0.0.1:8545}/${INFURA_PROJECT_ID:-}"
fi

eth_network="${ETH_NETWORK:-localhost}"

eth_endpoint_http="${ETH_RPC_ENDPOINT:-http://127.0.0.1:8545}/${INFURA_PROJECT_ID:-}"
eth_endpoint_ws="${ETH_WS_ENDPOINT:-ws://127.0.0.1:8546}/${INFURA_PROJECT_ID:-}"
eth_writer_endpoint="${ETH_WRITER_ENDPOINT:-http://127.0.0.1:8545}/${INFURA_PROJECT_ID:-}"
eth_gas_limit="${ETH_GAS_LIMIT:-5000000}"
eth_chain_id="${ETH_NETWORK_ID:-15}"
eth_fast_mode="${ETH_FAST_MODE:-true}"
Expand Down
16 changes: 12 additions & 4 deletions web/packages/test/scripts/start-relayer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ set -eu
source scripts/set-env.sh

config_relayer() {
local electra_forked_epoch=2000000
if [ "$is_electra" == "true" ]; then
electra_forked_epoch=0
fi
# Configure beefy relay
jq \
--arg k1 "$(address_for BeefyClient)" \
Expand Down Expand Up @@ -138,10 +142,6 @@ config_relayer() {
config/parachain-relay.json >$output_dir/parachain-relay-penpal.json

# Configure beacon relay
local electra_forked_epoch=2000000
if [ "$is_electra" == "true" ]; then
electra_forked_epoch=0
fi
jq \
--arg beacon_endpoint_http $beacon_endpoint_http \
--argjson electra_forked_epoch $electra_forked_epoch \
Expand All @@ -156,11 +156,13 @@ config_relayer() {
--arg eth_endpoint_ws $eth_endpoint_ws \
--arg k1 "$(address_for GatewayProxy)" \
--arg channelID $ASSET_HUB_CHANNEL_ID \
--argjson electra_forked_epoch $electra_forked_epoch \
'
.source.ethereum.endpoint = $eth_endpoint_ws
| .source.contracts.Gateway = $k1
| .source."channel-id" = $channelID
| .schedule.id = 0
| .source.beacon.spec.forkVersions.electra = $electra_forked_epoch
' \
config/execution-relay.json >$output_dir/execution-relay-asset-hub-0.json

Expand All @@ -169,11 +171,13 @@ config_relayer() {
--arg eth_endpoint_ws $eth_endpoint_ws \
--arg k1 "$(address_for GatewayProxy)" \
--arg channelID $ASSET_HUB_CHANNEL_ID \
--argjson electra_forked_epoch $electra_forked_epoch \
'
.source.ethereum.endpoint = $eth_endpoint_ws
| .source.contracts.Gateway = $k1
| .source."channel-id" = $channelID
| .schedule.id = 1
| .source.beacon.spec.forkVersions.electra = $electra_forked_epoch
' \
config/execution-relay.json >$output_dir/execution-relay-asset-hub-1.json

Expand All @@ -182,11 +186,13 @@ config_relayer() {
--arg eth_endpoint_ws $eth_endpoint_ws \
--arg k1 "$(address_for GatewayProxy)" \
--arg channelID $ASSET_HUB_CHANNEL_ID \
--argjson electra_forked_epoch $electra_forked_epoch \
'
.source.ethereum.endpoint = $eth_endpoint_ws
| .source.contracts.Gateway = $k1
| .source."channel-id" = $channelID
| .schedule.id = 2
| .source.beacon.spec.forkVersions.electra = $electra_forked_epoch
' \
config/execution-relay.json >$output_dir/execution-relay-asset-hub-2.json

Expand All @@ -195,10 +201,12 @@ config_relayer() {
--arg eth_endpoint_ws $eth_endpoint_ws \
--arg k1 "$(address_for GatewayProxy)" \
--arg channelID $PENPAL_CHANNEL_ID \
--argjson electra_forked_epoch $electra_forked_epoch \
'
.source.ethereum.endpoint = $eth_endpoint_ws
| .source.contracts.Gateway = $k1
| .source."channel-id" = $channelID
| .source.beacon.spec.forkVersions.electra = $electra_forked_epoch
' \
config/execution-relay.json >$output_dir/execution-relay-penpal.json
}
Expand Down

0 comments on commit 23eb81d

Please sign in to comment.