Skip to content
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] Opt-in feature flag to run local stack in Prague/Electra #715

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/compose-spec-l1-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ services:
- ./config/l1-node/el/config.toml:/config/config.toml:ro
- ./config/l1-node/jwtsecret.txt:/config/jwtsecret.txt:ro
- ./config/l1-node/el/log4j.xml:/var/lib/besu/log4j.xml:ro
- ./config/l1-node/el/genesis.json:/config/genesis.json
- local-dev:/data
ports:
- "8445:8545"
Expand Down Expand Up @@ -63,7 +62,6 @@ services:
- ./config/l1-node/jwtsecret.txt:/config/jwtsecret.txt:ro
- ./config/l1-node/cl/config.yaml:/config/config-file.yaml:ro
- ./config/l1-node/cl/log4j.xml:/config/log4j.xml:ro
- ./config/l1-node/cl/network-config.yml:/config/network-config.yml:ro
- local-dev:/data
ports:
- "9002:9000"
Expand All @@ -80,6 +78,7 @@ services:
- /bin/bash
- -c
- |
PRAGUE=${PRAGUE} bash /generate-genesis.sh
/usr/local/bin/eth2-testnet-genesis deneb \
--config /config/network-config.yml \${L1_GENESIS_TIME:+--timestamp ${L1_GENESIS_TIME} \}
--mnemonics /config/mnemonics.yaml \
Expand All @@ -90,4 +89,5 @@ services:
- ./config/l1-node/cl/mnemonics.yaml:/config/mnemonics.yaml:ro
- ./config/l1-node/cl/network-config.yml:/config/network-config.yml:ro
- ./config/l1-node/el/genesis.json:/config/genesis.json
- ./config/l1-node/generate-genesis.sh:/generate-genesis.sh
- local-dev:/data
2 changes: 1 addition & 1 deletion docker/config/l1-node/cl/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#logging: "INFO"
log-destination: "DEFAULT_BOTH"
network: "/config/network-config.yml"
network: "/data/l1-node-config/network-config.yml"
data-storage-mode: "PRUNE"
initial-state: "/data/l1-node-config/genesis.ssz"

Expand Down
2 changes: 1 addition & 1 deletion docker/config/l1-node/el/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
genesis-file="/config/genesis.json"
genesis-file="/data/l1-node-config/genesis.json"
logging="INFO"
data-path="/opt/besu/data"
data-storage-format="FOREST"
Expand Down
39 changes: 39 additions & 0 deletions docker/config/l1-node/generate-genesis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Script to modify config files to enable Prague/Electra to run for the local stack
# Runs on the 'l1-node-genesis-generator' Docker image entrypoint

original_el_genesis_json_path="/config/genesis.json"
original_cl_network_config_path="/config/network-config.yml"
output_dir="/data/l1-node-config"
modified_el_genesis_json_path=$output_dir/$(basename -- $original_el_genesis_json_path)
modified_cl_network_config_path=$output_dir/$(basename -- $original_cl_network_config_path)

mkdir -p $output_dir
cp $original_el_genesis_json_path $modified_el_genesis_json_path
cp $original_cl_network_config_path $modified_cl_network_config_path

# Early exit if $PRAGUE feature flag is off
if [ -z "$PRAGUE" ]; then
exit 0
fi

OS=$(uname);
prague_time=$(
if [ $OS = "Linux" ]; then
date -d "+32 seconds" +%s;
elif [ $OS = "Darwin" ]; then
date -v +32S +%s;
fi
)

# Add Prague config to modified Besu config
jq --argjson prague_time "$prague_time" '.config.pragueTime = $prague_time' $original_el_genesis_json_path > $modified_el_genesis_json_path

# Add Electra config to modified Teku config
cat <<EOF >> $modified_cl_network_config_path
ELECTRA_FORK_VERSION: 0x60000038
ELECTRA_FORK_EPOCH: 1
MAX_BLOBS_PER_BLOCK_ELECTRA: 9
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152
EOF
Loading