Add option to enable statediffing for the fixturenet geth. (#32)

* Add option to enable statediffing for the fixturenet geth.

* eol

* Review comments
This commit is contained in:
Thomas E Lackey 2022-11-01 12:44:33 -05:00 committed by GitHub
parent 01fd7e251a
commit f2c9af4ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 44 deletions

View File

@ -1,32 +0,0 @@
version: "3.2"
services:
migrations:
restart: on-failure
depends_on:
ipld-eth-db:
condition: service_healthy
image: cerc/ipld-eth-db:local
environment:
DATABASE_USER: "vdbm"
DATABASE_NAME: "cerc_testing"
DATABASE_PASSWORD: "password"
DATABASE_HOSTNAME: "ipld-eth-db"
DATABASE_PORT: 5432
ipld-eth-db:
image: timescale/timescaledb:latest-pg14
restart: always
command: ["postgres", "-c", "log_statement=all"]
environment:
POSTGRES_USER: "vdbm"
POSTGRES_DB: "cerc_testing"
POSTGRES_PASSWORD: "password"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 30s
timeout: 10s
retries: 10
start_period: 3s
ports:
- "127.0.0.1:8077:5432"

View File

@ -1,20 +1,31 @@
# TODO: figure out if this is needed -- it doesn't seem to make sense in the context of the
# current version of cerc/ipld-eth-db/Dockerfile, which is only the migrations code, not the DB itself
# The sibling component docker-compose-db-sharding.yml looks more plausible
version: "3.2"
services:
ipld-eth-db:
restart: always
migrations:
restart: on-failure
depends_on:
ipld-eth-db:
condition: service_healthy
image: cerc/ipld-eth-db:local
environment:
DATABASE_USER: "vdbm"
DATABASE_NAME: "cerc_testing"
DATABASE_PASSWORD: "password"
DATABASE_HOSTNAME: "ipld-eth-db"
DATABASE_PORT: 5432
ipld-eth-db:
image: timescale/timescaledb:latest-pg14
restart: always
environment:
POSTGRES_USER: "vdbm"
POSTGRES_DB: "cerc_testing"
POSTGRES_PASSWORD: "password"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 5s
timeout: 3s
retries: 5
interval: 30s
timeout: 10s
retries: 10
start_period: 3s
ports:
- "127.0.0.1:8077:5432"
command: ["postgres", "-c", "log_statement=all"]

View File

@ -21,10 +21,14 @@ services:
fixturenet-eth-geth-2:
hostname: fixturenet-eth-geth-2
environment:
CERC_RUN_STATEDIFF: "true"
CERC_STATEDIFF_DB_NODE_ID: 2
env_file:
- ../config/fixturenet-eth/fixturenet-eth.env
image: cerc/fixturenet-eth-geth:local
depends_on:
- migrations
- fixturenet-eth-bootnode-geth
fixturenet-eth-bootnode-lighthouse:

View File

@ -7,4 +7,12 @@ ENODE="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13
# JWT shared by geth and lighthouse for authentication.
JWT="0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0"
# URL to download the ENR of the lighthouse bootnode (generated at first start).
ENR_URL="http://fixturenet-eth-bootnode-lighthouse:3000/bootnode/enr.dat"
# DB connection settings for statediffing (see docker-compose-db.yml)
CERC_STATEDIFF_DB_HOST="ipld-eth-db"
CERC_STATEDIFF_DB_PORT=5432
CERC_STATEDIFF_DB_NAME="cerc_testing"
CERC_STATEDIFF_DB_USER="vdbm"
CERC_STATEDIFF_DB_PASSWORD="password"

View File

@ -17,6 +17,19 @@ else
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
STATEDIFF_OPTS=""
if [ "$CERC_RUN_STATEDIFF" == "true" ]; then
STATEDIFF_OPTS="--statediff=true \
--statediff.db.host=$CERC_STATEDIFF_DB_HOST \
--statediff.db.name=$CERC_STATEDIFF_DB_NAME \
--statediff.db.nodeid=$CERC_STATEDIFF_DB_NODE_ID \
--statediff.db.password=$CERC_STATEDIFF_DB_PASSWORD \
--statediff.db.port=$CERC_STATEDIFF_DB_PORT \
--statediff.db.user=$CERC_STATEDIFF_DB_USER \
--statediff.waitforsync=true \
--statediff.writing=true"
fi
geth \
--bootnodes="${ENODE}" \
--allow-insecure-unlock \
@ -28,7 +41,7 @@ else
--authrpc.addr="0.0.0.0" \
--authrpc.vhosts="*" \
--authrpc.jwtsecret="/opt/testnet/build/el/jwtsecret" \
--networkid=${NETWORK_ID} \
--networkid="${NETWORK_ID}" \
--netrestrict="${NETRESTRICT}" \
--gcmode archive \
--txlookuplimit=0 \
@ -36,5 +49,5 @@ else
--syncmode=full \
--mine \
--miner.threads=1 \
--miner.etherbase=${ETHERBASE} 2>&1 | tee /var/log/geth.log
--miner.etherbase="${ETHERBASE}" ${STATEDIFF_OPTS} 2>&1 | tee /var/log/geth.log
fi

View File

@ -1,5 +1,5 @@
contract
db-sharding
db
eth-statediff-fill-service
go-ethereum-foundry
ipld-eth-beacon-db