Skip to content

Commit

Permalink
Integrate besu with the merge script along with some general cleanup (
Browse files Browse the repository at this point in the history
#3942)

* besu integration in merge setup script with some cleanup

* update mainnet shadow fork 2 config for besu

* some cleanup for easy management

* cl network cleanup for mac vs linux

* update the besu image target
  • Loading branch information
g11tech authored Apr 21, 2022
1 parent e12ab97 commit 97f6012
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 46 deletions.
17 changes: 12 additions & 5 deletions kiln/devnets/goerlishadow-4.vars
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
DEVNET_NAME=goerlishadow-4
CONFIG_GIT_DIR=goerli-shadow-fork-4
NETWORK_ID=5
MERGE_TTD=9895202

JWT_SECRET="0xdc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d"

GETH_IMAGE=parithoshj/geth:master
NETHERMIND_IMAGE=nethermindeth/nethermind:kiln_shadowfork
ETHEREUMJS_IMAGE=g11tech/ethereumjs:kiln
LODESTAR_IMAGE=chainsafe/lodestar:next
CONFIG_GIT_DIR=goerli-shadow-fork-4
BESU_IMAGE=hyperledger/besu:develop

JWT_SECRET="0xdc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d"
LODESTAR_IMAGE=chainsafe/lodestar:next

LODESTAR_EXTRA_ARGS="--eth1.providerUrls http://127.0.0.1:8545 --execution.urls http://127.0.0.1:8551 --api.rest.enabled --api.rest.host 0.0.0.0 --api.rest.api '*'"

LODESTAR_VALIDATOR_ARGS='--network kiln --fromMnemonic "lens risk clerk foot verb planet drill roof boost aim salt omit celery tube list permit motor obvious flash demise churn hold wave hollow" --mnemonicIndexes 0..5'

NETHERMIND_EXTRA_ARGS="--config goerli_shadowfork --Network.DiscoveryPort=30303 --Network.P2PPort=30303 --Merge.Enabled=true --Merge.TerminalTotalDifficulty=9891031 --Init.DiagnosticMode=None --JsonRpc.Enabled=true --JsonRpc.Host=0.0.0.0 --JsonRpc.AdditionalRpcUrls \"http://localhost:8545|http;ws|net;eth;subscribe;engine;web3;client|no-auth,http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client\""
NETHERMIND_EXTRA_ARGS="--config goerli_shadowfork --Network.DiscoveryPort=30303 --Network.P2PPort=30303 --Merge.Enabled=true --Init.DiagnosticMode=None --JsonRpc.Enabled=true --JsonRpc.Host=0.0.0.0 --JsonRpc.AdditionalRpcUrls \"http://localhost:8545|http;ws|net;eth;subscribe;engine;web3;client|no-auth,http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client\""

GETH_EXTRA_ARGS="--http --http.api engine,net,eth,web3 --http.port 8545 --allow-insecure-unlock --http.addr 0.0.0.0 --http.corsdomain \"*\" --http.vhosts \"*\" --authrpc.port=8551 --networkid 5"
GETH_EXTRA_ARGS="--http --http.api engine,net,eth,web3 --http.port 8545 --allow-insecure-unlock --http.addr 0.0.0.0 --http.corsdomain \"*\" --http.vhosts \"*\" --authrpc.port=8551"

ETHEREUMJS_EXTRA_ARGS="--saveReceipts --rpc --rpcport 8545 --ws --rpcEngine --rpcEnginePort=8551 --rpcDebug --loglevel=debug"

BESU_EXTRA_ARGS="--rpc-http-enabled=true --rpc-http-api=ADMIN,CLIQUE,MINER,ETH,NET,DEBUG,TXPOOL,TRACE --rpc-http-host=0.0.0.0 --rpc-http-port=8545 --Xmerge-support=true --engine-rpc-http-port=8551 --rpc-http-cors-origins=\"*\" --host-allowlist=\"*\" --engine-host-allowlist=\"*\" --p2p-enabled=true --engine-jwt-enabled=true"


EXTRA_BOOTNODES=""
18 changes: 12 additions & 6 deletions kiln/devnets/kiln.vars
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
DEVNET_NAME=kiln
CONFIG_GIT_DIR=kiln
NETWORK_ID=1337802
MERGE_TTD=20000000000000

JWT_SECRET="0xdc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d"

GETH_IMAGE=parithoshj/geth:master
NETHERMIND_IMAGE=nethermindeth/nethermind:kiln_0.10
NETHERMIND_IMAGE=nethermindeth/nethermind:kiln_0.12
ETHEREUMJS_IMAGE=g11tech/ethereumjs:kiln
LODESTAR_IMAGE=chainsafe/lodestar:next
CONFIG_GIT_DIR=kiln
BESU_IMAGE=hyperledger/besu:develop

JWT_SECRET="0xdc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d"
LODESTAR_IMAGE=chainsafe/lodestar:next

LODESTAR_EXTRA_ARGS="--eth1.providerUrls http://127.0.0.1:8545 --execution.urls http://127.0.0.1:8551 --api.rest.enabled --api.rest.host 0.0.0.0 --api.rest.api '*'"

LODESTAR_VALIDATOR_ARGS='--network kiln --fromMnemonic "lens risk clerk foot verb planet drill roof boost aim salt omit celery tube list permit motor obvious flash demise churn hold wave hollow" --mnemonicIndexes 0..5'

NETHERMIND_EXTRA_ARGS="--config kiln --Network.DiscoveryPort=30303 --Network.P2PPort=30303 --Merge.Enabled=true --Merge.TerminalTotalDifficulty=20000000000000 --Init.DiagnosticMode=None --JsonRpc.Enabled=true --JsonRpc.Host=0.0.0.0 --JsonRpc.AdditionalRpcUrls \"http://localhost:8545|http;ws|net;eth;subscribe;engine;web3;client|no-auth,http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client\""
NETHERMIND_EXTRA_ARGS="--config kiln --Network.DiscoveryPort=30303 --Network.P2PPort=30303 --Merge.Enabled=true --Init.DiagnosticMode=None --JsonRpc.Enabled=true --JsonRpc.Host=0.0.0.0 --JsonRpc.AdditionalRpcUrls \"http://localhost:8545|http;ws|net;eth;subscribe;engine;web3;client|no-auth,http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client\""

GETH_EXTRA_ARGS="--http --http.api engine,net,eth,web3 --http.port 8545 --allow-insecure-unlock --http.addr 0.0.0.0 --http.corsdomain \"*\" --http.vhosts \"*\" --authrpc.port=8551 --networkid 1337802"
GETH_EXTRA_ARGS="--http --http.api engine,net,eth,web3 --http.port 8545 --allow-insecure-unlock --http.addr 0.0.0.0 --http.corsdomain \"*\" --http.vhosts \"*\" --authrpc.port=8551"

ETHEREUMJS_EXTRA_ARGS="--saveReceipts --rpc --rpcport 8545 --ws --rpcEngine --rpcEnginePort=8551 --rpcDebug --loglevel=debug"

BESU_EXTRA_ARGS="--rpc-http-enabled=true --rpc-http-api=ADMIN,CLIQUE,MINER,ETH,NET,DEBUG,TXPOOL,TRACE --rpc-http-host=0.0.0.0 --rpc-http-port=8545 --Xmerge-support=true --engine-rpc-http-port=8551 --rpc-http-cors-origins=\"*\" --host-allowlist=\"*\" --engine-host-allowlist=\"*\" --p2p-enabled=true --engine-jwt-enabled=true"

EXTRA_BOOTNODES=""
16 changes: 11 additions & 5 deletions kiln/devnets/mainnetshadow-2.vars
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
DEVNET_NAME=mainnet-shadow-fork-2
CONFIG_GIT_DIR=mainnet-shadow-fork-2
NETWORK_ID=1
MERGE_TTD=47074600000000000000000

JWT_SECRET="0xdc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d"

GETH_IMAGE=parithoshj/geth:master
NETHERMIND_IMAGE=nethermindeth/nethermind:kiln_shadowfork
ETHEREUMJS_IMAGE=g11tech/ethereumjs:kiln
LODESTAR_IMAGE=chainsafe/lodestar:next
CONFIG_GIT_DIR=mainnet-shadow-fork-2
BESU_IMAGE=hyperledger/besu:develop

JWT_SECRET="0xdc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d"
LODESTAR_IMAGE=chainsafe/lodestar:next

LODESTAR_EXTRA_ARGS="--eth1.providerUrls http://127.0.0.1:8545 --execution.urls http://127.0.0.1:8551 --api.rest.enabled --api.rest.host 0.0.0.0 --api.rest.api '*'"

LODESTAR_VALIDATOR_ARGS='--network kiln --fromMnemonic "lens risk clerk foot verb planet drill roof boost aim salt omit celery tube list permit motor obvious flash demise churn hold wave hollow" --mnemonicIndexes 0..5'

NETHERMIND_EXTRA_ARGS="--config mainnet_shadowfork --Network.DiscoveryPort=30303 --Network.P2PPort=30303 --Merge.Enabled=true --Merge.TerminalTotalDifficulty=47074600000000000000000 --Init.DiagnosticMode=None --JsonRpc.Enabled=true --JsonRpc.Host=0.0.0.0 --JsonRpc.AdditionalRpcUrls \"http://localhost:8545|http;ws|net;eth;subscribe;engine;web3;client|no-auth,http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client\""
NETHERMIND_EXTRA_ARGS="--config mainnet_shadowfork --Network.DiscoveryPort=30303 --Network.P2PPort=30303 --Merge.Enabled=true --Init.DiagnosticMode=None --JsonRpc.Enabled=true --JsonRpc.Host=0.0.0.0 --JsonRpc.AdditionalRpcUrls \"http://localhost:8545|http;ws|net;eth;subscribe;engine;web3;client|no-auth,http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client\""

GETH_EXTRA_ARGS="--http --http.api engine,net,eth,web3 --http.port 8545 --allow-insecure-unlock --http.addr 0.0.0.0 --http.corsdomain \"*\" --http.vhosts \"*\" --authrpc.port=8551 --networkid 1"
GETH_EXTRA_ARGS="--http --http.api engine,net,eth,web3 --http.port 8545 --allow-insecure-unlock --http.addr 0.0.0.0 --http.corsdomain \"*\" --http.vhosts \"*\" --authrpc.port=8551"

ETHEREUMJS_EXTRA_ARGS="--saveReceipts --rpc --rpcport 8545 --ws --rpcEngine --rpcEnginePort=8551 --rpcDebug --loglevel=debug"

BESU_EXTRA_ARGS="--rpc-http-enabled=true --rpc-http-api=ADMIN,CLIQUE,MINER,ETH,NET,DEBUG,TXPOOL,TRACE --rpc-http-host=0.0.0.0 --rpc-http-port=8545 --Xmerge-support=true --engine-rpc-http-port=8551 --rpc-http-cors-origins=\"*\" --host-allowlist=\"*\" --engine-host-allowlist=\"*\" --p2p-enabled=true --engine-jwt-enabled=true"

EXTRA_BOOTNODES=""
59 changes: 29 additions & 30 deletions kiln/devnets/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ configGitDir=$CONFIG_GIT_DIR
gethImage=$GETH_IMAGE
nethermindImage=$NETHERMIND_IMAGE

if [ ! -n "$dataDir" ] || [ ! -n "$devnetVars" ] || ([ "$elClient" != "geth" ] && [ "$elClient" != "nethermind" ] && [ "$elClient" != "ethereumjs" ])
if [ ! -n "$dataDir" ] || [ ! -n "$devnetVars" ] || ([ "$elClient" != "geth" ] && [ "$elClient" != "nethermind" ] && [ "$elClient" != "ethereumjs" ] && [ "$elClient" != "besu" ])
then
echo "usage: ./setup.sh --dataDir <data dir> --elClient <geth | nethermind | ethereumjs> --devetVars <devnet vars file> [--dockerWithSudo --withTerminal \"gnome-terminal --disable-factory --\"]"
echo "usage: ./setup.sh --dataDir <data dir> --elClient <geth | nethermind | ethereumjs | besu> --devetVars <devnet vars file> [--dockerWithSudo --withTerminal \"gnome-terminal --disable-factory --\"]"
echo "example: ./setup.sh --dataDir kiln-data --elClient nethermind --devnetVars ./kiln.vars --dockerWithSudo --withTerminal \"gnome-terminal --disable-factory --\""
echo "Note: if running on macOS where gnome-terminal is not available, remove the gnome-terminal related flags."
echo "example: ./setup.sh --dataDir kiln-data --elClient geth --devnetVars ./kiln.vars"
exit;
fi


mkdir $dataDir && mkdir $dataDir/lodestar && mkdir $dataDir/geth && mkdir $dataDir/nethermind && mkdir $dataDir/ethereumjs && cd $dataDir && git init && git remote add -f origin $setupConfigUrl && git config core.sparseCheckout true && echo "$configGitDir/*" >> .git/info/sparse-checkout && git pull --depth=1 origin main && cd $currentDir
mkdir $dataDir && mkdir $dataDir/lodestar && mkdir $dataDir/geth && mkdir $dataDir/nethermind && mkdir $dataDir/ethereumjs && mkdir $dataDir/besu && cd $dataDir && git init && git remote add -f origin $setupConfigUrl && git config core.sparseCheckout true && echo "$configGitDir/*" >> .git/info/sparse-checkout && git pull --depth=1 origin main && cd $currentDir

if [ ! -n "$(ls -A $dataDir/$configGitDir)" ] || [ ! -n "$(ls -A $dataDir/$configGitDir/genesis.json)" ] || [ ! -n "$(ls -A $dataDir/$configGitDir/genesis.ssz)" ] || [ ! -n "$(ls -A $dataDir/$configGitDir/nethermind_genesis.json)" ] || [ ! -n "$(ls -A $dataDir/$configGitDir/el_bootnode.txt)" ] || [ ! -n "$(ls -A $dataDir/$configGitDir/bootstrap_nodes.txt)" ]
then
Expand Down Expand Up @@ -77,6 +77,14 @@ bootNode=($bootNode)
bootNodeWithSpace=$(IFS=" " ; echo "${bootNode[*]}")
bootNode=$(IFS=, ; echo "${bootNode[*]}")


if [ $platform == 'Darwin' ]
then
elDockerNetwork=""
else
elDockerNetwork="--network host"
fi;

if [ "$elClient" == "geth" ]
then
echo "gethImage: $GETH_IMAGE"
Expand All @@ -88,38 +96,32 @@ then
echo "setting up geth directory"
$dockerExec run --rm -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir/geth:/data $GETH_IMAGE --datadir /data init /config/genesis.json
fi;
if [ $platform == 'Darwin' ]
then
elCmd="$dockerCmd --name $elName -v $currentDir/$dataDir:/data $GETH_IMAGE --bootnodes $EXTRA_BOOTNODES$bootNode --datadir /data/geth --authrpc.jwtsecret /data/jwtsecret $GETH_EXTRA_ARGS"
else
elCmd="$dockerCmd --name $elName --network host -v $currentDir/$dataDir:/data $GETH_IMAGE --bootnodes $EXTRA_BOOTNODES$bootNode --datadir /data/geth --authrpc.jwtsecret /data/jwtsecret $GETH_EXTRA_ARGS"
fi
elCmd="$dockerCmd --name $elName $elDockerNetwork -v $currentDir/$dataDir:/data $GETH_IMAGE --datadir /data/geth --networkid $NETWORK_ID --authrpc.jwtsecret /data/jwtsecret $GETH_EXTRA_ARGS --bootnodes $EXTRA_BOOTNODES$bootNode"

elif [ "$elClient" == "nethermind" ]
then
echo "nethermindImage: $NETHERMIND_IMAGE"
$dockerExec pull $NETHERMIND_IMAGE

elName="$DEVNET_NAME-nethermind"
elCmd="$dockerCmd --name $elName $elDockerNetwork -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $NETHERMIND_IMAGE --datadir /data/nethermind --Init.ChainSpecPath=/config/nethermind_genesis.json --Merge.TerminalTotalDifficulty=$MERGE_TTD --JsonRpc.JwtSecretFile /data/jwtsecret $NETHERMIND_EXTRA_ARGS --Discovery.Bootnodes $EXTRA_BOOTNODES$bootNode"

if [ $platform == 'Darwin' ]
then
elCmd="$dockerCmd --name $elName -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $NETHERMIND_IMAGE --datadir /data/nethermind --Init.ChainSpecPath=/config/nethermind_genesis.json --JsonRpc.JwtSecretFile /data/jwtsecret $NETHERMIND_EXTRA_ARGS --Discovery.Bootnodes $EXTRA_BOOTNODES$bootNode"
else
elCmd="$dockerCmd --name $elName --network host -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $NETHERMIND_IMAGE --datadir /data/nethermind --Init.ChainSpecPath=/config/nethermind_genesis.json --JsonRpc.JwtSecretFile /data/jwtsecret $NETHERMIND_EXTRA_ARGS --Discovery.Bootnodes $EXTRA_BOOTNODES$bootNode"
fi
elif [ "$elClient" == "ethereumjs" ]
then
echo "ethereumjsImage: $ETHEREUMJS_IMAGE"
$dockerExec pull $ETHEREUMJS_IMAGE

elName="$DEVNET_NAME-ethereumjs"
elCmd="$dockerCmd --name $elName $elDockerNetwork -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $ETHEREUMJS_IMAGE --datadir /data/ethereumjs --gethGenesis /config/genesis.json --jwt-secret /data/jwtsecret $ETHEREUMJS_EXTRA_ARGS --bootnodes=$bootNodeWithSpace "

elif [ "$elClient" == "besu" ]
then
echo "besuImage: $BESU_IMAGE"
$dockerExec pull $BESU_IMAGE

elName="$DEVNET_NAME-besu"
elCmd="$dockerCmd --name $elName $elDockerNetwork -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $BESU_IMAGE --data-path=/data --genesis-file=/config/besu_genesis.json --network-id=$NETWORK_ID --engine-jwt-secret=/data/jwtsecret $BESU_EXTRA_ARGS --bootnodes=$EXTRA_BOOTNODES$bootNode"

if [ $platform == 'Darwin' ]
then
elCmd="$dockerCmd --name $elName -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $ETHEREUMJS_IMAGE --datadir /data/ethereumjs --gethGenesis /config/genesis.json $ETHEREUMJS_EXTRA_ARGS --bootnodes=$bootNodeWithSpace --jwt-secret /data/jwtsecret"
else
elCmd="$dockerCmd --name $elName --network host -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $ETHEREUMJS_IMAGE --datadir /data/ethereumjs --gethGenesis /config/genesis.json $ETHEREUMJS_EXTRA_ARGS --bootnodes=$bootNodeWithSpace --jwt-secret /data/jwtsecret"
fi
fi

echo "lodestarImage: $LODESTAR_IMAGE"
Expand All @@ -130,22 +132,19 @@ bootEnr=($bootEnr)
bootEnr=$(IFS=" " ; echo "${bootEnr[*]}")

depositContractDeployBlock=$(cat $dataDir/$configGitDir/deposit_contract_block.txt)
clName="$DEVNET_NAME-lodestar"

if [ $platform == 'Darwin' ]
then
clCmd="$dockerCmd --name $clName --net=container:$elName -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $LODESTAR_IMAGE beacon --rootDir /data/lodestar --paramsFile /config/config.yaml --genesisStateFile /config/genesis.ssz --network.connectToDiscv5Bootnodes --network.discv5.enabled true --eth1.enabled true --eth1.depositContractDeployBlock $depositContractDeployBlock $LODESTAR_EXTRA_ARGS --bootnodesFile /config/boot_enr.yaml --jwt-secret /data/jwtsecret"
clDockerNetwork="--net=container:$elName"
else
clCmd="$dockerCmd --name $clName --network host -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $LODESTAR_IMAGE beacon --rootDir /data/lodestar --paramsFile /config/config.yaml --genesisStateFile /config/genesis.ssz --network.connectToDiscv5Bootnodes --network.discv5.enabled true --eth1.enabled true --eth1.depositContractDeployBlock $depositContractDeployBlock $LODESTAR_EXTRA_ARGS --bootnodesFile /config/boot_enr.yaml --jwt-secret /data/jwtsecret"
clDockerNetwork="--network host"
fi

clName="$DEVNET_NAME-lodestar"
clCmd="$dockerCmd --name $clName $clDockerNetwork -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $LODESTAR_IMAGE beacon --rootDir /data/lodestar --paramsFile /config/config.yaml --genesisStateFile /config/genesis.ssz --network.connectToDiscv5Bootnodes --network.discv5.enabled true --eth1.enabled true --eth1.depositContractDeployBlock $depositContractDeployBlock $LODESTAR_EXTRA_ARGS --bootnodesFile /config/boot_enr.yaml --jwt-secret /data/jwtsecret"

valName="$DEVNET_NAME-validator"
if [ $platform == 'Darwin' ]
then
valCmd="$dockerCmd --name $valName --net=container:$elName -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $LODESTAR_IMAGE validator --rootDir /data/lodestar --paramsFile /config/config.yaml $LODESTAR_VALIDATOR_ARGS"
else
valCmd="$dockerCmd --name $valName --network host -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $LODESTAR_IMAGE validator --rootDir /data/lodestar --paramsFile /config/config.yaml $LODESTAR_VALIDATOR_ARGS"
fi;
valCmd="$dockerCmd --name $valName $clDockerNetwork -v $currentDir/$dataDir/$configGitDir:/config -v $currentDir/$dataDir:/data $LODESTAR_IMAGE validator --rootDir /data/lodestar --paramsFile /config/config.yaml $LODESTAR_VALIDATOR_ARGS"

echo -n $JWT_SECRET > $dataDir/jwtsecret
run_cmd "$elCmd"
Expand Down

0 comments on commit 97f6012

Please sign in to comment.