Compare commits
11 Commits
342ca5605b
...
e20ad560d0
Author | SHA1 | Date | |
---|---|---|---|
e20ad560d0 | |||
66435eb60c | |||
7f9a8ff664 | |||
15bc891299 | |||
2fdf11643b | |||
5e0172a1d6 | |||
20671b5456 | |||
709b048d5a | |||
849bb0a4f1 | |||
80228a5e04 | |||
a3060bf1c1 |
@ -1,4 +1,4 @@
|
|||||||
name: Test fixturenet-plugeth
|
name: Test Ethereum Plugeth Fixturenet Stack
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -26,7 +26,15 @@ jobs:
|
|||||||
- name: "Print Python version"
|
- name: "Print Python version"
|
||||||
run: python3 --version
|
run: python3 --version
|
||||||
- name: "Install stack orchestrator"
|
- name: "Install stack orchestrator"
|
||||||
run: ./scripts/install-so.sh
|
# FIXME: merge SO fixes and revert
|
||||||
|
# run: ./scripts/install-so.sh
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: cerc-io/stack-orchestrator
|
||||||
|
ref: roysc/fix-various
|
||||||
|
path: .tools/stack-orchestrator
|
||||||
|
- name: "Install stack orchestrator"
|
||||||
|
run: pip3 install .tools/stack-orchestrator
|
||||||
- name: "Run stack tests"
|
- name: "Run stack tests"
|
||||||
run: |
|
run: |
|
||||||
PATH=$PATH:~/bin
|
PATH=$PATH:~/bin
|
||||||
|
@ -27,6 +27,7 @@ services:
|
|||||||
CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS:-false}
|
CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS:-false}
|
||||||
env_file:
|
env_file:
|
||||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||||
|
- ../config/fixturenet-eth/statediff.env
|
||||||
image: cerc/fixturenet-plugeth-plugeth:local
|
image: cerc/fixturenet-plugeth-plugeth:local
|
||||||
volumes:
|
volumes:
|
||||||
- fixturenet_plugeth_geth_1_data:/root/ethdata
|
- fixturenet_plugeth_geth_1_data:/root/ethdata
|
||||||
|
29
stack-orchestrator/compose/docker-compose-ipld-eth-db.yml
Normal file
29
stack-orchestrator/compose/docker-compose-ipld-eth-db.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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:2.8.1-pg14
|
||||||
|
restart: always
|
||||||
|
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"
|
9
stack-orchestrator/config/fixturenet-eth/statediff.env
Normal file
9
stack-orchestrator/config/fixturenet-eth/statediff.env
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# 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"
|
||||||
|
CERC_STATEDIFF_DB_GOOSE_MIN_VER=${CERC_STATEDIFF_DB_GOOSE_MIN_VER:-18}
|
||||||
|
CERC_STATEDIFF_DB_LOG_STATEMENTS="${CERC_STATEDIFF_DB_LOG_STATEMENTS:-false}"
|
||||||
|
CERC_STATEDIFF_WORKERS=2
|
@ -11,7 +11,7 @@ RUN pip3 install --break-system-packages --upgrade "web3==v6.15.1"
|
|||||||
RUN pip3 install --break-system-packages --upgrade "typing-extensions"
|
RUN pip3 install --break-system-packages --upgrade "typing-extensions"
|
||||||
|
|
||||||
# Install tool to generate initial block
|
# Install tool to generate initial block
|
||||||
RUN go install github.com/cerc-io/eth-dump-genblock@b29516740fc01cf1d1d623acbfd0e9a2b6440a96
|
RUN go install github.com/cerc-io/eth-dump-genblock@v0.2.0
|
||||||
|
|
||||||
# Build genesis config
|
# Build genesis config
|
||||||
COPY genesis /opt/genesis
|
COPY genesis /opt/genesis
|
||||||
|
@ -50,6 +50,58 @@ else
|
|||||||
|
|
||||||
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
|
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
|
||||||
|
|
||||||
|
if [ "$CERC_RUN_STATEDIFF" == "detect" ] && [ -n "$CERC_STATEDIFF_DB_HOST" ]; then
|
||||||
|
dig_result=$(dig $CERC_STATEDIFF_DB_HOST +short)
|
||||||
|
dig_status_code=$?
|
||||||
|
if [[ $dig_status_code = 0 && -n $dig_result ]]; then
|
||||||
|
echo "Statediff DB at $CERC_STATEDIFF_DB_HOST"
|
||||||
|
CERC_RUN_STATEDIFF="true"
|
||||||
|
else
|
||||||
|
echo "No statediff DB available."
|
||||||
|
CERC_RUN_STATEDIFF="false"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
STATEDIFF_OPTS=""
|
||||||
|
if [ "$CERC_RUN_STATEDIFF" == "true" ]; then
|
||||||
|
ready=0
|
||||||
|
echo "Waiting for statediff DB..."
|
||||||
|
while [ $ready -eq 0 ]; do
|
||||||
|
sleep 1
|
||||||
|
export PGPASSWORD="$CERC_STATEDIFF_DB_PASSWORD"
|
||||||
|
result=$(psql -h "$CERC_STATEDIFF_DB_HOST" \
|
||||||
|
-p "$CERC_STATEDIFF_DB_PORT" \
|
||||||
|
-U "$CERC_STATEDIFF_DB_USER" \
|
||||||
|
-d "$CERC_STATEDIFF_DB_NAME" \
|
||||||
|
-t -c 'select max(version_id) from goose_db_version;' 2>/dev/null | awk '{ print $1 }')
|
||||||
|
if [ -n "$result" ]; then
|
||||||
|
echo "DB ready."
|
||||||
|
if [ $result -ge $CERC_STATEDIFF_DB_GOOSE_MIN_VER ]; then
|
||||||
|
ready=1
|
||||||
|
else
|
||||||
|
echo "DB not at required version (want $CERC_STATEDIFF_DB_GOOSE_MIN_VER, have $result)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
STATEDIFF_OPTS="--statediff \
|
||||||
|
--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.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"
|
||||||
|
|
||||||
|
if [ -d "${CERC_PLUGINS_DIR}" ]; then
|
||||||
|
# With plugeth, we separate the statediff options by prefixing with ' -- '
|
||||||
|
STATEDIFF_OPTS="--pluginsdir "${CERC_PLUGINS_DIR}" -- ${STATEDIFF_OPTS}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
OTHER_OPTS=""
|
OTHER_OPTS=""
|
||||||
if [ "$CERC_ALLOW_UNPROTECTED_TXS" == "true" ]; then
|
if [ "$CERC_ALLOW_UNPROTECTED_TXS" == "true" ]; then
|
||||||
# Allow for unprotected (non EIP155) txs to be submitted via RPC
|
# Allow for unprotected (non EIP155) txs to be submitted via RPC
|
||||||
@ -87,6 +139,7 @@ else
|
|||||||
--log.vmodule="${CERC_GETH_VMODULE}" \
|
--log.vmodule="${CERC_GETH_VMODULE}" \
|
||||||
--miner.etherbase="${ETHERBASE}" \
|
--miner.etherbase="${ETHERBASE}" \
|
||||||
${OTHER_OPTS} \
|
${OTHER_OPTS} \
|
||||||
|
${STATEDIFF_OPTS} \
|
||||||
&
|
&
|
||||||
|
|
||||||
geth_pid=$!
|
geth_pid=$!
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
FROM cerc/fixturenet-eth-genesis-postmerge:local as fnetgen
|
||||||
|
|
||||||
|
# Using the same golang image as used to build geth: https://github.com/cerc-io/go-ethereum/blob/HEAD/Dockerfile
|
||||||
|
FROM golang:1.21-alpine as delve
|
||||||
|
RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
||||||
|
|
||||||
|
FROM cerc/plugeth-statediff:local as statediff
|
||||||
|
# FIXME: fork of plugeth, use stock after upstreaming patches
|
||||||
|
FROM cerc/plugeth:local as geth
|
||||||
|
|
||||||
|
FROM alpine:3.18
|
||||||
|
|
||||||
|
RUN apk add --no-cache bash wget python3 bind-tools postgresql-client
|
||||||
|
|
||||||
|
COPY run-el.sh /opt/testnet/run.sh
|
||||||
|
|
||||||
|
COPY --from=delve /go/bin/dlv /usr/local/bin/
|
||||||
|
COPY --from=geth /usr/local/bin/geth /usr/local/bin/
|
||||||
|
COPY --from=fnetgen /opt/genesis /opt/testnet
|
||||||
|
COPY --from=statediff /usr/local/lib/statediff.so /usr/local/lib/plugeth/
|
||||||
|
|
||||||
|
# Initialize the geth db with our config
|
||||||
|
RUN geth --datadir ~/ethdata init /opt/testnet/build/el/geth.json && rm -f ~/ethdata/geth/nodekey
|
||||||
|
|
||||||
|
ENTRYPOINT ["/opt/testnet/run.sh"]
|
11
stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh
Executable file
11
stack-orchestrator/container-build/cerc-fixturenet-plugeth-plugeth/build.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build cerc/fixturenet-plugeth-plugeth
|
||||||
|
set -x
|
||||||
|
|
||||||
|
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||||
|
|
||||||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
|
cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/run-el.sh ${SCRIPT_DIR}/
|
||||||
|
|
||||||
|
docker build -t cerc/fixturenet-plugeth-plugeth:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
4
stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh
Executable file
4
stack-orchestrator/container-build/cerc-ipld-eth-db/build.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build cerc/ipld-eth-db
|
||||||
|
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||||
|
docker build -t cerc/ipld-eth-db:local ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-db
|
8
stack-orchestrator/container-build/cerc-plugeth-statediff/build.sh
Executable file
8
stack-orchestrator/container-build/cerc-plugeth-statediff/build.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build cerc/plugeth-statediff
|
||||||
|
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||||
|
# Pass Go auth token if present
|
||||||
|
if [[ -n "${CERC_GO_AUTH_TOKEN}" ]]; then
|
||||||
|
build_command_args="${build_command_args} --build-arg GIT_VDBTO_TOKEN=${CERC_GO_AUTH_TOKEN}"
|
||||||
|
fi
|
||||||
|
docker build -t cerc/plugeth-statediff:local ${build_command_args} ${CERC_REPO_BASE_DIR}/plugeth-statediff
|
8
stack-orchestrator/container-build/cerc-plugeth/build.sh
Executable file
8
stack-orchestrator/container-build/cerc-plugeth/build.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build cerc/plugeth
|
||||||
|
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||||
|
# Pass Go auth token if present
|
||||||
|
if [[ -n "${CERC_GO_AUTH_TOKEN}" ]]; then
|
||||||
|
build_command_args="${build_command_args} --build-arg GIT_VDBTO_TOKEN=${CERC_GO_AUTH_TOKEN}"
|
||||||
|
fi
|
||||||
|
docker build -t cerc/plugeth:local ${build_command_args} ${CERC_REPO_BASE_DIR}/plugeth
|
@ -2,9 +2,10 @@ version: "1.1"
|
|||||||
name: fixturenet-plugeth
|
name: fixturenet-plugeth
|
||||||
description: "Plugeth Ethereum Indexing Fixturenet"
|
description: "Plugeth Ethereum Indexing Fixturenet"
|
||||||
repos:
|
repos:
|
||||||
- git.vdb.to/cerc-io/plugeth@statediff-patches
|
- git.vdb.to/cerc-io/plugeth@statediff
|
||||||
- git.vdb.to/cerc-io/plugeth-statediff
|
- git.vdb.to/cerc-io/plugeth-statediff
|
||||||
- git.vdb.to/cerc-io/lighthouse
|
- git.vdb.to/cerc-io/lighthouse
|
||||||
|
- git.vdb.to/cerc-io/ipld-eth-db
|
||||||
containers:
|
containers:
|
||||||
- cerc/plugeth-statediff
|
- cerc/plugeth-statediff
|
||||||
- cerc/plugeth
|
- cerc/plugeth
|
||||||
|
@ -56,7 +56,7 @@ test_deployment_spec=$CERC_REPO_BASE_DIR/test-deployment-spec.yml
|
|||||||
$SO_COMMAND --stack ${stack_name} deploy init --output $test_deployment_spec
|
$SO_COMMAND --stack ${stack_name} deploy init --output $test_deployment_spec
|
||||||
# Check the file now exists
|
# Check the file now exists
|
||||||
if [ ! -f "$test_deployment_spec" ]; then
|
if [ ! -f "$test_deployment_spec" ]; then
|
||||||
test_fail_exit "deploy init test: spec fille not present"
|
test_fail_exit "deploy init test: spec file not present"
|
||||||
fi
|
fi
|
||||||
echo "deploy init test: passed"
|
echo "deploy init test: passed"
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ echo "deploy create test: passed"
|
|||||||
|
|
||||||
$SO_COMMAND deployment --dir $test_deployment_dir start
|
$SO_COMMAND deployment --dir $test_deployment_dir start
|
||||||
|
|
||||||
geth_endpoint=localhost:$($SO_COMMAND deployment --dir $test_deployment_dir ports fixturenet-eth-geth-1 8545 | cut -d: -f2)
|
geth_endpoint=localhost:$($SO_COMMAND deployment --dir $test_deployment_dir port fixturenet-eth-geth-1 8545 | cut -d: -f2)
|
||||||
|
|
||||||
timeout=900 # 15 minutes
|
timeout=900 # 15 minutes
|
||||||
log_info "Getting initial block number. Timeout set to $timeout seconds"
|
log_info "Getting initial block number. Timeout set to $timeout seconds"
|
||||||
@ -109,18 +109,24 @@ log_info "Results of block height queries:"
|
|||||||
echo "Initial block height: $initial_block_number"
|
echo "Initial block height: $initial_block_number"
|
||||||
echo "Subsequent block height: $subsequent_block_number"
|
echo "Subsequent block height: $subsequent_block_number"
|
||||||
|
|
||||||
# Block height difference should be between 1 and some small number
|
dump_logs () {
|
||||||
if [[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]]; then
|
echo "Test failed. Logs from stack:"
|
||||||
echo "Test passed"
|
|
||||||
test_result=0
|
|
||||||
else
|
|
||||||
echo "Test failed: block numbers were ${initial_block_number} and ${subsequent_block_number}"
|
|
||||||
echo "Logs from stack:"
|
|
||||||
$SO_COMMAND deployment --dir $test_deployment_dir logs
|
$SO_COMMAND deployment --dir $test_deployment_dir logs
|
||||||
test_result=1
|
}
|
||||||
fi
|
trap dump_logs ERR
|
||||||
$SO_COMMAND deployment --dir $test_deployment_dir stop --delete-volumes
|
|
||||||
log_info "Removing cloned repositories"
|
# Block height difference should be between 1 and some small number
|
||||||
rm -rf $CERC_REPO_BASE_DIR
|
[[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]]
|
||||||
log_info "Test finished"
|
|
||||||
exit $test_result
|
# Check that the block hash is present in the ipld-eth-db
|
||||||
|
echo "Querying ipld-eth-db for block number $subsequent_block_number"
|
||||||
|
block_hash_query="SELECT block_hash from eth.header_cids where block_number = $subsequent_block_number"
|
||||||
|
block_hash=$(
|
||||||
|
$SO_COMMAND deployment --dir $test_deployment_dir exec ipld-eth-db \
|
||||||
|
"psql -qtA -U vdbm -c '$block_hash_query' cerc_testing"
|
||||||
|
)
|
||||||
|
echo "Block hash in ipld-eth-db: $block_hash"
|
||||||
|
|
||||||
|
[[ -n $block_hash ]]
|
||||||
|
|
||||||
|
echo "Test passed."
|
||||||
|
Loading…
Reference in New Issue
Block a user