diff --git a/crates/sui/src/sui_commands.rs b/crates/sui/src/sui_commands.rs index 8a539ade6fbbe..4ad70d523a5be 100644 --- a/crates/sui/src/sui_commands.rs +++ b/crates/sui/src/sui_commands.rs @@ -203,6 +203,13 @@ pub enum SuiCommand { #[clap(long)] epoch_duration_ms: Option, + /// Make the fullnode dump executed checkpoints as files to this directory. This is + /// incompatible with --no-full-node. + /// + /// If --with-indexer is set, this defaults to a temporary directory. + #[clap(long, value_name = "DATA_INGESTION_DIR")] + data_ingestion_dir: Option, + /// Start the network without a fullnode #[clap(long = "no-full-node")] no_full_node: bool, @@ -368,6 +375,7 @@ impl SuiCommand { indexer_feature_args, fullnode_rpc_port, + data_ingestion_dir, no_full_node, epoch_duration_ms, } => { @@ -378,6 +386,7 @@ impl SuiCommand { force_regenesis, epoch_duration_ms, fullnode_rpc_port, + data_ingestion_dir, no_full_node, ) .await?; @@ -597,6 +606,7 @@ async fn start( force_regenesis: bool, epoch_duration_ms: Option, fullnode_rpc_port: u16, + mut data_ingestion_dir: Option, no_full_node: bool, ) -> Result<(), anyhow::Error> { if force_regenesis { @@ -706,14 +716,15 @@ async fn start( sui_config_path }; - let data_ingestion_path = tempdir()?.into_path(); - // the indexer requires to set the fullnode's data ingestion directory // note that this overrides the default configuration that is set when running the genesis // command, which sets data_ingestion_dir to None. + if with_indexer.is_some() && data_ingestion_dir.is_none() { + data_ingestion_dir = Some(tempdir()?.into_path()) + } - if with_indexer.is_some() { - swarm_builder = swarm_builder.with_data_ingestion_dir(data_ingestion_path.clone()); + if let Some(ref dir) = data_ingestion_dir { + swarm_builder = swarm_builder.with_data_ingestion_dir(dir.clone()); } let mut fullnode_url = sui_config::node::default_json_rpc_address(); @@ -754,7 +765,8 @@ async fn start( pg_address.clone(), None, None, - Some(data_ingestion_path.clone()), + // We ensured above that this is set to something if --with-indexer is set + data_ingestion_dir, None, None, /* start_checkpoint */ None, /* end_checkpoint */ diff --git a/crates/sui/tests/cli_tests.rs b/crates/sui/tests/cli_tests.rs index 9c171705b4172..3a1a86fef4d31 100644 --- a/crates/sui/tests/cli_tests.rs +++ b/crates/sui/tests/cli_tests.rs @@ -69,6 +69,7 @@ async fn test_genesis() -> Result<(), anyhow::Error> { // Start network without authorities let start = SuiCommand::Start { + data_ingestion_dir: None, config_dir: Some(config), force_regenesis: false, with_faucet: None,