Add support for deferring validator admission until after chain is started #8

Merged
dboreham merged 1 commits from dboreham/stage-1-testing into main 2024-08-08 14:19:20 +00:00

View File

@ -13,6 +13,10 @@ else
echo "Usage: $0 <machine-name-prefix>" echo "Usage: $0 <machine-name-prefix>"
exit 1 exit 1
fi fi
if [[ -n "$2" && "$2" == "deferred-validator-admission" ]]; then
deferred_validator_admission=1
echo "Deferred validator admission mode enabled, only node 1 will be a validator initially"
fi
gentx_dir=${node_network_dir}/config/gentx gentx_dir=${node_network_dir}/config/gentx
genesis_json_file=${node_network_dir}/config/genesis.json genesis_json_file=${node_network_dir}/config/genesis.json
@ -46,7 +50,7 @@ do
scp ${ssh_user}@${node_host_name}:~/${genesis_json_file} ${local_gentx_dir}/${node_name}-genesis.json scp ${ssh_user}@${node_host_name}:~/${genesis_json_file} ${local_gentx_dir}/${node_name}-genesis.json
done done
# Extract the peer node validator addresses from their genesis.json files # Extract the peer node account addresses from their genesis.json files
gentx_addresses="" gentx_addresses=""
for (( i=2 ; i<=$node_count ; i++ )); for (( i=2 ; i<=$node_count ; i++ ));
do do
@ -57,19 +61,27 @@ do
delimeter="," delimeter=","
done done
echo "Copying gentx files to node 1"
node_1_host_name=${machine_name_prefix}-1.${machine_domain} node_1_host_name=${machine_name_prefix}-1.${machine_domain}
ssh ${ssh_user}@${node_1_host_name} rm -rf ${local_gentx_dir} ssh ${ssh_user}@${node_1_host_name} rm -rf ${local_gentx_dir}
ssh ${ssh_user}@${node_1_host_name} mkdir ${local_gentx_dir} ssh ${ssh_user}@${node_1_host_name} mkdir ${local_gentx_dir}
scp ${local_gentx_dir}/gentx-* ${ssh_user}@${node_1_host_name}:~/${local_gentx_dir} if [[ ! -n $deferred_validator_admission ]]; then
echo "Copying gentx files to node 1"
gentx_file_list=$(ssh ${ssh_user}@${node_1_host_name} ls -m ${local_gentx_dir}/gentx-*) scp ${local_gentx_dir}/gentx-* ${ssh_user}@${node_1_host_name}:~/${local_gentx_dir}
echo "Node 1 now has: ${gentx_file_list}" gentx_file_list=$(ssh ${ssh_user}@${node_1_host_name} ls -m ${local_gentx_dir}/gentx-\*)
echo "Node 1 now has: ${gentx_file_list}"
else
gentx_file_list=
fi
gentx_files=$(echo ${gentx_file_list} | tr -d ' ' | tr -d '\n') gentx_files=$(echo ${gentx_file_list} | tr -d ' ' | tr -d '\n')
if [[ -n $gentx_files ]]; then
gentx_files_arg="--gentx-files ${gentx_files}"
else
gentx_files_arg=""
fi
echo "Generate genesis on node 1" echo "Generate genesis on node 1"
ssh ${ssh_user}@${node_1_host_name} ${so_command} --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --create-network --gentx-files ${gentx_files} --gentx-addresses ${gentx_addresses} ssh ${ssh_user}@${node_1_host_name} ${so_command} --stack mainnet-laconic deploy setup --network-dir ${node_network_dir} --create-network ${gentx_files_arg} --gentx-addresses ${gentx_addresses}
# Change file ownership in the network dir to work around root-only container issue # Change file ownership in the network dir to work around root-only container issue
change_dir_ownership ${node_1_host_name} ${node_network_dir} change_dir_ownership ${node_1_host_name} ${node_network_dir}