From 946e937549bc0bc749f2c1a9a6e931ecf113e86c Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Fri, 15 Nov 2019 15:18:45 -0500 Subject: [PATCH] Create development vs softlaunch environment hooks into net scripts (#6974) --- genesis/src/main.rs | 16 ++++++++++++---- multinode-demo/setup.sh | 2 +- net/net.sh | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/genesis/src/main.rs b/genesis/src/main.rs index fac46f0196..6fe15e989f 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -111,6 +111,7 @@ fn main() -> Result<(), Box> { &timing::duration_as_ms(&PohConfig::default().target_tick_duration).to_string(); let default_ticks_per_slot = &clock::DEFAULT_TICKS_PER_SLOT.to_string(); let default_slots_per_epoch = &EpochSchedule::default().slots_per_epoch.to_string(); + let default_operating_mode = "softlaunch"; let matches = App::new(crate_name!()) .about(crate_description!()) @@ -296,9 +297,16 @@ fn main() -> Result<(), Box> { .help("The location of pubkey for primordial accounts and balance"), ) .arg( - Arg::with_name("development") - .long("dev") - .help("Configure the cluster for development mode where all features are available at epoch 0"), + Arg::with_name("operating_mode") + .long("operating-mode") + .possible_value("development") + .possible_value("softlaunch") + .takes_value(true) + .default_value(default_operating_mode) + .help( + "Configure the cluster for \"development\" mode where all features are available at epoch 0, \ + or \"softlaunch\" mode where some features are disabled at epoch 0" + ), ) .get_matches(); @@ -381,7 +389,7 @@ fn main() -> Result<(), Box> { } } - let operating_mode = if matches.is_present("development") { + let operating_mode = if matches.value_of("operating_mode").unwrap() == "development" { OperatingMode::Development } else { OperatingMode::SoftLaunch diff --git a/multinode-demo/setup.sh b/multinode-demo/setup.sh index a9be30e39f..3b25375a44 100755 --- a/multinode-demo/setup.sh +++ b/multinode-demo/setup.sh @@ -34,7 +34,7 @@ default_arg --bootstrap-storage-pubkey "$SOLANA_CONFIG_DIR"/bootstrap-leader/sto default_arg --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader default_arg --mint "$SOLANA_CONFIG_DIR"/mint-keypair.json default_arg --hashes-per-tick auto -default_arg --dev +default_arg --operating-mode development $solana_genesis "${args[@]}" ( diff --git a/net/net.sh b/net/net.sh index 9f79ef93d2..b31dc24e91 100755 --- a/net/net.sh +++ b/net/net.sh @@ -88,6 +88,10 @@ Operate a configured testnet --use-move - Build the move-loader-program and add it to the cluster + --operating-mode development|softlaunch + - Specify whether or not to launch the cluster in "development" mode with all features enabled at epoch 0, + or "softlaunch" mode with some features disabled at epoch 0 (default: development) + sanity/start-specific options: -F - Discard validator nodes that didn't bootup successfully -o noInstallCheck - Skip solana-install sanity @@ -171,6 +175,17 @@ while [[ -n $1 ]]; do elif [[ $1 = --lamports ]]; then genesisOptions="$genesisOptions $1 $2" shift 2 + elif [[ $1 = --operating-mode ]]; then + case "$2" in + development|softlaunch) + ;; + *) + echo "Unexpected operating mode: \"$2\"" + exit 1 + ;; + esac + genesisOptions="$genesisOptions $1 $2" + shift 2 elif [[ $1 = --no-snapshot-fetch ]]; then maybeNoSnapshot="$1" shift 1 @@ -845,7 +860,6 @@ deploy() { echo "Network start logs in $netLogDir" } - stopNode() { local ipAddress=$1 local block=$2 @@ -917,7 +931,6 @@ stop() { echo "Stopping nodes took $SECONDS seconds" } - checkPremptibleInstances() { # The validatorIpList nodes may be preemptible instances that can disappear at # any time. Try to detect when a validator has been preempted to help the user