Compare commits

..

11 Commits

Author SHA1 Message Date
e20ad560d0 check ipld-eth-db in test
Some checks failed
Test Ethereum Plugeth Fixturenet Stack / Test fixturenet-plugeth stack (push) Has been cancelled
Test Ethereum Fixturenet Stack / Run Ethereum Fixturenet stack test (push) Has been cancelled
2024-06-27 15:26:37 +08:00
66435eb60c bump alpine 2024-06-27 15:26:37 +08:00
7f9a8ff664 update eth-dump-genblock 2024-06-27 15:26:37 +08:00
15bc891299 add statediff config 2024-06-27 15:26:37 +08:00
2fdf11643b correct plugeth ref 2024-06-27 15:26:37 +08:00
5e0172a1d6 missing repo ref 2024-06-27 15:26:37 +08:00
20671b5456 consistent test name 2024-06-27 15:26:37 +08:00
709b048d5a add missing files 2024-06-27 15:26:37 +08:00
849bb0a4f1 fix command 2024-06-27 15:26:37 +08:00
80228a5e04 [dev] use patched SO 2024-06-27 15:26:37 +08:00
a3060bf1c1 add ipld-eth-db 2024-06-27 15:26:37 +08:00
8 changed files with 87 additions and 22 deletions

View File

@ -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

View File

@ -1,5 +1,3 @@
version: "3.2"
services: services:
migrations: migrations:
restart: on-failure restart: on-failure

View 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

View File

@ -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

View File

@ -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=$!

View File

@ -8,7 +8,7 @@ FROM cerc/plugeth-statediff:local as statediff
# FIXME: fork of plugeth, use stock after upstreaming patches # FIXME: fork of plugeth, use stock after upstreaming patches
FROM cerc/plugeth:local as geth FROM cerc/plugeth:local as geth
FROM alpine:3.17 FROM alpine:3.18
RUN apk add --no-cache bash wget python3 bind-tools postgresql-client RUN apk add --no-cache bash wget python3 bind-tools postgresql-client

View File

@ -6,8 +6,6 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ ! -e "${SCRIPT_DIR}/run-el.sh" ]; then cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/run-el.sh ${SCRIPT_DIR}/
cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/run-el.sh ${SCRIPT_DIR}/
fi
docker build -t cerc/fixturenet-plugeth-plugeth:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR docker build -t cerc/fixturenet-plugeth-plugeth:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR

View File

@ -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"
@ -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."