From 82b33c56fbba76d1e9dcda3e4c2a00cd767fcb8b Mon Sep 17 00:00:00 2001 From: David Boreham Date: Thu, 8 Aug 2024 08:18:22 -0600 Subject: [PATCH] Add support for deferring validator admission until after chain is started --- scripts/03-merge-genesis-txns.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/03-merge-genesis-txns.sh b/scripts/03-merge-genesis-txns.sh index 8e73ca1..97b5ac9 100755 --- a/scripts/03-merge-genesis-txns.sh +++ b/scripts/03-merge-genesis-txns.sh @@ -13,6 +13,10 @@ else echo "Usage: $0 " exit 1 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 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 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="" for (( i=2 ; i<=$node_count ; i++ )); do @@ -57,19 +61,27 @@ do delimeter="," done -echo "Copying gentx files to node 1" 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} mkdir ${local_gentx_dir} -scp ${local_gentx_dir}/gentx-* ${ssh_user}@${node_1_host_name}:~/${local_gentx_dir} - -gentx_file_list=$(ssh ${ssh_user}@${node_1_host_name} ls -m ${local_gentx_dir}/gentx-*) -echo "Node 1 now has: ${gentx_file_list}" +if [[ ! -n $deferred_validator_admission ]]; then + echo "Copying gentx files to node 1" + scp ${local_gentx_dir}/gentx-* ${ssh_user}@${node_1_host_name}:~/${local_gentx_dir} + 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') +if [[ -n $gentx_files ]]; then + gentx_files_arg="--gentx-files ${gentx_files}" +else + gentx_files_arg="" +fi 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_dir_ownership ${node_1_host_name} ${node_network_dir}