mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 15:38:06 -05:00
feat: remove image build for l1-node-genesis-generator (#686)
* feat: use alpine as base image for 1-node-genesis-generator * feat: remove image build for l1-node-genesis-generator in local stack * chore: change genesis.json name * feat: set timestamp in el genesis file as zero
This commit is contained in:
@@ -26,6 +26,7 @@ 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"
|
||||
@@ -62,6 +63,7 @@ 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"
|
||||
@@ -72,18 +74,20 @@ services:
|
||||
ipv4_address: 10.10.10.202
|
||||
|
||||
l1-node-genesis-generator:
|
||||
build:
|
||||
context: ./config/l1-node/
|
||||
image: ethpandaops/ethereum-genesis-generator:pk910-bash-el-genesis-generator
|
||||
profiles: [ "l1", "debug", "external-to-monorepo" ]
|
||||
command:
|
||||
--genesis-time ${L1_GENESIS_TIME:-""}
|
||||
--current-time-delay-in-sec 3
|
||||
--l1-genesis /config/l1-genesis.json
|
||||
--network-config /config/network-config.yml
|
||||
--mnemonics /config/mnemonics.yaml
|
||||
--output-dir /data/l1-node-config
|
||||
entrypoint:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
/usr/local/bin/eth2-testnet-genesis deneb \
|
||||
--config /config/network-config.yml \${L1_GENESIS_TIME:+--timestamp ${L1_GENESIS_TIME} \}
|
||||
--mnemonics /config/mnemonics.yaml \
|
||||
--tranches-dir /data/l1-node-config/tranches \
|
||||
--state-output /data/l1-node-config/genesis.ssz \
|
||||
--eth1-config /config/genesis.json
|
||||
volumes:
|
||||
- ./config/l1-node/cl/network-config.yml:/config/network-config.yml:ro
|
||||
- ./config/l1-node/cl/mnemonics.yaml:/config/mnemonics.yaml:ro
|
||||
- ./config/l1-node/el/genesis.json:/config/l1-genesis.json
|
||||
- ./config/l1-node/cl/network-config.yml:/config/network-config.yml:ro
|
||||
- ./config/l1-node/el/genesis.json:/config/genesis.json
|
||||
- local-dev:/data
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM ethpandaops/ethereum-genesis-generator:pk910-bash-el-genesis-generator
|
||||
|
||||
COPY ./generate-genesis.sh /config/generate-genesis.sh
|
||||
|
||||
ENTRYPOINT [ "/bin/bash", "/config/generate-genesis.sh" ]
|
||||
@@ -1,6 +1,6 @@
|
||||
#logging: "INFO"
|
||||
log-destination: "DEFAULT_BOTH"
|
||||
network: "/data/l1-node-config/network-config.yml"
|
||||
network: "/config/network-config.yml"
|
||||
data-storage-mode: "PRUNE"
|
||||
initial-state: "/data/l1-node-config/genesis.ssz"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ CONFIG_NAME: testnet # needs to exist because of Prysm. Otherwise it conflicts w
|
||||
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 1
|
||||
# Mar-01-2021 08:53:32 AM +UTC
|
||||
# This is an invalid valid and should be updated when you create the genesis
|
||||
MIN_GENESIS_TIME: $GENESIS_TIME
|
||||
MIN_GENESIS_TIME: 0
|
||||
GENESIS_FORK_VERSION: 0x10000038
|
||||
GENESIS_DELAY: 10
|
||||
MAX_BLOBS_PER_BLOCK: 18
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
genesis-file="/data/l1-node-config/genesis.json"
|
||||
genesis-file="/config/genesis.json"
|
||||
logging="INFO"
|
||||
data-path="/opt/besu/data"
|
||||
data-storage-format="FOREST"
|
||||
|
||||
@@ -998,5 +998,5 @@
|
||||
"nonce": "0x1234",
|
||||
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"timestamp": "1708874895"
|
||||
"timestamp": "0x0"
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
genesis_time=""
|
||||
current_time_delay_in_sec=""
|
||||
l1_genesis=""
|
||||
network_config=""
|
||||
mnemonics=""
|
||||
output_dir=""
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 --genesis-time <timestamp> --current-time-delay-in-sec <seconds to delay current timestamp if genesis-time is not given> --l1-genesis <path to l1 genesis file> --network-config <path to network config file> --mnemonics <path to mnemonics file> --output-dir <output directory>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--genesis-time)
|
||||
genesis_time="$2"
|
||||
shift 2
|
||||
;;
|
||||
--current-time-delay-in-sec)
|
||||
current_time_delay_in_sec="$2"
|
||||
shift 2
|
||||
;;
|
||||
--l1-genesis)
|
||||
l1_genesis="$2"
|
||||
shift 2
|
||||
;;
|
||||
--network-config)
|
||||
network_config="$2"
|
||||
shift 2
|
||||
;;
|
||||
--mnemonics)
|
||||
mnemonics="$2"
|
||||
shift 2
|
||||
;;
|
||||
--output-dir)
|
||||
output_dir="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown option: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$l1_genesis" ] || [ -z "$network_config" ] || [ -z "$mnemonics" ] || [ -z "$output_dir" ]; then
|
||||
echo "Error: Missing required argument."
|
||||
usage
|
||||
fi
|
||||
|
||||
OS=$(uname);
|
||||
|
||||
if [ -z "$genesis_time" ]; then
|
||||
if [ -z "$current_time_delay_in_sec" ]; then
|
||||
current_time_delay_in_sec="3"
|
||||
fi
|
||||
genesis_time=$(
|
||||
if [ $OS = "Linux" ]; then
|
||||
date -d "+$current_time_delay_in_sec seconds" +%s;
|
||||
elif [ $OS = "Darwin" ]; then
|
||||
date -v +"$current_time_delay_in_sec"S +%s;
|
||||
fi
|
||||
)
|
||||
fi
|
||||
|
||||
echo "Genesis time set to: $genesis_time"
|
||||
|
||||
mkdir -p $output_dir
|
||||
cp $l1_genesis $output_dir/genesis.json
|
||||
cp $network_config $output_dir/$(basename -- $network_config)
|
||||
|
||||
# sed in-place command portable with both OS
|
||||
if [ $OS = "Linux" ]; then
|
||||
sed -i -E 's/"timestamp": "[0-9]+"/"timestamp": "'"$genesis_time"'"/' $output_dir/genesis.json
|
||||
sed -i 's/\$GENESIS_TIME/'"$genesis_time"'/g' $output_dir/$(basename -- $network_config)
|
||||
elif [ $OS = "Darwin" ]; then
|
||||
sed -i "" -E 's/"timestamp": "[0-9]+"/"timestamp": "'"$genesis_time"'"/' $output_dir/genesis.json
|
||||
sed -i "" 's/\$GENESIS_TIME/'"$genesis_time"'/g' $output_dir/$(basename -- $network_config)
|
||||
fi
|
||||
|
||||
/usr/local/bin/eth2-testnet-genesis deneb --config $output_dir/$(basename -- $network_config) --mnemonics $mnemonics --tranches-dir $output_dir/tranches --state-output $output_dir/genesis.ssz --eth1-config $output_dir/genesis.json
|
||||
Reference in New Issue
Block a user