From 777bc0643267fae8e40813b5563999ff58c332f1 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 14 Nov 2019 17:14:10 -0500 Subject: [PATCH 1/3] Implement restricted environment in net scripts --- multinode-demo/setup.sh | 1 - net/net.sh | 7 +++++++ net/remote/remote-node.sh | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/multinode-demo/setup.sh b/multinode-demo/setup.sh index a9be30e39fda16..a90834db88e23b 100755 --- a/multinode-demo/setup.sh +++ b/multinode-demo/setup.sh @@ -34,7 +34,6 @@ 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 $solana_genesis "${args[@]}" ( diff --git a/net/net.sh b/net/net.sh index 80f9b38ddeecbf..158afdbd03b9a3 100755 --- a/net/net.sh +++ b/net/net.sh @@ -88,6 +88,8 @@ Operate a configured testnet --use-move - Build the move-loader-program and add it to the cluster + --restricted-environment - Configure genesis block and cluster only to enable certain features for production launch + sanity/start-specific options: -F - Discard validator nodes that didn't bootup successfully -o noInstallCheck - Skip solana-install sanity @@ -147,6 +149,7 @@ gpuMode=auto maybeUseMove="" netemPartition="" netemConfig="" +maybeRestrictedEnvironment="" command=$1 [[ -n $command ]] || usage @@ -227,6 +230,9 @@ while [[ -n $1 ]]; do ;; esac shift 2 + elif [[ $1 = --restricted-environment ]]; then + maybeRestrictedEnvironment="$1" + shift 1 else usage "Unknown long option: $1" fi @@ -489,6 +495,7 @@ startBootstrapLeader() { \"$maybeNoSnapshot $maybeSkipLedgerVerify $maybeLimitLedgerSize\" \ \"$gpuMode\" \ \"$GEOLOCATION_API_KEY\" \ + \"$maybeRestrictedEnvironment\" \ " ) >> "$logFile" 2>&1 || { diff --git a/net/remote/remote-node.sh b/net/remote/remote-node.sh index 7a05dc918e78c0..6b402d8acb3aa4 100755 --- a/net/remote/remote-node.sh +++ b/net/remote/remote-node.sh @@ -26,6 +26,8 @@ genesisOptions="${17}" extraNodeArgs="${18}" gpuMode="${19:-auto}" GEOLOCATION_API_KEY="${20}" +maybeRestrictedEnvironment="${21}" + set +x # Use a very large stake (relative to the default multinode-demo/ stake of 42) @@ -52,6 +54,12 @@ airdropsEnabled=true if [[ -n $maybeDisableAirdrops ]]; then airdropsEnabled=false fi + +restrictedEnvironment=false +if [[ -n $maybeRestrictedEnvironment ]]; then + restrictedEnvironment=true +fi + cat > deployConfig < Date: Thu, 14 Nov 2019 22:31:55 -0500 Subject: [PATCH 2/3] Explicitly call out dev vs production mode in genesis --- genesis/src/main.rs | 15 +++++++++++---- multinode-demo/setup.sh | 1 + net/net.sh | 22 ++++++++++++++-------- net/remote/remote-node.sh | 12 ------------ 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/genesis/src/main.rs b/genesis/src/main.rs index ece329fc6a9063..7787019c4f2ae3 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -110,6 +110,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 = "production"; let matches = App::new(crate_name!()) .about(crate_description!()) @@ -295,9 +296,15 @@ 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") + .value_name("\"development\"|\"production\"") + .takes_value(true) + .default_value(default_operating_mode) + .help( + "Configure the cluster for DEVELOPMENT mode where all features are available at epoch 0, \ + or PRODUCTION mode where some features are disabled at epoch 0" + ), ) .get_matches(); @@ -380,7 +387,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 a90834db88e23b..3b25375a44f28f 100755 --- a/multinode-demo/setup.sh +++ b/multinode-demo/setup.sh @@ -34,6 +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 --operating-mode development $solana_genesis "${args[@]}" ( diff --git a/net/net.sh b/net/net.sh index 158afdbd03b9a3..3b79aae448de9f 100755 --- a/net/net.sh +++ b/net/net.sh @@ -88,7 +88,9 @@ Operate a configured testnet --use-move - Build the move-loader-program and add it to the cluster - --restricted-environment - Configure genesis block and cluster only to enable certain features for production launch + --operating-mode development|production + - Specify whether or not to launch the cluster in development mode with all features enabled at epoch 0, + or production mode with some features disabled at epoch 0 (default: development) sanity/start-specific options: -F - Discard validator nodes that didn't bootup successfully @@ -149,7 +151,6 @@ gpuMode=auto maybeUseMove="" netemPartition="" netemConfig="" -maybeRestrictedEnvironment="" command=$1 [[ -n $command ]] || usage @@ -170,6 +171,17 @@ while [[ -n $1 ]]; do elif [[ $1 = --lamports ]]; then genesisOptions="$genesisOptions $1 $2" shift 2 + elif [[ $1 = --operating-mode ]]; then + case "$2" in + development|production) + ;; + *) + echo "Unexpected operating mode: \"$2\"" + exit 1 + ;; + esac + genesisOptions="$genesisOptions $1 $2" + shift 2 elif [[ $1 = --no-snapshot-fetch ]]; then maybeNoSnapshot="$1" shift 1 @@ -230,9 +242,6 @@ while [[ -n $1 ]]; do ;; esac shift 2 - elif [[ $1 = --restricted-environment ]]; then - maybeRestrictedEnvironment="$1" - shift 1 else usage "Unknown long option: $1" fi @@ -495,7 +504,6 @@ startBootstrapLeader() { \"$maybeNoSnapshot $maybeSkipLedgerVerify $maybeLimitLedgerSize\" \ \"$gpuMode\" \ \"$GEOLOCATION_API_KEY\" \ - \"$maybeRestrictedEnvironment\" \ " ) >> "$logFile" 2>&1 || { @@ -842,7 +850,6 @@ deploy() { echo "Network start logs in $netLogDir" } - stopNode() { local ipAddress=$1 local block=$2 @@ -914,7 +921,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 diff --git a/net/remote/remote-node.sh b/net/remote/remote-node.sh index 6b402d8acb3aa4..7a05dc918e78c0 100755 --- a/net/remote/remote-node.sh +++ b/net/remote/remote-node.sh @@ -26,8 +26,6 @@ genesisOptions="${17}" extraNodeArgs="${18}" gpuMode="${19:-auto}" GEOLOCATION_API_KEY="${20}" -maybeRestrictedEnvironment="${21}" - set +x # Use a very large stake (relative to the default multinode-demo/ stake of 42) @@ -54,12 +52,6 @@ airdropsEnabled=true if [[ -n $maybeDisableAirdrops ]]; then airdropsEnabled=false fi - -restrictedEnvironment=false -if [[ -n $maybeRestrictedEnvironment ]]; then - restrictedEnvironment=true -fi - cat > deployConfig < Date: Fri, 15 Nov 2019 09:16:19 -0500 Subject: [PATCH 3/3] Rename production to softlaunch for consistency --- genesis/src/main.rs | 9 +++++---- net/net.sh | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/genesis/src/main.rs b/genesis/src/main.rs index 7787019c4f2ae3..4136e7ec7c5b21 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -110,7 +110,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 = "production"; + let default_operating_mode = "softlaunch"; let matches = App::new(crate_name!()) .about(crate_description!()) @@ -298,12 +298,13 @@ fn main() -> Result<(), Box> { .arg( Arg::with_name("operating_mode") .long("operating-mode") - .value_name("\"development\"|\"production\"") + .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 PRODUCTION mode where some features are disabled at epoch 0" + "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(); diff --git a/net/net.sh b/net/net.sh index 3b79aae448de9f..de38414fc61aa1 100755 --- a/net/net.sh +++ b/net/net.sh @@ -88,9 +88,9 @@ Operate a configured testnet --use-move - Build the move-loader-program and add it to the cluster - --operating-mode development|production - - Specify whether or not to launch the cluster in development mode with all features enabled at epoch 0, - or production mode with some features disabled at epoch 0 (default: development) + --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 @@ -173,7 +173,7 @@ while [[ -n $1 ]]; do shift 2 elif [[ $1 = --operating-mode ]]; then case "$2" in - development|production) + development|softlaunch) ;; *) echo "Unexpected operating mode: \"$2\""