Add fixturenet-optimism op-node and op-geth

This commit is contained in:
nabarun 2023-03-30 18:51:44 +05:30
parent 9a069c32af
commit 8d6d13ecf8
4 changed files with 137 additions and 1 deletions

View File

@ -1,7 +1,6 @@
version: '3.7'
services:
fixturenet-optimism-contracts:
hostname: fixturenet-optimism-contracts
depends_on:
@ -22,7 +21,56 @@ services:
# TODO: Add healthcheck
# healthcheck:
op-node-l2-config-gen:
environment:
# TODO: Integrate
L1_RPC: "http://fixturenet-eth-geth-1:8545"
image: cerc/optimism-op-node:local
volumes:
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/op-node/generate-l2-config.sh
# TODO: Integrate
- ../test/contracts-bedrock:/app/packages/contracts-bedrock
- op_node_data:/app/op-node
command: ["sh", "generate-l2-config.sh"]
op-geth:
image: cerc/optimism-l2geth:local
depends_on:
op-node-l2-config-gen:
condition: service_started
volumes:
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
- op_node_data:/op-node
# TODO: Integrate
- ../test/l2-accounts:/l2-accounts
entrypoint: "sh"
command: "/run-op-geth.sh"
ports:
- "8545"
healthcheck:
test: ["CMD", "nc", "-v", "http://localhost:8545"]
interval: 30s
timeout: 10s
retries: 10
start_period: 30s
op-node:
environment:
# TODO: Integrate
L1_RPC: "http://fixturenet-eth-geth-1:8545"
depends_on:
op-geth:
condition: service_healthy
image: cerc/optimism-op-node:local
volumes:
- ../config/fixturenet-optimism/run-op-node.sh:/app/op-node/run-op-node.sh
- op_node_data:/app/op-node
# TODO: Integrate
- ../test/l2-accounts:/l2-accounts
command: ["sh", "run-op-node.sh"]
volumes:
op_node_data:
l2-accounts:
# TODO: Required?
# fixturenet-geth-accounts:

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
go run cmd/main.go genesis l2 \
--deploy-config ../packages/contracts-bedrock/deploy-config/getting-started.json \
--deployment-dir ../packages/contracts-bedrock/deployments/getting-started/ \
--outfile.l2 genesis.json \
--outfile.rollup rollup.json \
--l1-rpc $L1_RPC
openssl rand -hex 32 > jwt.txt
cat genesis.json
cat jwt.txt

View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
mkdir datadir
echo "pwd" > datadir/password
# Get SEQUENCER KEY from keys.json
SEQUENCER_KEY=`jq '.Sequencer.privateKey' /l2-accounts/keys.json`
echo $SEQUENCER_KEY > datadir/block-signer-key
geth account import --datadir=datadir --password=datadir/password datadir/block-signer-key
while [ ! -f "/op-node/jwt.tx" ]
do
echo "Config files not created. Checking after 5 seconds."
sleep 5
done
echo "Config files created by op-node, proceeding with script..."
cp /op-node/genesis.json ./
geth init --datadir=datadir genesis.json
SEQUENCER_ADDRESS=`jq '.Sequencer.address' /l2-accounts/keys.json`
echo "SEQUENCER_ADDRESS: ${SEQUENCER_ADDRESS}"
cp /op-node/jwt.txt ./
geth \
--datadir ./datadir \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.api=web3,debug,eth,txpool,net,engine \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine \
--syncmode=full \
--gcmode=full \
--nodiscover \
--maxpeers=0 \
--networkid=42069 \
--authrpc.vhosts="*" \
--authrpc.addr=0.0.0.0 \
--authrpc.port=8551 \
--authrpc.jwtsecret=./jwt.txt \
--rollup.disabletxpoolgossip=true \
--password=./datadir/password \
--allow-insecure-unlock \
--mine \
--miner.etherbase=$SEQUENCER_ADDRESS \
--unlock=$SEQUENCER_ADDRESS

View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e
# Get SEQUENCER KEY from keys.json
SEQUENCER_KEY=`jq '.Sequencer.privateKey' /l2-accounts/keys.json`
op-node \
--l2=http://op-geth:8551 \
--l2.jwt-secret=./jwt.txt \
--sequencer.enabled \
--sequencer.l1-confs=3 \
--verifier.l1-confs=3 \
--rollup.config=./rollup.json \
--rpc.addr=0.0.0.0 \
--rpc.port=8547 \
--p2p.disable \
--rpc.enable-admin \
--p2p.sequencer.key=$SEQUENCER_KEY \
--l1=$L1_RPC \
--l1.rpckind=any