Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE]configure hf from shapella to dencun #61

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions tests/e2e/chains/ethereum/Dockerfile.geth
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@ ARG VERSION=latest
FROM ethereum/client-go:${VERSION}

# For health check
RUN apk add --no-cache curl
RUN apk add --no-cache bash curl jq sed

RUN mkdir -p /execution /config
COPY ./execution/genesis.json /execution/
COPY ./config /config

# Init
RUN geth --datadir=/execution init --state.scheme hash --db.engine=leveldb /execution/genesis.json

# Import keys
RUN geth --datadir=/execution account import --password /dev/null /config/dev-key0.prv
RUN geth --datadir=/execution account import --password /dev/null /config/dev-key1.prv


ENTRYPOINT ["geth"]
ENTRYPOINT ["bash", "/geth_entrypoint.sh"]
2 changes: 2 additions & 0 deletions tests/e2e/chains/ethereum/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ STAKING-CLI=docker run -it --rm -v $(shell pwd)/consensus/validator_keys:/app/va
# Run geth lodestar deposit lodestar-validator
.PHONY:network
network:
EPOCH_DENCUN=8 \
GENESIS_TIMESTAMP=$(shell date -d'+10second' +%s) \
GETH_VERSION=$(GETH_VERSION) GETH_HTTP_PORT=$(GETH_HTTP_PORT) \
LODESTAR_VERSION=$(LODESTAR_VERSION) BEACON_HTTP_PORT=$(BEACON_HTTP_PORT) \
$(DOCKER_COMPOSE) up $(COMPOSE_UP_OPTS) geth lodestar deposit lodestar-validator
Expand Down
13 changes: 9 additions & 4 deletions tests/e2e/chains/ethereum/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ services:
- ${GETH_HTTP_PORT:-8545}:${GETH_HTTP_PORT:-8545} # RPC Port
volumes:
- geth-storage:/execution/geth
- ./scripts/geth_entrypoint.sh:/geth_entrypoint.sh
- ./config/jwtsecret:/secret/jwtsecret
environment:
- GENESIS_TIMESTAMP=${GENESIS_TIMESTAMP}
- EPOCH_DENCUN=${EPOCH_DENCUN}
healthcheck:
test: [ "CMD", "curl", "-X", "POST", "-H", "'Content-Type: application/json'", "--data", '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false]}', "http://127.0.0.1:${GETH_HTTP_PORT:-8545}" ]
interval: "5s"
Expand Down Expand Up @@ -61,14 +65,16 @@ services:
container_name: lodestar
volumes:
- lodestar-storage:/data
- ./scripts/lodestar_entrypoint.sh:/scripts/lodestar_entrypoint.sh
- ./scripts/lodestar_entrypoint.sh:/lodestar_entrypoint.sh
- ./config/jwtsecret:/secret/jwtsecret
- ./consensus:/validator-data
- logs:/logs
environment:
- NODE_OPTIONS=--max-old-space-size=8192
- GETH_HTTP_PORT=${GETH_HTTP_PORT:-8545}
- BEACON_HTTP_PORT=${BEACON_HTTP_PORT:-9596}
- GENESIS_TIMESTAMP=${GENESIS_TIMESTAMP}
- EPOCH_DENCUN=${EPOCH_DENCUN}
ports:
- "8008:8008" # Metrics port
- ${BEACON_HTTP_PORT:-9596}:${BEACON_HTTP_PORT:-9596} # REST API port
Expand All @@ -77,7 +83,6 @@ services:
interval: "5s"
timeout: "10s"
retries: 10
entrypoint: /scripts/lodestar_entrypoint.sh
command:
- dev
- --dataDir=/data
Expand All @@ -98,7 +103,7 @@ services:
- --params.ALTAIR_FORK_EPOCH=0
- --params.BELLATRIX_FORK_EPOCH=0
- --params.CAPELLA_FORK_EPOCH=0
- --params.DENEB_FORK_EPOCH=0
- --params.DENEB_FORK_EPOCH=$${deneb_fork_epoch}
- --params.DEPOSIT_CONTRACT_ADDRESS=0x4242424242424242424242424242424242424242
- --suggestedFeeRecipient=0xa89F47C6b463f74d87572b058427dA0A13ec5425
- --beaconNodes=http://127.0.0.1:${BEACON_HTTP_PORT}
Expand Down Expand Up @@ -151,7 +156,7 @@ services:
- --params.ALTAIR_FORK_EPOCH=0
- --params.BELLATRIX_FORK_EPOCH=0
- --params.CAPELLA_FORK_EPOCH=0
- --params.DENEB_FORK_EPOCH=0
- --params.DENEB_FORK_EPOCH=$${deneb_fork_epoch}
- --params.DEPOSIT_CONTRACT_ADDRESS=0x4242424242424242424242424242424242424242
- --suggestedFeeRecipient=0xa89F47C6b463f74d87572b058427dA0A13ec5425
- --beaconNodes=http://lodestar:$${BEACON_HTTP_PORT}
Expand Down
24 changes: 24 additions & 0 deletions tests/e2e/chains/ethereum/scripts/geth_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -eux

GENESIS_TIMESTAMP=${GENESIS_TIMESTAMP}
EPOCH_CANCUN=${EPOCH_DENCUN}

MINIMAL_SECONDS_PER_SLOT=6
MINIMAL_SLOTS_PER_EPOCH=8

CANCUN_TIMESTAMP_DIFF=$((EPOCH_CANCUN * MINIMAL_SECONDS_PER_SLOT * MINIMAL_SLOTS_PER_EPOCH))
CANCUN_TIMESTAMP=$((GENESIS_TIMESTAMP + CANCUN_TIMESTAMP_DIFF))

sed -i.bak s/"\"cancunTime\": 0/\"cancunTime\": ${CANCUN_TIMESTAMP}/" /execution/genesis.json

cat /execution/genesis.json

# Init
geth --datadir=/execution init --state.scheme hash --db.engine=leveldb /execution/genesis.json

# Import keys
geth --datadir=/execution account import --password /dev/null /config/dev-key0.prv
geth --datadir=/execution account import --password /dev/null /config/dev-key1.prv

geth $*
19 changes: 3 additions & 16 deletions tests/e2e/chains/ethereum/scripts/lodestar_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,12 @@ if [ -z "$genesisHash" ]; then
exit 1
fi

# Get timestamp
# Note: alpine has a problem for date command, `coreutils`` is required
# - https://unix.stackexchange.com/questions/206540/date-d-command-fails-on-docker-alpine-linux-container
OS="$(uname)"
timestamp=""
if [[ "$OS" =~ ^Darwin ]]; then
timestamp=$(date -v+10S '+%s')
elif [[ "$OS" =~ ^Linux ]]; then
timestamp=$(date -d'+10second' +%s)
else
echo "This platform is not supported"
exit 1
fi

deneb_fork_epoch=${EPOCH_DENCUN}
# Replace string of environment variable in command
tmp=$(echo $cmd | sed -e 's/\${timestamp}/'${timestamp}'/g')
tmp=$(echo $cmd | sed -e 's/\${timestamp}/'${GENESIS_TIMESTAMP}'/g')
tmp=$(echo $tmp | sed -e 's/\${genesisHash}/'${genesisHash}'/g')
tmp=$(echo $tmp | sed -e 's/\${GETH_HTTP_PORT}/'${GETH_HTTP_PORT}'/g')
cmd=$(echo $tmp | sed -e 's/\${BEACON_HTTP_PORT}/'${BEACON_HTTP_PORT}'/g')
cmd=$(echo $tmp | sed -e 's/\${deneb_fork_epoch}/'${deneb_fork_epoch}'/g')

echo "replaced command args: $cmd"

Expand Down
Loading