use same entrypoint

This commit is contained in:
Shawn 2023-12-11 20:30:21 -08:00
parent 4f46ca3186
commit 290fad0a4c
4 changed files with 15 additions and 126 deletions

View file

@ -7,6 +7,7 @@ services:
environment:
- GETH_NODE_TYPE=bootnode
- BOOT_KEY=7b548c1c0fbe80ef1eb0aaec2edf26fd20fb0d758e94948cf6c5f2a486e735f6
- NET_RESTRICT=172.13.0.0/24
networks:
poa_net:
ipv4_address: '172.13.0.100'
@ -47,6 +48,8 @@ services:
- GETH_NODE_TYPE=signer
- BLOCK_SIGNER_ADDRESS=0xd9cd8E5DE6d55f796D980B818D350C0746C25b97
- BLOCK_SIGNER_PRIVATE_KEY=${NODE1_PRIVATE_KEY}
- BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.13.0.100:30301
- NET_RESTRICT=172.13.0.0/24
networks:
poa_net:
ipv4_address: '172.13.0.2'
@ -76,7 +79,6 @@ services:
}
]
node2:
build:
context: ..
@ -85,6 +87,8 @@ services:
- GETH_NODE_TYPE=signer
- BLOCK_SIGNER_ADDRESS=0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4
- BLOCK_SIGNER_PRIVATE_KEY=${NODE2_PRIVATE_KEY}
- BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.13.0.100:30301
- NET_RESTRICT=172.13.0.0/24
networks:
poa_net:
ipv4_address: '172.13.0.3'
@ -122,6 +126,7 @@ services:
environment:
- GETH_NODE_TYPE=bootnode
- BOOT_KEY=7b548c1c0fbe80ef1eb0aaec2edf26fd20fb0d758e94948cf6c5f2a486e735f6
- NET_RESTRICT=172.14.0.0/24
networks:
l1_net:
ipv4_address: '172.14.0.2'
@ -137,6 +142,8 @@ services:
- GETH_NODE_TYPE=signer
- BLOCK_SIGNER_ADDRESS=0xd9cd8E5DE6d55f796D980B818D350C0746C25b97
- BLOCK_SIGNER_PRIVATE_KEY=${NODE1_PRIVATE_KEY}
- BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.14.0.2:30301
- NET_RESTRICT=172.14.0.0/24
networks:
l1_net:
ipv4_address: '172.14.0.3'
@ -144,6 +151,7 @@ services:
- geth-data-l1-first-signer:/data
profiles:
- local_l1
l1-second-signer:
build:
context: .
@ -152,6 +160,8 @@ services:
- GETH_NODE_TYPE=signer
- BLOCK_SIGNER_ADDRESS=0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4
- BLOCK_SIGNER_PRIVATE_KEY=${NODE2_PRIVATE_KEY}
- BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.14.0.2:30301
- NET_RESTRICT=172.14.0.0/24
networks:
l1_net:
ipv4_address: '172.14.0.4'

View file

@ -74,7 +74,7 @@ if [ "$GETH_NODE_TYPE" = "bootnode" ]; then
--metrics.addr=0.0.0.0 \
--metrics.port=6060 \
--nodekey $GETH_DATA_DIR/boot.key \
--netrestrict 172.13.0.0/24 \
--netrestrict $NET_RESTRICT \
--nat extip:$NODE_IP
elif [ "$GETH_NODE_TYPE" = "signer" ]; then
@ -94,7 +94,7 @@ elif [ "$GETH_NODE_TYPE" = "signer" ]; then
--http.addr=0.0.0.0 \
--http.port="$RPC_PORT" \
--http.api=web3,debug,eth,txpool,net,engine \
--bootnodes enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.13.0.100:30301 \
--bootnodes $BOOTNODE_ENDPOINT \
--networkid=$CHAIN_ID \
--unlock=$BLOCK_SIGNER_ADDRESS \
--password="$GETH_DATA_DIR"/password \
@ -102,7 +102,7 @@ elif [ "$GETH_NODE_TYPE" = "signer" ]; then
--miner.etherbase=$BLOCK_SIGNER_ADDRESS \
--allow-insecure-unlock \
--nousb \
--netrestrict 172.13.0.0/24 \
--netrestrict $NET_RESTRICT \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port=6060 \

View file

@ -3,7 +3,7 @@ FROM ethereum/client-go:v1.13.4 as builder
RUN apk add --no-cache jq
# Reuse entrypoint for mev-commit chain
COPY ./local-l1/entrypoint.sh /entrypoint.sh
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY ./local-l1/genesis.json /genesis.json

View file

@ -1,121 +0,0 @@
#!/bin/sh
set -exu
GENESIS_L1_PATH="/genesis.json"
VERBOSITY=3
GETH_DATA_DIR=/data
GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth/chaindata"
GETH_KEYSTORE_DIR="$GETH_DATA_DIR/keystore"
CHAIN_ID=$(cat "$GENESIS_L1_PATH" | jq -r .config.chainId)
RPC_PORT="${RPC_PORT:-8545}"
WS_PORT="${WS_PORT:-8546}"
# Generate signer key if needed
if [ ! -d "$GETH_KEYSTORE_DIR" ] && [ "$GETH_NODE_TYPE" = "signer" ]; then
echo "$GETH_KEYSTORE_DIR missing, running account import"
echo -n "pwd" > "$GETH_DATA_DIR"/password
echo -n "$BLOCK_SIGNER_PRIVATE_KEY" | sed 's/0x//' > "$GETH_DATA_DIR"/block-signer-key
geth --verbosity="$VERBOSITY" \
--nousb \
account import \
--datadir="$GETH_DATA_DIR" \
--password="$GETH_DATA_DIR"/password \
"$GETH_DATA_DIR"/block-signer-key
else
echo "$GETH_KEYSTORE_DIR exists."
fi
# Init geth if needed
if [ ! -d "$GETH_CHAINDATA_DIR" ]; then
echo "$GETH_CHAINDATA_DIR missing, running init"
echo "Initializing genesis."
geth --verbosity="$VERBOSITY" \
--nousb \
--state.scheme=path \
--db.engine=pebble \
--datadir="$GETH_DATA_DIR" init \
"$GENESIS_L1_PATH"
else
echo "$GETH_CHAINDATA_DIR exists."
fi
# Obtain assigned container IP for p2p
NODE_IP=$(hostname -i)
if [ "$GETH_NODE_TYPE" = "bootnode" ]; then
echo "Starting bootnode"
# Generate boot.key
echo "$BOOT_KEY" > $GETH_DATA_DIR/boot.key
exec geth \
--verbosity="$VERBOSITY" \
--datadir="$GETH_DATA_DIR" \
--port 30301 \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.port="$RPC_PORT" \
--http.api=web3,debug,eth,txpool,net,engine \
--ws \
--ws.addr=0.0.0.0 \
--ws.port="$WS_PORT" \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine \
--syncmode=full \
--gcmode=full \
--state.scheme=path \
--db.engine=pebble \
--networkid=$CHAIN_ID \
--nousb \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port=6060 \
--nodekey $GETH_DATA_DIR/boot.key \
--netrestrict 172.14.0.0/24 \
--nat extip:$NODE_IP
elif [ "$GETH_NODE_TYPE" = "signer" ]; then
echo "Starting signer node"
exec geth \
--verbosity="$VERBOSITY" \
--datadir="$GETH_DATA_DIR" \
--port 30311 \
--syncmode=full \
--gcmode=full \
--state.scheme=path \
--db.engine=pebble \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.port="$RPC_PORT" \
--http.api=web3,debug,eth,txpool,net,engine \
--bootnodes enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.14.0.2:30301 \
--networkid=$CHAIN_ID \
--unlock=$BLOCK_SIGNER_ADDRESS \
--password="$GETH_DATA_DIR"/password \
--mine \
--miner.etherbase=$BLOCK_SIGNER_ADDRESS \
--allow-insecure-unlock \
--nousb \
--netrestrict 172.14.0.0/24 \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port=6060 \
--ws \
--ws.addr=0.0.0.0 \
--ws.port="$WS_PORT" \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine \
--rpc.allow-unprotected-txs \
--authrpc.addr="0.0.0.0" \
--authrpc.port="8551" \
--authrpc.vhosts="*" \
--nat extip:$NODE_IP
else
echo "Invalid GETH_NODE_TYPE specified"
fi