Add build and compose defintions for Merge 'fixturenet'. #24

Merged
telackey merged 6 commits from telackey/fixturenet into main 2022-10-14 20:11:56 +00:00
22 changed files with 569 additions and 0 deletions

View File

@ -0,0 +1,86 @@
version: '3.7'
services:
fixturenet-eth-bootnode-geth:
hostname: fixturenet-eth-bootnode-geth
env_file:
- ../config/fixturenet-eth/fixturenet-eth.env
environment:
RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-geth:local
networks:
fixturenet-eth-net:
ipv4_address: 172.16.254.10
fixturenet-eth-geth-1:
hostname: fixturenet-eth-geth-1
env_file:
- ../config/fixturenet-eth/fixturenet-eth.env
image: cerc/fixturenet-eth-geth:local
depends_on:
- fixturenet-eth-bootnode-geth
ports:
- "8545"
networks:
fixturenet-eth-net:
fixturenet-eth-geth-2:
hostname: fixturenet-eth-geth-2
env_file:
- ../config/fixturenet-eth/fixturenet-eth.env
image: cerc/fixturenet-eth-geth:local
depends_on:
- fixturenet-eth-bootnode-geth
networks:
fixturenet-eth-net:
fixturenet-eth-bootnode-lighthouse:
hostname: fixturenet-eth-bootnode-lighthouse
environment:
RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-lighthouse:local
networks:
fixturenet-eth-net:
ipv4_address: 172.16.254.11
fixturenet-eth-lighthouse-1:
hostname: fixturenet-eth-lighthouse-1
env_file:
- ../config/fixturenet-eth/fixturenet-eth.env
environment:
NODE_NUMBER: "1"
ETH1_ENDPOINT: "http://fixturenet-eth-geth-1:8545"
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-1:8551"
image: cerc/fixturenet-eth-lighthouse:local
depends_on:
- fixturenet-eth-bootnode-lighthouse
- fixturenet-eth-geth-1
ports:
- "8001"
networks:
fixturenet-eth-net:
fixturenet-eth-lighthouse-2:
hostname: fixturenet-eth-lighthouse-2
env_file:
- ../config/fixturenet-eth/fixturenet-eth.env
environment:
NODE_NUMBER: "2"
ETH1_ENDPOINT: "http://fixturenet-eth-geth-2:8545"
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-2:8551"
LIGHTHOUSE_GENESIS_STATE_URL: "http://fixturenet-eth-lighthouse-1:8001/eth/v2/debug/beacon/states/0"
image: cerc/fixturenet-eth-lighthouse:local
depends_on:
- fixturenet-eth-bootnode-lighthouse
- fixturenet-eth-geth-2
networks:
fixturenet-eth-net:
networks:
Review

Add a comment about why we need this network defined.

Add a comment about why we need this network defined.
Review

Done

Done
# When the bootnode ENR is generated during the build, it requires a specific IP.
# The easiest way to do that is to use a private network.
fixturenet-eth-net:
driver: bridge
ipam:
config:
- subnet: 172.16.254.0/28

View File

@ -0,0 +1,11 @@
# The password used to access test accounts (eg, via personal_unlockAccount). The password is the same for all accounts.
ACCOUNT_PASSWORD=secret1212
# ENODE of the geth bootnode.
ENODE="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@fixturenet-eth-bootnode-geth:30303"
# JWT shared by geth and lighthouse for authentication.
JWT="0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0"
# Should match the definition of fixturenet-eth-net.
NETRESTRICT="172.16.254.0/28"

View File

@ -0,0 +1,19 @@
Review

Debug code left in?

Debug code left in?
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Yep

Yep
FROM skylenet/ethereum-genesis-generator AS ethgen
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
FROM cerc/go-ethereum:local
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
RUN apk add --no-cache python3 py3-pip curl wget jq build-base gettext libintl openssl bash
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
COPY --from=ethgen /apps /apps
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
RUN cd /apps/el-gen && pip3 install -r requirements.txt
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
COPY genesis /opt/testnet
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
COPY run-el.sh /opt/testnet/run.sh
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
RUN cd /opt/testnet && make genesis-el
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
RUN geth init /opt/testnet/build/el/geth.json && rm -f ~/.ethereum/geth/nodekey
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep
ENTRYPOINT ["/opt/testnet/run.sh"]
Review

Debug code left in?

Debug code left in?
Review

Yep

Yep

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Build cerc/fixturenet-eth-geth
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/fixturenet-eth-geth:local -f ${SCRIPT_DIR}/Dockerfile $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,6 @@
m/44'/60'/0'/0/0,0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F,0x02cfc16a6212d7bb9dff89b603afbd856157c367de3ef6b626f205d9b150630ea0,0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
Review

Should this be in ./config?

Should this be in ./config?
Review

I think it belongs here, because the accounts are used by ethereum-genesis-generator when it generates the genesis file with pre-funded accounts during the container build.

I think it belongs here, because the accounts are used by `ethereum-genesis-generator` when it generates the genesis file with pre-funded accounts during the container build.
Review

Can you point me to where that is run?

Can you point me to where that is run?
Review

https://github.com/cerc-io/stack-orchestrator/pull/24/files#diff-b2251121f1cc991ed1e0fd066bf19bec47a989e5ac03ad2a189583b72bf8eec8R10

I got my comments backwards on el-config.yaml and accounts.csv. The latter is a bit more complicated. Strictly speaking it out to be an output of the build step rather than an input, as the keys are predictably generated from the mnemonic in el-config.yaml.

There is an issue here: https://github.com/bozemanpass/merge-testnet/issues/1

https://github.com/cerc-io/stack-orchestrator/pull/24/files#diff-b2251121f1cc991ed1e0fd066bf19bec47a989e5ac03ad2a189583b72bf8eec8R10 I got my comments backwards on el-config.yaml and accounts.csv. The latter is a bit more complicated. Strictly speaking it out to be an *output* of the build step rather than an input, as the keys are predictably generated from the mnemonic in el-config.yaml. There is an issue here: https://github.com/bozemanpass/merge-testnet/issues/1
Review
Here: https://github.com/cerc-io/stack-orchestrator/pull/24/files#diff-87b2242d72cd90189e0e62f38fd4f98deca481208ab2ec476eba14de87e00fe5R25
m/44'/60'/0'/0/1,0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a,0x03481404e1b0541b51468cec6b46baf400a56b3f5c6aeee4a2cc75c8175233fc35,0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
m/44'/60'/0'/0/2,0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293,0x02c3ba9ca4321c7ed9dbe9ead24a6b00a79c0e62c1b560e31108ece7ac55f886e5,0x111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
m/44'/60'/0'/0/3,0x9d2edB2B30Bce41375179571944A3f92636ce1Cd,0x02b1ff366ff445fe36bc45a37c37c160552442486832036ae95e186b19692999c9,0xfb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0
m/44'/60'/0'/0/4,0x5D81E609c15E292Bb8255bd9b1B2494DC0386062,0x035edb8877dc2c467e5cd5c8d6020d8af8348ad3106a227132bb0843d95628ec09,0xbe4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf
m/44'/60'/0'/0/5,0x5929AD4A1d6B899065AcF2a66d5EB086a2863bEe,0x02f8e160837d711d47664264d3ac67be996f71886ded509496172584268c4d3a15,0x6177345b77c4069ac4d553f8b43cf68a799ca4bb63eac93d6cf796d63694ebf0
1 m/44'/60'/0'/0/0 0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F 0x02cfc16a6212d7bb9dff89b603afbd856157c367de3ef6b626f205d9b150630ea0 0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
2 m/44'/60'/0'/0/1 0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a 0x03481404e1b0541b51468cec6b46baf400a56b3f5c6aeee4a2cc75c8175233fc35 0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
3 m/44'/60'/0'/0/2 0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293 0x02c3ba9ca4321c7ed9dbe9ead24a6b00a79c0e62c1b560e31108ece7ac55f886e5 0x111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
4 m/44'/60'/0'/0/3 0x9d2edB2B30Bce41375179571944A3f92636ce1Cd 0x02b1ff366ff445fe36bc45a37c37c160552442486832036ae95e186b19692999c9 0xfb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0
5 m/44'/60'/0'/0/4 0x5D81E609c15E292Bb8255bd9b1B2494DC0386062 0x035edb8877dc2c467e5cd5c8d6020d8af8348ad3106a227132bb0843d95628ec09 0xbe4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf
6 m/44'/60'/0'/0/5 0x5929AD4A1d6B899065AcF2a66d5EB086a2863bEe 0x02f8e160837d711d47664264d3ac67be996f71886ded509496172584268c4d3a15 0x6177345b77c4069ac4d553f8b43cf68a799ca4bb63eac93d6cf796d63694ebf0

View File

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

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# 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 > ../build/el/geth.json
python3 /apps/el-gen/genesis_chainspec.py $tmp_dir/genesis-config.yaml > ../build/el/chainspec.json
python3 /apps/el-gen/genesis_besu.py $tmp_dir/genesis-config.yaml > ../build/el/besu.json

View File

@ -0,0 +1,21 @@
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"
Review

Should this be in ./config?

Should this be in ./config?
Review

Same as with the accounts, I think it needs to stay here, as it is part of the input used to generate the genesis file during the container build.

Same as with the accounts, I think it needs to stay here, as it is part of the input used to generate the genesis file during the container build.
Review

I think I got confused between build_el.sh and run_el.sh

I think I got confused between build_el.sh and run_el.sh
eth1_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
eth1_premine_addrs: {}
chain_id: 1212
deposit_contract_address: "0x1212121212121212121212121212121212121212"
eth1_genesis_timestamp: 0
terminal_total_difficulty: 10000000
mergeForkBlock: 100
clique:
enabled: false
signers:
- 36d56343bc308d4ffaac2f793d121aba905fa6cc
- 5e762d4a3847cadaf40a4b0c39574b0ff6698c78
- 15d7acc1019fdf8ab4f0f7bd31ec1487ecb5a2bd

View File

@ -0,0 +1,36 @@
#!/bin/bash
ETHERBASE=`cat /opt/testnet/accounts/accounts.csv | head -1 | cut -d',' -f2`
NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'`
if [ "true" == "$RUN_BOOTNODE" ]; then
geth \
--nodekeyhex="b0ac22adcad37213c7c565810a50f1772291e7b0ce53fb73e7ec2a3c75bc13b5" \
--nodiscover \
--ipcdisable \
--networkid=${NETWORK_ID} \
--netrestrict="${NETRESTRICT}" 2>&1 | tee /var/log/geth_bootnode.log
else
cd /opt/testnet/accounts
./import_keys.sh
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
geth \
--bootnodes="${ENODE}" \
--allow-insecure-unlock \
--http \
--http.addr="0.0.0.0" \
--http.vhosts="*" \
--http.api="eth,web3,net,admin,personal" \
--http.corsdomain="*" \
--authrpc.addr="0.0.0.0" \
--authrpc.vhosts="*" \
--authrpc.jwtsecret="/opt/testnet/build/el/jwtsecret" \
--networkid=${NETWORK_ID} \
--netrestrict="${NETRESTRICT}" \
--syncmode=full \
--mine \
--miner.threads=1 \
--miner.etherbase=${ETHERBASE} 2>&1 | tee /var/log/geth.log
fi

View File

@ -0,0 +1,30 @@
FROM sigp/lcli AS lcli
FROM skylenet/ethereum-genesis-generator AS ethgen
FROM cerc/fixturenet-eth-geth:local AS fnetgeth
FROM cerc/lighthouse:local
# cerc/lighthouse is based on Ubuntu
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
libssl-dev ca-certificates \
curl socat iproute2 telnet wget jq \
build-essential python3 python3-dev python3-pip gettext-base \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY genesis /opt/testnet
COPY run-cl.sh /opt/testnet/run.sh
COPY --from=lcli /usr/local/bin/lcli /usr/local/bin/lcli
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools
COPY --from=ethgen /apps /apps
COPY --from=fnetgeth /opt/testnet/el /opt/testnet/el
COPY --from=fnetgeth /opt/testnet/accounts /opt/testnet/accounts
RUN cd /opt/testnet && make genesis-cl
# Work around some bugs in lcli where the default path is always used.
RUN mkdir -p /root/.lighthouse && cd /root/.lighthouse && ln -s /opt/testnet/build/cl/testnet
ENTRYPOINT ["/opt/testnet/run.sh"]

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Build cerc/fixturenet-eth-lighthouse
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/fixturenet-eth-lighthouse:local -f ${SCRIPT_DIR}/Dockerfile $SCRIPT_DIR

View File

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

View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# See: https://github.com/sigp/lighthouse/blob/stable/scripts/local_testnet/beacon_node.sh
#
# Starts a beacon node based upon a genesis state created by `./setup.sh`.
#
set -Eeuo pipefail
source ./vars.env
SUBSCRIBE_ALL_SUBNETS=
DEBUG_LEVEL=${DEBUG_LEVEL:-info}
# Get positional arguments
data_dir=$DATADIR/node_${NODE_NUMBER}
network_port=9001
http_port=8001
authrpc_port=8551
ENR=`cat $DATADIR/bootnode/enr.dat`
exec lighthouse \
--debug-level $DEBUG_LEVEL \
bn \
$SUBSCRIBE_ALL_SUBNETS \
--boot-nodes "$ENR" \
--datadir $data_dir \
--testnet-dir $TESTNET_DIR \
--enable-private-discovery \
--staking \
--enr-address $BOOTNODE_IP \
--enr-udp-port $network_port \
--enr-tcp-port $network_port \
--port $network_port \
--http-address 0.0.0.0 \
--http-port $http_port \
--disable-packet-filter \
--execution-endpoint $EXECUTION_ENDPOINT \
--execution-jwt $JWTSECRET \
--terminal-total-difficulty-override $ETH1_TTD \
--suggested-fee-recipient $SUGGESTED_FEE_RECIPIENT \
--target-peers $((BN_COUNT - 1))

View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# See: https://github.com/sigp/lighthouse/blob/stable/scripts/local_testnet/bootnode.sh
#
# Starts a bootnode from the generated enr.
#
set -Eeuo pipefail
source ./vars.env
DEBUG_LEVEL=${1:-info}
echo "Starting bootnode"
exec lighthouse boot_node \
--testnet-dir $TESTNET_DIR \
--port $BOOTNODE_PORT \
--listen-address 0.0.0.0 \
--disable-packet-filter \
--network-dir $DATADIR/bootnode \

View File

@ -0,0 +1,74 @@
#!/usr/bin/env bash
#
# Deploys the deposit contract and makes deposits for $VALIDATOR_COUNT insecure deterministic validators.
# Produces a testnet specification and a genesis state where the genesis time
# is now + $GENESIS_DELAY.
#
# Generates datadirs for multiple validator keys according to the
# $VALIDATOR_COUNT and $BN_COUNT variables.
#
set -o nounset -o errexit -o pipefail
source ./vars.env
rm -rf $DATADIR
mkdir -p $DATADIR
NOW=`date +%s`
GENESIS_TIME=`expr $NOW + $GENESIS_DELAY`
echo "Creating testnet ..."
lcli \
new-testnet \
--spec $SPEC_PRESET \
--deposit-contract-address $ETH1_DEPOSIT_CONTRACT_ADDRESS \
--testnet-dir $TESTNET_DIR \
--min-genesis-active-validator-count $GENESIS_VALIDATOR_COUNT \
--min-genesis-time $GENESIS_TIME \
--genesis-delay $GENESIS_DELAY \
--genesis-fork-version $GENESIS_FORK_VERSION \
--altair-fork-epoch $ALTAIR_FORK_EPOCH \
--merge-fork-epoch $MERGE_FORK_EPOCH \
--eth1-id $ETH1_CHAIN_ID \
--eth1-follow-distance 1 \
--seconds-per-slot $SECONDS_PER_SLOT \
--seconds-per-eth1-block $SECONDS_PER_ETH1_BLOCK \
--force
echo Specification generated at $TESTNET_DIR.
echo "Generating $VALIDATOR_COUNT validators concurrently... (this may take a while)"
lcli \
insecure-validators \
--count $VALIDATOR_COUNT \
--base-dir $DATADIR \
--node-count $BN_COUNT
echo Validators generated with keystore passwords at $DATADIR.
echo "Building genesis state... (this might take a while)"
lcli \
interop-genesis \
--spec $SPEC_PRESET \
--genesis-time $GENESIS_TIME \
--testnet-dir $TESTNET_DIR \
$GENESIS_VALIDATOR_COUNT
echo Created genesis state in $TESTNET_DIR
echo "Generating bootnode enr"
lcli \
generate-bootnode-enr \
--ip $BOOTNODE_IP \
--udp-port $BOOTNODE_PORT \
--tcp-port $BOOTNODE_PORT \
--genesis-fork-version $GENESIS_FORK_VERSION \
--output-dir $DATADIR/bootnode
bootnode_enr=`cat $DATADIR/bootnode/enr.dat`
echo "- $bootnode_enr" > $TESTNET_DIR/boot_enr.yaml
echo "Generated bootnode enr and written to $TESTNET_DIR/boot_enr.yaml"

View File

@ -0,0 +1,19 @@
#!/bin/bash
# See: https://github.com/sigp/lighthouse/blob/stable/scripts/local_testnet/reset_genesis_time.sh
#
# Resets the beacon state genesis time to now.
#
set -Eeuo pipefail
source ./vars.env
NOW=${1:-`date +%s`}
lcli \
change-genesis-time \
$TESTNET_DIR/genesis.ssz \
$NOW
echo "Reset genesis time to now ($NOW)"

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# See: https://github.com/sigp/lighthouse/blob/stable/scripts/local_testnet/validator_client.sh
#
# Usage: ./validator_client.sh <DATADIR> <BEACON-NODE-HTTP> <OPTIONAL-DEBUG-LEVEL>
set -Eeuo pipefail
source ./vars.env
DEBUG_LEVEL=info
BUILDER_PROPOSALS=
# Get options
while getopts "pd:" flag; do
case "${flag}" in
p) BUILDER_PROPOSALS="--builder-proposals";;
d) DEBUG_LEVEL=${OPTARG};;
esac
done
exec lighthouse \
--debug-level $DEBUG_LEVEL \
vc \
$BUILDER_PROPOSALS \
--validators-dir $DATADIR/node_$NODE_NUMBER/validators \
--secrets-dir $DATADIR/node_$NODE_NUMBER/secrets \
--testnet-dir $TESTNET_DIR \
--init-slashing-protection \
--beacon-nodes http://localhost:8001 \
--suggested-fee-recipient $SUGGESTED_FEE_RECIPIENT \
$VC_ARGS

View File

@ -0,0 +1,52 @@
# Base directories for the validator keys and secrets
DATADIR=${DATADIR:-../build/cl}
# Directory for the eth2 config
TESTNET_DIR=${TESTNET_DIR:-$DATADIR/testnet}
JWTSECRET=${JWTSECRET:-$DATADIR/jwtsecret}
GENESIS_FORK_VERSION=${GENESIS_FORK_VERSION:-0x12121212}
VALIDATOR_COUNT=${VALIDATOR_COUNT:-80}
GENESIS_VALIDATOR_COUNT=${GENESIS_VALIDATOR_COUNT:-80}
# Number of beacon_node instances that you intend to run
BN_COUNT=${BN_COUNT:-2}
# Number of validator clients
VC_COUNT=${VC_COUNT:-$BN_COUNT}
# Number of seconds to delay to start genesis block.
# If started by a script this can be 0, if starting by hand
# use something like 180.
GENESIS_DELAY=${GENESIS_DELAY:-0}
# Port for P2P communication with bootnode
BOOTNODE_IP=${BOOTNODE_IP:-172.16.254.11}
BOOTNODE_PORT=${BOOTNODE_PORT:-4242}
# Hard fork configuration
ALTAIR_FORK_EPOCH=${ALTAIR_FORK_EPOCH:-1}
MERGE_FORK_EPOCH=${MERGE_FORK_EPOCH:-2}
# Spec version (mainnet or minimal)
SPEC_PRESET=${SPEC_PRESET:-mainnet}
# Seconds per Eth2 slot
SECONDS_PER_SLOT=${SECONDS_PER_SLOT:-3}
# Seconds per Eth1 block
SECONDS_PER_ETH1_BLOCK=${SECONDS_PER_ETH1_BLOCK:-1}
# Command line arguments for validator client
VC_ARGS=${VC_ARGS:-""}
EXECUTION_ENDPOINT=${EXECUTION_ENDPOINT:-http://localhost:8551}
ETH1_CONFIG_YAML=${ETH1_CONFIG_YAML:-"../el/el-config.yaml"}
ETH1_CHAIN_ID=${ETH1_CHAIN_ID:-`cat $ETH1_CONFIG_YAML | grep 'chain_id' | awk '{ print $2 }'`}
ETH1_TTD=${ETH1_TTD:-`cat $ETH1_CONFIG_YAML | grep 'terminal_total_difficulty' | awk '{ print $2 }'`}
ETH1_DEPOSIT_CONTRACT_ADDRESS=${ETH1_DEPOSIT_CONTRACT_ADDRESS:-`cat $ETH1_CONFIG_YAML | grep 'deposit_contract_address' | awk '{ print $2 }' | sed 's/"//g'`}
ETH1_DEPOSIT_CONTRACT_BLOCK=${ETH1_DEPOSIT_CONTRACT_BLOCK:-0x0}
SUGGESTED_FEE_RECIPIENT=`cat ../accounts/accounts.csv | head -1 | cut -d',' -f2`

View File

@ -0,0 +1,47 @@
#!/bin/bash
if [ "true" == "$RUN_BOOTNODE" ]; then
cd /opt/testnet/cl
./bootnode.sh 2>&1 | tee /var/log/lighthouse_bootnode.log
else
while [ 1 -eq 1 ]; do
echo "Waiting on DAG ..."
sleep 5
result=`wget --no-check-certificate --quiet \
-O - \
--method POST \
--timeout=0 \
--header 'Content-Type: application/json' \
--body-data '{ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["0x3", false] }' "${ETH1_ENDPOINT:-localhost:8545}" | jq -r '.result'`
if [ ! -z "$result" ] && [ "null" != "$result" ]; then
break
fi
done
cd /opt/testnet/cl
if [ -z "$LIGHTHOUSE_GENESIS_STATE_URL" ]; then
./reset_genesis_time.sh
else
while [ 1 -eq 1 ]; do
echo "Waiting on Genesis time ..."
sleep 5
result=`wget --no-check-certificate --quiet -O - --timeout=0 $LIGHTHOUSE_GENESIS_STATE_URL | jq -r '.data.genesis_time'`
if [ ! -z "$result" ]; then
./reset_genesis_time.sh $result
break;
fi
done
fi
export JWTSECRET="/opt/testnet/build/cl/jwtsecret"
echo -n "$JWT" > $JWTSECRET
./beacon_node.sh 2>&1 | tee /var/log/lighthouse_bn.log &
lpid=$!
./validator_client.sh 2>&1 | tee /var/log/lighthouse_vc.log &
vpid=$!
wait $lpid $vpid
fi

View File

@ -10,3 +10,5 @@ cerc/ipld-eth-beacon-indexer
cerc/ipld-eth-server
cerc/laconicd
cerc/laconic-cns-cli
cerc/fixturenet-eth-geth
cerc/fixturenet-eth-lighthouse

View File

@ -8,3 +8,4 @@ ipld-eth-server
lighthouse
prometheus-grafana
laconicd
fixturenet-eth