Skip to content

Commit d8ae9b2

Browse files
committed
Add script that simulates a fork revert
1 parent c79f277 commit d8ae9b2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

scripts/local_testnet/fork_revert.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
source ./start_local_testnet.sh genesis.json
4+
5+
./download_lighthouse.sh v4.6.0 -b lh-stale
6+
7+
n=2
8+
node_id=$(($BN_COUNT+1))
9+
10+
stale_testnet_dir=$DATADIR/stale_testnet
11+
12+
cp -r $TESTNET_DIR $stale_testnet_dir
13+
14+
sed -i '/DENEB_FORK_VERSION/d' $stale_testnet_dir/config.yaml
15+
sed -i '/DENEB_FORK_EPOCH/d' $stale_testnet_dir/config.yaml
16+
sed -i '/MAX_REQUEST_BLOCKS_DENEB/d' $stale_testnet_dir/config.yaml
17+
18+
for ((i = 0; i < n; i++)); do
19+
current_id=$(($node_id+i))
20+
execute_command_add_PID geth_$current_id.log ./geth.sh $DATADIR/geth_datadir$current_id $((EL_base_network + $current_id)) $((EL_base_http + current_id)) $((EL_base_auth_http + $current_id)) $genesis_file
21+
done
22+
23+
sleeping 20
24+
25+
for ((i = 0; i < n; i++)); do
26+
current_id=$(($node_id+i))
27+
secret=$DATADIR/geth_datadir$current_id/geth/jwtsecret
28+
echo $secret
29+
execute_command_add_PID beacon_node_$current_id.log ./beacon_node.sh $SAS -d $DEBUG_LEVEL $DATADIR/node_$current_id $((BN_udp_tcp_base + $current_id)) $((BN_udp_tcp_base + $current_id + 100)) $((BN_http_port_base + $current_id)) http://localhost:$((EL_base_auth_http + $current_id)) $secret $stale_testnet_dir -b lh-stale
30+
31+
execute_command_add_PID validator_node_$current_id.log ./validator_client.sh $BUILDER_PROPOSALS -d $DEBUG_LEVEL $DATADIR/node_$current_id http://localhost:$((BN_http_port_base + $current_id))
32+
33+
tail ~/.lighthouse/local-testnet/testnet/PIDS.pid --lines 2 >> $stale_testnet_dir/stale_pids.pid
34+
done
35+
36+
sleeping $(($DENEB_FORK_EPOCH*32*$SECONDS_PER_SLOT))
37+
38+
./kill_processes.sh $stale_testnet_dir/stale_pids.pid
39+
40+
sleeping 5
41+
42+
for ((i = 0; i < n; i++)); do
43+
current_id=$(($node_id+i))
44+
secret=$DATADIR/geth_datadir$current_id/geth/jwtsecret
45+
echo $secret
46+
execute_command_add_PID beacon_node_$current_id.log ./beacon_node.sh $SAS -d $DEBUG_LEVEL $DATADIR/node_$current_id $((BN_udp_tcp_base + $current_id)) $((BN_udp_tcp_base + $current_id + 100)) $((BN_http_port_base + $current_id)) http://localhost:$((EL_base_auth_http + $current_id)) $secret $TESTNET_DIR
47+
48+
execute_command_add_PID validator_node_$current_id.log ./validator_client.sh $BUILDER_PROPOSALS -d $DEBUG_LEVEL $DATADIR/node_$current_id http://localhost:$((BN_http_port_base + $current_id))
49+
done

0 commit comments

Comments
 (0)