WIP: Back to v1.14

This commit is contained in:
Thomas E Lackey 2024-05-02 16:54:20 -05:00
parent edc2e0756c
commit acfd3371b2
7 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,25 @@
FROM ethpandaops/ethereum-genesis-generator:3.0.0 AS ethgen
FROM golang:1.20-alpine as builder
RUN apk add --no-cache python3 py3-pip make bash envsubst jq
# Install ethereum-genesis-generator tools
COPY --from=ethgen /apps /apps
RUN cd /apps/el-gen && pip3 install --break-system-packages -r requirements.txt
RUN pip3 install --break-system-packages --upgrade "web3==v6.15.1"
RUN pip3 install --break-system-packages --upgrade "typing-extensions"
# Install tool to generate initial block
RUN go install github.com/cerc-io/eth-dump-genblock@b29516740fc01cf1d1d623acbfd0e9a2b6440a96
# Build genesis config
COPY genesis /opt/genesis
RUN cd /opt/genesis && make genesis-el
# Snag the genesis block info.
RUN eth-dump-genblock /opt/genesis/build/el/geth.json > /opt/genesis/build/el/genesis_block.json
FROM alpine:latest
COPY --from=builder /opt/genesis /opt/genesis

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Build cerc/fixturenet-eth-genesis-postmerge
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/fixturenet-eth-genesis-postmerge:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR

View File

@ -0,0 +1,13 @@
.PHONY: build
build: genesis
.PHONY: genesis
genesis: genesis-el
.PHONY: genesis-el
genesis-el:
cd el; ./build_el.sh
.PHONY: clean
clean:
rm -rf build

View File

@ -0,0 +1,17 @@
#!/bin/sh
ACCOUNT_PASSWORD=${ACCOUNT_PASSWORD:-secret1212}
for line in `cat ../build/el/accounts.csv`; do
BIP44_PATH="`echo "$line" | cut -d',' -f1`"
ADDRESS="`echo "$line" | cut -d',' -f2`"
PRIVATE_KEY="`echo "$line" | cut -d',' -f3`"
echo "$ACCOUNT_PASSWORD" > .pw.$$
echo "$PRIVATE_KEY" | sed 's/0x//' > .key.$$
echo ""
echo "$ADDRESS"
geth account import --datadir=~/ethdata --password .pw.$$ .key.$$
rm -f .pw.$$ .key.$$
done

View File

@ -0,0 +1,16 @@
from web3.auto import w3
import ruamel.yaml as yaml
import sys
w3.eth.account.enable_unaudited_hdwallet_features()
testnet_config_path = "genesis-config.yaml"
if len(sys.argv) > 1:
testnet_config_path = sys.argv[1]
with open(testnet_config_path) as stream:
data = yaml.safe_load(stream)
for key, value in data['el_premine'].items():
acct = w3.eth.account.from_mnemonic(data['mnemonic'], account_path=key, passphrase='')
print("%s,%s,%s" % (key, acct.address, acct.key.hex()))

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
# See: https://github.com/skylenet/ethereum-genesis-generator/blob/master/entrypoint.sh
rm -rf ../build/el
mkdir -p ../build/el
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
envsubst < el-config.yaml > $tmp_dir/genesis-config.yaml
python3 /apps/el-gen/genesis_geth.py $tmp_dir/genesis-config.yaml | \
jq 'del(.config.pragueTime)' \
> ../build/el/geth.json
python3 ../accounts/mnemonic_to_csv.py $tmp_dir/genesis-config.yaml > ../build/el/accounts.csv

View File

@ -0,0 +1,17 @@
mnemonic: "viable ketchup woman library opinion copy rhythm attend rose knock penalty practice photo bundle budget dentist enter round bind holiday useful arch danger lobster"
el_premine:
"m/44'/60'/0'/0/0": 10000000ETH
"m/44'/60'/0'/0/1": 10000000ETH
"m/44'/60'/0'/0/2": 10000000ETH
"m/44'/60'/0'/0/3": 10000000ETH
"m/44'/60'/0'/0/4": 10000000ETH
"m/44'/60'/0'/0/5": 10000000ETH
el_premine_addrs: {}
chain_id: 1212
deposit_contract_address: "0x1212121212121212121212121212121212121212"
genesis_timestamp: 0
genesis_delay: 0
deneb_fork_epoch: 0
# note: only needed as workaround https://github.com/ethpandaops/ethereum-genesis-generator/pull/105
electra_fork_epoch: 0
slot_duration_in_seconds: 3