adbb62f7f3
* some blob reprocessing work * remove ForceBlockLookup * reorder enum match arms in sync manager * a lot more reprocessing work * impl logic for triggerng blob lookups along with block lookups * deal with rpc blobs in groups per block in the da checker. don't cache missing blob ids in the da checker. * make single block lookup generic * more work * add delayed processing logic and combine some requests * start fixing some compile errors * fix compilation in main block lookup mod * much work * get things compiling * parent blob lookups * fix compile * revert red/stevie changes * fix up sync manager delay message logic * add peer usefulness enum * should remove lookup refactor * consolidate retry error handling * improve peer scoring during certain failures in parent lookups * improve retry code * drop parent lookup if either req has a peer disconnect during download * refactor single block processed method * processing peer refactor * smol bugfix * fix some todos * fix lints * fix lints * fix compile in lookup tests * fix lints * fix lints * fix existing block lookup tests * renamings * fix after merge * cargo fmt * compilation fix in beacon chain tests * fix * refactor lookup tests to work with multiple forks and response types * make tests into macros * wrap availability check error * fix compile after merge * add random blobs * start fixing up lookup verify error handling * some bug fixes and the start of deneb only tests * make tests work for all forks * track information about peer source * error refactoring * improve peer scoring * fix test compilation * make sure blobs are sent for processing after stream termination, delete copied tests * add some tests and fix a bug * smol bugfixes and moar tests * add tests and fix some things * compile after merge * lots of refactoring * retry on invalid block/blob * merge unknown parent messages before current slot lookup * get tests compiling * penalize blob peer on invalid blobs * Check disk on in-memory cache miss * Update beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs * Update beacon_node/network/src/sync/network_context.rs Co-authored-by: Divma <26765164+divagant-martian@users.noreply.github.com> * fix bug in matching blocks and blobs in range sync * pr feedback * fix conflicts * upgrade logs from warn to crit when we receive incorrect response in range * synced_and_connected_within_tolerance -> should_search_for_block * remove todo * add data gas used and update excess data gas to u64 * Fix Broken Overflow Tests * payload verification with commitments * fix merge conflicts * restore payload file * Restore payload file * remove todo * add max blob commitments per block * c-kzg lib update * Fix ef tests * Abstract over minimal/mainnet spec in kzg crate * Start integrating new KZG * checkpoint sync without alignment * checkpoint sync without alignment * add import * add import * query for checkpoint state by slot rather than state root (teku doesn't serve by state root) * query for checkpoint state by slot rather than state root (teku doesn't serve by state root) * loosen check * get state first and query by most recent block root * Revert "loosen check" This reverts commit 069d13dd63aa794a3505db9f17bd1a6b73f0be81. * get state first and query by most recent block root * merge max blobs change * simplify delay logic * rename unknown parent sync message variants * rename parameter, block_slot -> slot * add some docs to the lookup module * use interval instead of sleep * drop request if blocks and blobs requests both return `None` for `Id` * clean up `find_single_lookup` logic * add lookup source enum * clean up `find_single_lookup` logic * add docs to find_single_lookup_request * move LookupSource our of param where unnecessary * remove unnecessary todo * query for block by `state.latest_block_header.slot` * fix lint * fix merge transition ef tests * fix test * fix test * fix observed blob sidecars test * Add some metrics (#33) * fix protocol limits for blobs by root * Update Engine API for 1:1 Structure Method * make beacon chain tests to fix devnet 6 changes * get ckzg working and fix some tests * fix remaining tests * fix lints * Fix KZG linking issues * remove unused dep * lockfile * test fixes * remove dbgs * remove unwrap * cleanup tx generator * small fixes * fixing fixes * more self reivew * more self review * refactor genesis header initialization * refactor mock el instantiations * fix compile * fix network test, make sure they run for each fork * pr feedback * fix last test (hopefully) --------- Co-authored-by: Pawan Dhananjay <pawandhananjay@gmail.com> Co-authored-by: Mark Mackey <mark@sigmaprime.io> Co-authored-by: Divma <26765164+divagant-martian@users.noreply.github.com> Co-authored-by: Michael Sproul <michael@sigmaprime.io>
158 lines
4.5 KiB
Bash
Executable File
158 lines
4.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start all processes necessary to create a local testnet
|
|
|
|
set -Eeuo pipefail
|
|
|
|
source ./vars.env
|
|
|
|
# Set a higher ulimit in case we want to import 1000s of validators.
|
|
ulimit -n 65536
|
|
|
|
# VC_COUNT is defaulted in vars.env
|
|
DEBUG_LEVEL=${DEBUG_LEVEL:-info}
|
|
BUILDER_PROPOSALS=
|
|
|
|
# Get options
|
|
while getopts "v:d:ph" flag; do
|
|
case "${flag}" in
|
|
v) VC_COUNT=${OPTARG};;
|
|
d) DEBUG_LEVEL=${OPTARG};;
|
|
p) BUILDER_PROPOSALS="-p";;
|
|
h)
|
|
validators=$(( $VALIDATOR_COUNT / $BN_COUNT ))
|
|
echo "Start local testnet, defaults: 1 eth1 node, $BN_COUNT beacon nodes,"
|
|
echo "and $VC_COUNT validator clients with each vc having $validators validators."
|
|
echo
|
|
echo "usage: $0 <Options>"
|
|
echo
|
|
echo "Options:"
|
|
echo " -v: VC_COUNT default: $VC_COUNT"
|
|
echo " -d: DEBUG_LEVEL default: info"
|
|
echo " -p: enable builder proposals"
|
|
echo " -h: this help"
|
|
exit
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if (( $VC_COUNT > $BN_COUNT )); then
|
|
echo "Error $VC_COUNT is too large, must be <= BN_COUNT=$BN_COUNT"
|
|
exit
|
|
fi
|
|
|
|
genesis_file=${@:$OPTIND+0:1}
|
|
|
|
# Init some constants
|
|
PID_FILE=$TESTNET_DIR/PIDS.pid
|
|
LOG_DIR=$TESTNET_DIR
|
|
|
|
# Stop local testnet and remove $PID_FILE
|
|
./stop_local_testnet.sh
|
|
|
|
# Clean $DATADIR and create empty log files so the
|
|
# user can "tail -f" right after starting this script
|
|
# even before its done.
|
|
./clean.sh
|
|
mkdir -p $LOG_DIR
|
|
for (( bn=1; bn<=$BN_COUNT; bn++ )); do
|
|
touch $LOG_DIR/beacon_node_$bn.log
|
|
done
|
|
for (( el=1; el<=$BN_COUNT; el++ )); do
|
|
touch $LOG_DIR/geth_$el.log
|
|
done
|
|
for (( vc=1; vc<=$VC_COUNT; vc++ )); do
|
|
touch $LOG_DIR/validator_node_$vc.log
|
|
done
|
|
|
|
# Sleep with a message
|
|
sleeping() {
|
|
echo sleeping $1
|
|
sleep $1
|
|
}
|
|
|
|
# Execute the command with logs saved to a file.
|
|
#
|
|
# First parameter is log file name
|
|
# Second parameter is executable name
|
|
# Remaining parameters are passed to executable
|
|
execute_command() {
|
|
LOG_NAME=$1
|
|
EX_NAME=$2
|
|
shift
|
|
shift
|
|
CMD="$EX_NAME $@ >> $LOG_DIR/$LOG_NAME 2>&1"
|
|
echo "executing: $CMD"
|
|
echo "$CMD" > "$LOG_DIR/$LOG_NAME"
|
|
eval "$CMD &"
|
|
}
|
|
|
|
# Execute the command with logs saved to a file
|
|
# and is PID is saved to $PID_FILE.
|
|
#
|
|
# First parameter is log file name
|
|
# Second parameter is executable name
|
|
# Remaining parameters are passed to executable
|
|
execute_command_add_PID() {
|
|
execute_command $@
|
|
echo "$!" >> $PID_FILE
|
|
}
|
|
|
|
|
|
# Setup data
|
|
echo "executing: ./setup.sh >> $LOG_DIR/setup.log"
|
|
./setup.sh >> $LOG_DIR/setup.log 2>&1
|
|
|
|
# Update future hardforks time in the EL genesis file based on the CL genesis time
|
|
GENESIS_TIME=$(lcli pretty-ssz state_merge $TESTNET_DIR/genesis.ssz | jq | grep -Po 'genesis_time": "\K.*\d')
|
|
echo $GENESIS_TIME
|
|
CAPELLA_TIME=$((GENESIS_TIME + (CAPELLA_FORK_EPOCH * 32 * SECONDS_PER_SLOT)))
|
|
echo $CAPELLA_TIME
|
|
sed -i 's/"shanghaiTime".*$/"shanghaiTime": '"$CAPELLA_TIME"',/g' $genesis_file
|
|
CANCUN_TIME=$((GENESIS_TIME + (DENEB_FORK_EPOCH * 32 * SECONDS_PER_SLOT)))
|
|
echo $CANCUN_TIME
|
|
sed -i 's/"shardingForkTime".*$/"shardingForkTime": '"$CANCUN_TIME"',/g' $genesis_file
|
|
cat $genesis_file
|
|
|
|
# Delay to let boot_enr.yaml to be created
|
|
execute_command_add_PID bootnode.log ./bootnode.sh
|
|
sleeping 3
|
|
|
|
execute_command_add_PID el_bootnode.log ./el_bootnode.sh
|
|
sleeping 3
|
|
|
|
execute_command_add_PID el_bootnode.log ./el_bootnode.sh
|
|
sleeping 1
|
|
|
|
# Start beacon nodes
|
|
BN_udp_tcp_base=9000
|
|
BN_http_port_base=8000
|
|
|
|
EL_base_network=7000
|
|
EL_base_http=6000
|
|
EL_base_auth_http=5000
|
|
|
|
(( $VC_COUNT < $BN_COUNT )) && SAS=-s || SAS=
|
|
|
|
for (( el=1; el<=$BN_COUNT; el++ )); do
|
|
execute_command_add_PID geth_$el.log ./geth.sh $DATADIR/geth_datadir$el $((EL_base_network + $el)) $((EL_base_http + $el)) $((EL_base_auth_http + $el)) $genesis_file
|
|
done
|
|
|
|
sleeping 20
|
|
|
|
# Reset the `genesis.json` config file fork times.
|
|
sed -i 's/"shanghaiTime".*$/"shanghaiTime": 0,/g' $genesis_file
|
|
sed -i 's/"shardingForkTime".*$/"shardingForkTime": 0,/g' $genesis_file
|
|
|
|
for (( bn=1; bn<=$BN_COUNT; bn++ )); do
|
|
secret=$DATADIR/geth_datadir$bn/geth/jwtsecret
|
|
echo $secret
|
|
execute_command_add_PID beacon_node_$bn.log ./beacon_node.sh $SAS -d $DEBUG_LEVEL $DATADIR/node_$bn $((BN_udp_tcp_base + $bn)) $((BN_http_port_base + $bn)) http://localhost:$((EL_base_auth_http + $bn)) $secret
|
|
done
|
|
|
|
# Start requested number of validator clients
|
|
for (( vc=1; vc<=$VC_COUNT; vc++ )); do
|
|
execute_command_add_PID validator_node_$vc.log ./validator_client.sh $BUILDER_PROPOSALS -d $DEBUG_LEVEL $DATADIR/node_$vc http://localhost:$((BN_http_port_base + $vc))
|
|
done
|
|
|
|
echo "Started!"
|