-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat l2geth boot script #55
Open
sbaizet-ledger
wants to merge
3
commits into
develop
Choose a base branch
from
feat-l2geth-boot-script
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#!/bin/bash | ||
|
||
# Check if L2GETH_ROLE is set | ||
if [ -z "$L2GETH_ROLE" ]; then | ||
echo "Error: L2GETH_ROLE is not set" | ||
exit 1 | ||
fi | ||
|
||
# Default values for verbosity and CCC_FLAG | ||
VERBOSITY=${VERBOSITY:-3} | ||
CCC_FLAG=${CCC_FLAG:-""} | ||
|
||
# Common command options | ||
COMMON_OPTS=( | ||
--datadir "/l2geth/data" | ||
--port "$L2GETH_P2P_PORT" | ||
--syncmode full | ||
--networkid "$CHAIN_ID" | ||
--gcmode archive | ||
--cache.noprefetch | ||
--verbosity "$VERBOSITY" | ||
--txpool.globalqueue 4096 | ||
--txpool.globalslots 40960 | ||
--txpool.pricelimit "$L2GETH_MIN_GAS_PRICE" | ||
--miner.gasprice "$L2GETH_MIN_GAS_PRICE" | ||
--rpc.gascap 0 | ||
--gpo.ignoreprice "$L2GETH_MIN_GAS_PRICE" | ||
--metrics --metrics.expensive | ||
$CCC_FLAG | ||
$LOCALS_FLAG | ||
$METRICS_FLAGS | ||
--l1.endpoint "$L2GETH_L1_ENDPOINT" | ||
--l1.confirmations "$L2GETH_L1_WATCHER_CONFIRMATIONS" | ||
--l1.sync.startblock "$L2GETH_L1_CONTRACT_DEPLOYMENT_BLOCK" | ||
$L2GETH_EXTRA_PARAMS | ||
) | ||
|
||
# Role specific options | ||
case "$L2GETH_ROLE" in | ||
rpc) | ||
ROLE_OPTS=( | ||
--config "/l2geth/config.toml" | ||
--nodiscover | ||
--http --http.port "$L2GETH_RPC_HTTP_PORT" --http.addr "0.0.0.0" --http.vhosts="*" --http.corsdomain '*' --http.api "eth,scroll,net,web3,debug" | ||
--pprof --pprof.addr "0.0.0.0" --pprof.port 6060 | ||
--ws --ws.port "$L2GETH_RPC_WS_PORT" --ws.addr "0.0.0.0" --ws.api "eth,scroll,net,web3,debug" | ||
--gpo.percentile 20 | ||
--gpo.blocks 100 | ||
--rollup.verify | ||
) | ||
;; | ||
bootnode) | ||
ROLE_OPTS=( | ||
--config "/l2geth/config.toml" | ||
--maxpeers "$L2GETH_MAX_PEERS" | ||
--netrestrict "$L2GETH_NETRESTRICT" | ||
--nat "$L2GETH_NAT" | ||
--bootnodes "" | ||
--pprof --pprof.addr "0.0.0.0" --pprof.port 6060 | ||
) | ||
;; | ||
sequencer) | ||
ROLE_OPTS=( | ||
--nodiscover | ||
--http --http.port "$L2GETH_RPC_HTTP_PORT" --http.addr "0.0.0.0" --http.vhosts="*" --http.corsdomain '*' --http.api "eth,scroll,net,web3,debug" | ||
--pprof --pprof.addr "0.0.0.0" --pprof.port 6060 | ||
--ws --ws.port "$L2GETH_RPC_WS_PORT" --ws.addr "0.0.0.0" --ws.api "eth,scroll,net,web3,debug" | ||
--unlock "$L2GETH_SIGNER_ADDRESS" --password "/l2geth/password" --allow-insecure-unlock --mine | ||
--gpo.percentile 20 | ||
--gpo.blocks 100 | ||
--rollup.verify | ||
) | ||
;; | ||
*) | ||
echo "Error: Unknown L2GETH_ROLE value '$L2GETH_ROLE'" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if [ $L2GETH_ROLE == "bootnode" ] || [ $L2GETH_ROLE == "rpc" ] | ||
then | ||
echo "[Node.P2P] StaticNodes = $L2GETH_PEER_LIST" > "/l2geth/config.toml" | ||
geth --datadir "/l2geth/data" init /l2geth/genesis/genesis.json | ||
echo "Launching l2geth with this command: " | ||
echo "geth \"${COMMON_OPTS[@]}\" \"${ROLE_OPTS[@]}\"" | ||
geth "${COMMON_OPTS[@]}" "${ROLE_OPTS[@]}" | ||
elif [ $L2GETH_ROLE == "sequencer" ]; then | ||
mkdir -p /l2geth/data/keystore | ||
mkdir -p /l2geth/data/geth | ||
echo ${L2GETH_PASSWORD} > /l2geth/password | ||
echo ${L2GETH_KEYSTORE} > /l2geth/data/keystore/keystore.json | ||
echo ${L2GETH_NODEKEY} > /l2geth/data/geth/nodekey | ||
geth --datadir "/l2geth/data" init /l2geth/genesis/genesis.json | ||
echo "Launching l2geth with this command: " | ||
echo "geth \"${COMMON_OPTS[@]}\" \"${ROLE_OPTS[@]}\"" | ||
geth "${COMMON_OPTS[@]}" "${ROLE_OPTS[@]}" | ||
else | ||
echo "L2GETH_ROLE is not set to bootnode,rpc or sequencer. Exiting." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
{{- include "scroll-stack.labels" $ | nindent 4 }} | ||
name: l2geth-boot | ||
data: | ||
{{ (.Files.Glob "l2geth-boot.sh").AsConfig | indent 2 }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we fully remove these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes of course, once we are sure everything work.
I keep it to easily compare.