From f1a626ddf5ecc7cb87d09a4d66f530da2f06bbfb Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 6 Jun 2023 05:54:22 +0800 Subject: [PATCH 1/3] build local lighthouse cli (#420) * Build lcli locally * Pull lighthouse repo * Enable portable lcli build * Update ldcli options * Add lcli container to fixturenet-eth stack * Include --eth1-block-hash --------- Co-authored-by: David Boreham Co-authored-by: Thomas E Lackey --- .../cerc-fixturenet-eth-geth/Dockerfile | 12 ++++++++++++ .../cerc-fixturenet-eth-lighthouse/Dockerfile | 2 +- .../genesis/cl/build_cl.sh | 4 +++- .../genesis/cl/vars.env | 2 ++ .../cerc-fixturenet-plugeth-lighthouse/Dockerfile | 2 +- .../container-build/cerc-lighthouse-cli/build.sh | 7 +++++++ app/data/stacks/fixturenet-eth-loaded/stack.yml | 2 ++ app/data/stacks/fixturenet-eth-tx/stack.yml | 4 +++- app/data/stacks/fixturenet-eth/stack.yml | 2 ++ app/data/stacks/fixturenet-plugeth-tx/stack.yml | 4 +++- 10 files changed, 36 insertions(+), 5 deletions(-) create mode 100755 app/data/container-build/cerc-lighthouse-cli/build.sh diff --git a/app/data/container-build/cerc-fixturenet-eth-geth/Dockerfile b/app/data/container-build/cerc-fixturenet-eth-geth/Dockerfile index 666f9117..dc81eb06 100644 --- a/app/data/container-build/cerc-fixturenet-eth-geth/Dockerfile +++ b/app/data/container-build/cerc-fixturenet-eth-geth/Dockerfile @@ -22,6 +22,18 @@ COPY run-el.sh /opt/testnet/run.sh RUN cd /opt/testnet && make genesis-el COPY --from=geth /usr/local/bin/geth /usr/local/bin/ + +# Snag the genesis block info. RUN geth --datadir ~/ethdata init /opt/testnet/build/el/geth.json && rm -f ~/ethdata/geth/nodekey +RUN cp -rp ~/ethdata ~/tmpeth && \ + geth --datadir ~/tmpeth init /opt/testnet/build/el/geth.json && \ + geth --datadir ~/tmpeth --http & \ + sleep 5 && \ + curl -q --location 'localhost:8545' \ + --header 'Content-Type: application/json' \ + --data '{ "jsonrpc": "2.0", "id": 14, "method": "eth_getBlockByNumber", "params": ["0x0", false] }' \ + -o /opt/testnet/build/el/genesis_block.json && \ + killall -9 geth && \ + rm -rf ~/tmpeth ENTRYPOINT ["/opt/testnet/run.sh"] diff --git a/app/data/container-build/cerc-fixturenet-eth-lighthouse/Dockerfile b/app/data/container-build/cerc-fixturenet-eth-lighthouse/Dockerfile index 958d2b39..87f9bb60 100644 --- a/app/data/container-build/cerc-fixturenet-eth-lighthouse/Dockerfile +++ b/app/data/container-build/cerc-fixturenet-eth-lighthouse/Dockerfile @@ -1,4 +1,4 @@ -FROM sigp/lcli:v4.1.0 AS lcli +FROM cerc/lighthouse-cli:local AS lcli FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen FROM cerc/fixturenet-eth-geth:local AS fnetgeth diff --git a/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh index ab3ad2af..50b3e4e6 100755 --- a/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh +++ b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh @@ -27,12 +27,14 @@ lcli \ --deposit-contract-address $ETH1_DEPOSIT_CONTRACT_ADDRESS \ --testnet-dir $TESTNET_DIR \ --min-genesis-active-validator-count $GENESIS_VALIDATOR_COUNT \ + --validator-count $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 \ + --bellatrix-fork-epoch $MERGE_FORK_EPOCH \ --eth1-id $ETH1_CHAIN_ID \ + --eth1-block-hash $ETH1_BLOCK_HASH \ --eth1-follow-distance 1 \ --seconds-per-slot $SECONDS_PER_SLOT \ --seconds-per-eth1-block $SECONDS_PER_ETH1_BLOCK \ diff --git a/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env index b8c27349..f2060a9a 100644 --- a/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env +++ b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env @@ -42,7 +42,9 @@ VC_ARGS=${VC_ARGS:-""} EXECUTION_ENDPOINT=${EXECUTION_ENDPOINT:-http://localhost:8551} ETH1_GENESIS_JSON=${ETH1_GENESIS_JSON:-"../build/el/geth.json"} +ETH1_GENESIS_BLOCK_JSON=${ETH1_GENESIS_BLOCK_JSON:-"../build/el/genesis_block.json"} ETH1_CONFIG_YAML=${ETH1_CONFIG_YAML:-"../el/el-config.yaml"} +ETH1_BLOCK_HASH=${ETH1_BLOCK_HASH:-`cat $ETH1_GENESIS_BLOCK_JSON | jq -r '.result.hash' | cut -d'x' -f2`} ETH1_CHAIN_ID=${ETH1_CHAIN_ID:-`cat $ETH1_GENESIS_JSON | jq -r '.config.chainId'`} ETH1_TTD=${ETH1_TTD:-`cat $ETH1_GENESIS_JSON | jq -r '.config.terminalTotalDifficulty'`} diff --git a/app/data/container-build/cerc-fixturenet-plugeth-lighthouse/Dockerfile b/app/data/container-build/cerc-fixturenet-plugeth-lighthouse/Dockerfile index 8701fe2d..ba92294b 100644 --- a/app/data/container-build/cerc-fixturenet-plugeth-lighthouse/Dockerfile +++ b/app/data/container-build/cerc-fixturenet-plugeth-lighthouse/Dockerfile @@ -1,4 +1,4 @@ -FROM sigp/lcli:v4.1.0 AS lcli +FROM cerc/lighthouse-cli:local AS lcli FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen FROM cerc/fixturenet-plugeth-plugeth:local AS fnetgeth diff --git a/app/data/container-build/cerc-lighthouse-cli/build.sh b/app/data/container-build/cerc-lighthouse-cli/build.sh new file mode 100755 index 00000000..75719ef4 --- /dev/null +++ b/app/data/container-build/cerc-lighthouse-cli/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Build cerc/lighthouse-cli + +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh + +project_dir=${CERC_REPO_BASE_DIR}/lighthouse +docker build -t cerc/lighthouse-cli:local --build-arg PORTABLE=true -f ${project_dir}/lcli/Dockerfile ${build_command_args} ${project_dir} diff --git a/app/data/stacks/fixturenet-eth-loaded/stack.yml b/app/data/stacks/fixturenet-eth-loaded/stack.yml index 676e95e2..dd7e05fd 100644 --- a/app/data/stacks/fixturenet-eth-loaded/stack.yml +++ b/app/data/stacks/fixturenet-eth-loaded/stack.yml @@ -6,9 +6,11 @@ repos: - github.com/cerc-io/tx-spammer - github.com/cerc-io/ipld-eth-server - github.com/cerc-io/ipld-eth-db + - github.com/cerc-io/lighthouse containers: - cerc/go-ethereum - cerc/lighthouse + - cerc/lighthouse-cli - cerc/fixturenet-eth-geth - cerc/fixturenet-eth-lighthouse - cerc/ipld-eth-server diff --git a/app/data/stacks/fixturenet-eth-tx/stack.yml b/app/data/stacks/fixturenet-eth-tx/stack.yml index 0281b262..35e43575 100644 --- a/app/data/stacks/fixturenet-eth-tx/stack.yml +++ b/app/data/stacks/fixturenet-eth-tx/stack.yml @@ -4,10 +4,12 @@ decription: "Ethereum Fixturenet w/ tx-spammer" repos: - github.com/cerc-io/go-ethereum - github.com/cerc-io/tx-spammer - - dboreham/foundry + - github.com/dboreham/foundry + - github.com/cerc-io/lighthouse containers: - cerc/go-ethereum - cerc/lighthouse + - cerc/lighthouse-cli - cerc/fixturenet-eth-geth - cerc/fixturenet-eth-lighthouse - cerc/tx-spammer diff --git a/app/data/stacks/fixturenet-eth/stack.yml b/app/data/stacks/fixturenet-eth/stack.yml index ccd2526a..ae06e2d2 100644 --- a/app/data/stacks/fixturenet-eth/stack.yml +++ b/app/data/stacks/fixturenet-eth/stack.yml @@ -3,10 +3,12 @@ name: fixturenet-eth decription: "Ethereum Fixturenet" repos: - github.com/cerc-io/go-ethereum + - github.com/cerc-io/lighthouse - github.com/dboreham/foundry containers: - cerc/go-ethereum - cerc/lighthouse + - cerc/lighthouse-cli - cerc/fixturenet-eth-geth - cerc/fixturenet-eth-lighthouse - cerc/foundry diff --git a/app/data/stacks/fixturenet-plugeth-tx/stack.yml b/app/data/stacks/fixturenet-plugeth-tx/stack.yml index 49dea4c5..e6d8c615 100644 --- a/app/data/stacks/fixturenet-plugeth-tx/stack.yml +++ b/app/data/stacks/fixturenet-plugeth-tx/stack.yml @@ -3,9 +3,11 @@ name: fixturenet-plugeth-tx decription: "plugeth Ethereum Fixturenet w/ tx-spammer" repos: - github.com/cerc-io/tx-spammer - - dboreham/foundry + - github.com/dboreham/foundry + - github.com/cerc-io/lighthouse containers: - cerc/lighthouse + - cerc/lighthouse-cli - cerc/fixturenet-plugeth-plugeth - cerc/fixturenet-plugeth-lighthouse - cerc/tx-spammer From a8e198ad5516552c1e33337294c68728de80452d Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Mon, 5 Jun 2023 18:16:42 -0500 Subject: [PATCH 2/3] Allow configuring the number of statediff workers. (#422) * Allow configuring the number of statediff workers. * Leave logging alone --- app/data/config/fixturenet-eth/fixturenet-eth.env | 3 ++- app/data/container-build/cerc-fixturenet-eth-geth/run-el.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/data/config/fixturenet-eth/fixturenet-eth.env b/app/data/config/fixturenet-eth/fixturenet-eth.env index 06e90b61..ea56e2ec 100644 --- a/app/data/config/fixturenet-eth/fixturenet-eth.env +++ b/app/data/config/fixturenet-eth/fixturenet-eth.env @@ -17,7 +17,8 @@ CERC_STATEDIFF_DB_PORT=5432 CERC_STATEDIFF_DB_NAME="cerc_testing" CERC_STATEDIFF_DB_USER="vdbm" CERC_STATEDIFF_DB_PASSWORD="password" -CERC_STATEDIFF_DB_GOOSE_MIN_VER=${CERC_STATEDIFF_DB_GOOSE_MIN_VER:-23} +CERC_STATEDIFF_DB_GOOSE_MIN_VER=${CERC_STATEDIFF_DB_GOOSE_MIN_VER:-18} CERC_STATEDIFF_DB_LOG_STATEMENTS="false" +CERC_STATEDIFF_WORKERS=2 CERC_GETH_VMODULE="statediff/*=5,rpc/*=5" diff --git a/app/data/container-build/cerc-fixturenet-eth-geth/run-el.sh b/app/data/container-build/cerc-fixturenet-eth-geth/run-el.sh index 9f6bf1f7..4c1a0ce1 100755 --- a/app/data/container-build/cerc-fixturenet-eth-geth/run-el.sh +++ b/app/data/container-build/cerc-fixturenet-eth-geth/run-el.sh @@ -92,6 +92,7 @@ else --statediff.db.logstatements=${CERC_STATEDIFF_DB_LOG_STATEMENTS:-false} \ --statediff.db.copyfrom=${CERC_STATEDIFF_DB_COPY_FROM:-true} \ --statediff.waitforsync=true \ + --statediff.workers=${CERC_STATEDIFF_WORKERS:-1} \ --statediff.writing=true" fi From 26ff7a969c9ce51031df1e1507d707348b6c4107 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Mon, 5 Jun 2023 21:10:17 -0500 Subject: [PATCH 3/3] Fix plugeth build. (#423) --- .../cerc-fixturenet-plugeth-plugeth/Dockerfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/data/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile b/app/data/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile index 90cd38d3..9936c3dc 100644 --- a/app/data/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile +++ b/app/data/container-build/cerc-fixturenet-plugeth-plugeth/Dockerfile @@ -6,7 +6,7 @@ RUN go install github.com/go-delve/delve/cmd/dlv@latest FROM ubuntu:22.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ - python3 python3-dev python3-pip curl wget jq gettext gettext-base openssl bash dnsutils postgresql-client make iproute2 netcat && \ + python3 python3-dev python3-pip curl wget jq gettext gettext-base openssl bash dnsutils postgresql-client make iproute2 netcat psmisc && \ rm -rf /var/lib/apt/lists/* COPY --from=delve /go/bin/dlv /usr/local/bin/ @@ -24,4 +24,17 @@ RUN cd /opt/testnet && make genesis-el RUN geth --datadir ~/ethdata init /opt/testnet/build/el/geth.json && rm -f ~/ethdata/geth/nodekey +# Snag the genesis block info. +RUN geth --datadir ~/ethdata init /opt/testnet/build/el/geth.json && rm -f ~/ethdata/geth/nodekey +RUN cp -rp ~/ethdata ~/tmpeth && \ + geth --datadir ~/tmpeth init /opt/testnet/build/el/geth.json && \ + geth --datadir ~/tmpeth --http & \ + sleep 5 && \ + curl -q --location 'localhost:8545' \ + --header 'Content-Type: application/json' \ + --data '{ "jsonrpc": "2.0", "id": 14, "method": "eth_getBlockByNumber", "params": ["0x0", false] }' \ + -o /opt/testnet/build/el/genesis_block.json && \ + killall -9 geth && \ + rm -rf ~/tmpeth + ENTRYPOINT ["/opt/testnet/run.sh"]