diff --git a/.devnet/start.sh b/.devnet/start.sh index 5214836d71..f61cea6af0 100755 --- a/.devnet/start.sh +++ b/.devnet/start.sh @@ -37,7 +37,7 @@ start_snarkos_in_tmux() { tmux new-session -d -s snarkos-session # Send the snarkOS start command to the tmux session with the NODE_ID - tmux send-keys -t "snarkos-session" "snarkos start --nodisplay --bft 0.0.0.0:5000 --rest 0.0.0.0:3030 --peers $NODE_IP:4130 --validators $NODE_IP:5000 --verbosity $VERBOSITY --dev $NODE_ID --dev-traffic --dev-num-validators $NUM_INSTANCES --validator --metrics" C-m + tmux send-keys -t "snarkos-session" "snarkos start --nodisplay --bft 0.0.0.0:5000 --rest 0.0.0.0:3030 --peers $NODE_IP:4130 --validators $NODE_IP:5000 --verbosity $VERBOSITY --dev $NODE_ID --dev-num-validators $NUM_INSTANCES --validator --metrics" C-m exit # Exit root user EOF diff --git a/cli/src/commands/start.rs b/cli/src/commands/start.rs index ad2b1a7825..e0b149c6bd 100644 --- a/cli/src/commands/start.rs +++ b/cli/src/commands/start.rs @@ -138,8 +138,8 @@ pub struct Start { #[clap(long)] pub dev_num_validators: Option, /// If developtment mode is enabled, specify whether node 0 should generate traffic to drive the network - #[clap(default_value = "false", long = "dev-traffic")] - pub dev_traffic: bool, + #[clap(default_value = "false", long = "no-dev-txs")] + pub no_dev_txs: bool, /// Specify the path to a directory containing the ledger #[clap(long = "storage_path")] pub storage_path: Option, @@ -527,13 +527,13 @@ impl Start { None => StorageMode::from(self.dev), }; - // Determine whether to generate background traffic in dev mode. - let dev_traffic = match self.dev { - Some(_) => self.dev_traffic, + // Determine whether to generate background transactions in dev mode. + let dev_txs = match self.dev { + Some(_) => !self.no_dev_txs, None => { - // If the `dev_traffic` flag is set, inform the user that it is ignored. - if self.dev_traffic { - eprintln!("The '--dev-traffic' flag is ignored because '--dev' is not set"); + // If the `no_dev_txs` flag is set, inform the user that it is ignored. + if self.no_dev_txs { + eprintln!("The '--no-dev-txs' flag is ignored because '--dev' is not set"); } false } @@ -542,7 +542,7 @@ impl Start { // Initialize the node. let bft_ip = if self.dev.is_some() { self.bft } else { None }; match node_type { - NodeType::Validator => Node::new_validator(self.node, bft_ip, rest_ip, self.rest_rps, account, &trusted_peers, &trusted_validators, genesis, cdn, storage_mode, dev_traffic).await, + NodeType::Validator => Node::new_validator(self.node, bft_ip, rest_ip, self.rest_rps, account, &trusted_peers, &trusted_validators, genesis, cdn, storage_mode, dev_txs).await, NodeType::Prover => Node::new_prover(self.node, account, &trusted_peers, genesis, storage_mode).await, NodeType::Client => Node::new_client(self.node, rest_ip, self.rest_rps, account, &trusted_peers, genesis, cdn, storage_mode).await, } diff --git a/devnet.sh b/devnet.sh index f4458625a2..e91627335a 100755 --- a/devnet.sh +++ b/devnet.sh @@ -64,12 +64,12 @@ for validator_index in "${validator_indices[@]}"; do # Send the command to start the validator to the new window and capture output to the log file if [ "$validator_index" -eq 0 ]; then - tmux send-keys -t "devnet:window$validator_index" "snarkos start --nodisplay --dev $validator_index --dev-traffic --dev-num-validators $total_validators --validator --logfile $log_file --metrics" C-m + tmux send-keys -t "devnet:window$validator_index" "snarkos start --nodisplay --dev $validator_index --dev-num-validators $total_validators --validator --logfile $log_file --metrics" C-m else # Create a new window with a unique name window_index=$((validator_index + index_offset)) tmux new-window -t "devnet:$window_index" -n "window$validator_index" - tmux send-keys -t "devnet:window$validator_index" "snarkos start --nodisplay --dev $validator_index --dev-traffic --dev-num-validators $total_validators --validator --logfile $log_file" C-m + tmux send-keys -t "devnet:window$validator_index" "snarkos start --nodisplay --dev $validator_index --dev-num-validators $total_validators --validator --logfile $log_file" C-m fi done diff --git a/node/src/node.rs b/node/src/node.rs index 0203f505e0..d98376d384 100644 --- a/node/src/node.rs +++ b/node/src/node.rs @@ -50,7 +50,7 @@ impl Node { genesis: Block, cdn: Option, storage_mode: StorageMode, - dev_traffic: bool, + dev_txs: bool, ) -> Result { Ok(Self::Validator(Arc::new( Validator::new( @@ -64,7 +64,7 @@ impl Node { genesis, cdn, storage_mode, - dev_traffic, + dev_txs, ) .await?, ))) diff --git a/node/src/validator/mod.rs b/node/src/validator/mod.rs index 0c3431ddc4..23b4f76920 100644 --- a/node/src/validator/mod.rs +++ b/node/src/validator/mod.rs @@ -83,7 +83,7 @@ impl> Validator { genesis: Block, cdn: Option, storage_mode: StorageMode, - dev_traffic: bool, + dev_txs: bool, ) -> Result { // Prepare the shutdown flag. let shutdown: Arc = Default::default(); @@ -140,7 +140,7 @@ impl> Validator { shutdown, }; // Initialize the transaction pool. - node.initialize_transaction_pool(storage_mode, dev_traffic)?; + node.initialize_transaction_pool(storage_mode, dev_txs)?; // Initialize the REST server. if let Some(rest_ip) = rest_ip { @@ -340,7 +340,7 @@ impl> Validator { // } /// Initialize the transaction pool. - fn initialize_transaction_pool(&self, storage_mode: StorageMode, dev_traffic: bool) -> Result<()> { + fn initialize_transaction_pool(&self, storage_mode: StorageMode, dev_txs: bool) -> Result<()> { use snarkvm::console::{ program::{Identifier, Literal, ProgramID, Value}, types::U64, @@ -355,7 +355,7 @@ impl> Validator { // If the node is running in development mode, only generate if you are allowed. StorageMode::Development(id) => { // If the node is not the first node, or if we should not create dev traffic, do not start the loop. - if id != 0 || !dev_traffic { + if id != 0 || !dev_txs { return Ok(()); } } @@ -473,7 +473,7 @@ mod tests { let node = SocketAddr::from_str("0.0.0.0:4130").unwrap(); let rest = SocketAddr::from_str("0.0.0.0:3030").unwrap(); let storage_mode = StorageMode::Development(0); - let dev_traffic = true; + let dev_txs = true; // Initialize an (insecure) fixed RNG. let mut rng = ChaChaRng::seed_from_u64(1234567890u64); @@ -497,7 +497,7 @@ mod tests { genesis, None, storage_mode, - dev_traffic, + dev_txs, ) .await .unwrap();