Skip to content

Commit

Permalink
[cli] Better error message when a sui config folder exists without ge…
Browse files Browse the repository at this point in the history
…nesis metadata (#19487)

## Description 

Improves the error message when running `sui start` when a sui config
folder exists without genesis metadata.

## Test plan 

Existing tests.

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [x] CLI: Improved the error message when running `sui start` when a
sui config folder exists without genesis metadata.
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
stefan-mysten authored Sep 23, 2024
1 parent 16e6c7b commit 283f954
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/sui/src/sui_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ async fn start(
swarm_builder = swarm_builder.with_epoch_duration_ms(epoch_duration_ms);
} else {
if config.is_none() && !sui_config_dir()?.join(SUI_NETWORK_CONFIG).exists() {
genesis(None, None, None, false, epoch_duration_ms, None, false).await?;
genesis(None, None, None, false, epoch_duration_ms, None, false).await.map_err(|_| anyhow!("Cannot run genesis with non-empty Sui config directory: {}.\n\nIf you are trying to run a local network without persisting the data (so a new genesis that is randomly generated and will not be saved once the network is shut down), use --force-regenesis flag.\nIf you are trying to persist the network data and start from a new genesis, use sui genesis --help to see how to generate a new genesis.", sui_config_dir().unwrap().display()))?;
}

// Load the config of the Sui authority.
Expand Down

0 comments on commit 283f954

Please sign in to comment.