Compare commits
11 Commits
342ca5605b
...
e20ad560d0
Author | SHA1 | Date | |
---|---|---|---|
e20ad560d0 | |||
66435eb60c | |||
7f9a8ff664 | |||
15bc891299 | |||
2fdf11643b | |||
5e0172a1d6 | |||
20671b5456 | |||
709b048d5a | |||
849bb0a4f1 | |||
80228a5e04 | |||
a3060bf1c1 |
@ -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
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
version: "3.2"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
migrations:
|
migrations:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
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=$!
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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."
|
||||||
|
Loading…
Reference in New Issue
Block a user