Commit a0541856 authored by Mark Tyneway's avatar Mark Tyneway

l2geth: update scripts for local dev

These scripts can be used to set up a
local development environment to test
out sending transactions against

If the `DEVELOPMENT` env var is set, then
the initial genesis state will include funds
for the signer address. This prevents the
need to deposit funds or manually edit the
genesis json file.
parent d5bc2f85
#!/bin/bash
# script to help simplify l2geth initialization
# it needs a path on the filesystem to the state
# dump
set -eou pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
REPO=$DIR/..
STATE_DUMP=${STATE_DUMP:-$REPO/../packages/contracts/dist/dumps/state-dump.latest.json}
DATADIR=${DATADIR:-$HOME/.ethereum}
# These are the initial key and address that must be used for the clique
# signer on the optimism network. All nodes must be initialized with this
# key before they are able to join the network and sync correctly.
# The signer address needs to be in the genesis block's extradata.
SIGNER_KEY=6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27
SIGNER=0x00000398232e2064f896018496b4b44b3d62751f
mkdir -p $DATADIR
if [[ ! -f $STATE_DUMP ]]; then
echo "Cannot find $STATE_DUMP"
exit 1
fi
# Add funds to the signer account so that it can be used to send transactions
if [[ ! -z "$DEVELOPMENT" ]]; then
echo "Setting up development genesis"
echo "Assuming that the initial clique signer is $SIGNER, this is configured in genesis extradata"
DUMP=$(cat $STATE_DUMP | jq '.alloc += {"0x00000398232e2064f896018496b4b44b3d62751f": {balance: "10000000000000000000"}}')
TEMP=$(mktemp)
echo "$DUMP" | jq . > $TEMP
STATE_DUMP=$TEMP
fi
geth="$REPO/build/bin/geth"
USING_OVM=true $geth init --datadir $DATADIR $STATE_DUMP
echo "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" \
> $DATADIR/keyfile
echo "password" > $DATADIR/password
USING_OVM=true $geth account import \
--datadir $DATADIR --password $DATADIR/password $DATADIR/keyfile
...@@ -6,16 +6,18 @@ REPO=$DIR/.. ...@@ -6,16 +6,18 @@ REPO=$DIR/..
IS_VERIFIER= IS_VERIFIER=
ROLLUP_SYNC_SERVICE_ENABLE=true ROLLUP_SYNC_SERVICE_ENABLE=true
DATADIR=$HOME/.ethereum DATADIR=$HOME/.ethereum
TARGET_GAS_LIMIT=11000000 TARGET_GAS_LIMIT=15000000
ETH1_CTC_DEPLOYMENT_HEIGHT=12686738 ETH1_CTC_DEPLOYMENT_HEIGHT=12686738
ROLLUP_CLIENT_HTTP=http://localhost:7878 ROLLUP_CLIENT_HTTP=http://localhost:7878
ROLLUP_POLL_INTERVAL=15s ROLLUP_POLL_INTERVAL=15s
ROLLUP_TIMESTAMP_REFRESH=3m ROLLUP_TIMESTAMP_REFRESH=15s
CACHE=1024 CACHE=1024
RPC_PORT=8545 RPC_PORT=8545
WS_PORT=8546 WS_PORT=8546
VERBOSITY=3 VERBOSITY=3
ROLLUP_BACKEND=l2 ROLLUP_BACKEND=l2
CHAIN_ID=69
BLOCK_SIGNER_ADDRESS=0x00000398232E2064F896018496b4b44b3D62751F
USAGE=" USAGE="
Start the Sequencer or Verifier with most configuration pre-set. Start the Sequencer or Verifier with most configuration pre-set.
...@@ -174,15 +176,22 @@ cmd="$cmd --ws" ...@@ -174,15 +176,22 @@ cmd="$cmd --ws"
cmd="$cmd --wsaddr 0.0.0.0" cmd="$cmd --wsaddr 0.0.0.0"
cmd="$cmd --wsport $WS_PORT" cmd="$cmd --wsport $WS_PORT"
cmd="$cmd --wsorigins '*'" cmd="$cmd --wsorigins '*'"
cmd="$cmd --rpcapi 'eth,net,rollup,web3,debug'" cmd="$cmd --rpcapi eth,net,rollup,web3,debug,personal"
cmd="$cmd --gasprice 0" cmd="$cmd --gasprice 0"
cmd="$cmd --nousb" cmd="$cmd --nousb"
cmd="$cmd --gcmode=archive" cmd="$cmd --gcmode=archive"
cmd="$cmd --ipcdisable" cmd="$cmd --nodiscover"
cmd="$cmd --mine"
cmd="$cmd --password=$DATADIR/password"
cmd="$cmd --allow-insecure-unlock"
cmd="$cmd --unlock=$BLOCK_SIGNER_ADDRESS"
cmd="$cmd --miner.etherbase=$BLOCK_SIGNER_ADDRESS"
cmd="$cmd --txpool.pricelimit 0"
if [[ ! -z "$IS_VERIFIER" ]]; then if [[ ! -z "$IS_VERIFIER" ]]; then
cmd="$cmd --rollup.verifier" cmd="$cmd --rollup.verifier"
fi fi
cmd="$cmd --verbosity=$VERBOSITY" cmd="$cmd --verbosity=$VERBOSITY"
echo -e "Running:\nTARGET_GAS_LIMIT=$TARGET_GAS_LIMIT USING_OVM=true $cmd" echo -e "Running:\nTARGET_GAS_LIMIT=$TARGET_GAS_LIMIT USING_OVM=true $cmd"
eval env TARGET_GAS_LIMIT=$TARGET_GAS_LIMIT USING_OVM=true $cmd TARGET_GAS_LIMIT=$TARGET_GAS_LIMIT USING_OVM=true $cmd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment