Skip to content

Commit fd919c4

Browse files
authored
Remove unnecessary genesis-config parameters (#4109)
## Motivation Simplify CLI ## Proposal Pass the genesis config path only when using a memory store. ## Test Plan CI
1 parent 872f25c commit fd919c4

File tree

11 files changed

+63
-84
lines changed

11 files changed

+63
-84
lines changed

docker/compose-proxy-entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ storage_replication_factor=$1
44

55
exec ./linera-proxy \
66
--storage scylladb:tcp:scylla:9042 \
7-
--genesis /config/genesis.json \
87
--storage-replication-factor $storage_replication_factor \
98
/config/server.json

docker/compose-server-entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ exec ./linera-server run \
77
--storage $storage \
88
--server /config/server.json \
99
--shard 0 \
10-
--genesis /config/genesis.json \
1110
--storage-replication-factor $storage_replication_factor

docker/proxy-entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ORDINAL="${HOSTNAME##*-}"
55

66
exec ./linera-proxy \
77
--storage scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042 \
8-
--genesis /config/genesis.json \
98
--storage-replication-factor $storage_replication_factor \
109
--id "$ORDINAL" \
1110
/config/server.json

docker/server-entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ exec ./linera-server run \
1010
--storage $storage \
1111
--server /config/server.json \
1212
--shard $ORDINAL \
13-
--genesis /config/genesis.json \
1413
--storage-replication-factor $storage_replication_factor

linera-service/src/cli/main.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,13 +1296,9 @@ impl ClientOptions {
12961296
let store_config = storage_config
12971297
.add_common_config(self.common_config())
12981298
.await?;
1299-
let genesis_config = self.wallet().await?.genesis_config().clone();
1300-
let output = Box::pin(store_config.run_with_storage(
1301-
&genesis_config,
1302-
self.wasm_runtime.with_wasm_default(),
1303-
job,
1304-
))
1305-
.await?;
1299+
let output =
1300+
Box::pin(store_config.run_with_storage(self.wasm_runtime.with_wasm_default(), job))
1301+
.await?;
13061302
Ok(output)
13071303
}
13081304

linera-service/src/cli/net_up_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl StorageConfigProvider {
8888

8989
pub fn database(&self) -> anyhow::Result<Database> {
9090
match self.storage.storage_config {
91-
StorageConfig::Memory => anyhow::bail!("Not possible to work with memory"),
91+
StorageConfig::Memory { .. } => anyhow::bail!("Not possible to work with memory"),
9292
#[cfg(feature = "rocksdb")]
9393
StorageConfig::RocksDb { .. } => anyhow::bail!("Not possible to work with RocksDB"),
9494
#[cfg(feature = "storage-service")]

linera-service/src/cli_wrappers/local_net.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,6 @@ impl LocalNet {
588588
.await?
589589
.arg(format!("server_{}.json", validator))
590590
.args(["--storage", &storage.to_string()])
591-
.args(["--genesis", "genesis.json"])
592591
.spawn_into()?;
593592

594593
let port = Self::proxy_public_port(validator, 0);
@@ -625,7 +624,6 @@ impl LocalNet {
625624
.await?
626625
.arg(config_path)
627626
.args(["--storage", &storage.to_string()])
628-
.args(["--genesis", "genesis.json"])
629627
.spawn_into()?;
630628

631629
match self.network.internal {
@@ -757,7 +755,6 @@ impl LocalNet {
757755
.args(["--storage", &storage.to_string()])
758756
.args(["--server", &format!("server_{}.json", validator)])
759757
.args(["--shard", &shard.to_string()])
760-
.args(["--genesis", "genesis.json"])
761758
.args(self.cross_chain_config.to_args());
762759
let child = command.spawn_into()?;
763760

linera-service/src/linera-exporter/main.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use std::path::PathBuf;
66
use anyhow::Result;
77
use exporter_service::ExporterContext;
88
use futures::FutureExt;
9-
use linera_client::config::{BlockExporterConfig, GenesisConfig};
9+
use linera_client::config::BlockExporterConfig;
1010
use linera_sdk::views::ViewError;
11-
use linera_service::{storage::StorageConfigNamespace, util};
11+
use linera_service::storage::StorageConfigNamespace;
1212
use linera_views::{lru_caching::StorageCacheConfig, store::CommonStoreConfig};
1313

1414
#[allow(dead_code)]
@@ -68,10 +68,6 @@ struct ExporterOptions {
6868
/// The maximal number of entries in the storage cache.
6969
#[arg(long, default_value = "1000")]
7070
max_cache_entries: usize,
71-
72-
/// Path to the file describing the initial user chains (aka genesis state)
73-
#[arg(long = "genesis")]
74-
genesis_config_path: PathBuf,
7571
}
7672

7773
fn main() -> Result<()> {
@@ -108,8 +104,6 @@ impl ExporterOptions {
108104
}
109105
};
110106

111-
let genesis_config: GenesisConfig = util::read_json(&self.genesis_config_path)?;
112-
113107
let future = async {
114108
let context =
115109
ExporterContext::new(config.id, config.service_config, config.destination_config);
@@ -118,10 +112,7 @@ impl ExporterOptions {
118112
.add_common_config(common_config)
119113
.await
120114
.unwrap();
121-
storage_config
122-
.run_with_storage(&genesis_config, None, context)
123-
.boxed()
124-
.await
115+
storage_config.run_with_storage(None, context).boxed().await
125116
};
126117

127118
let runtime = runtime_builder.enable_all().build()?;

linera-service/src/proxy/main.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use anyhow::{anyhow, bail, ensure, Result};
99
use async_trait::async_trait;
1010
use futures::{FutureExt as _, SinkExt, StreamExt};
1111
use linera_base::listen_for_shutdown_signals;
12-
use linera_client::config::{GenesisConfig, ValidatorServerConfig};
12+
use linera_client::config::ValidatorServerConfig;
1313
use linera_core::{node::NodeError, JoinSetExt as _};
1414
use linera_rpc::{
1515
config::{
@@ -92,10 +92,6 @@ pub struct ProxyOptions {
9292
#[arg(long, default_value = "1000")]
9393
pub max_cache_entries: usize,
9494

95-
/// Path to the file describing the initial user chains (aka genesis state)
96-
#[arg(long = "genesis")]
97-
genesis_config_path: PathBuf,
98-
9995
/// The replication factor for the keyspace
10096
#[arg(long, default_value = "1")]
10197
storage_replication_factor: u32,
@@ -445,10 +441,9 @@ impl ProxyOptions {
445441
storage_cache_config,
446442
replication_factor: self.storage_replication_factor,
447443
};
448-
let genesis_config: GenesisConfig = util::read_json(&self.genesis_config_path)?;
449444
let store_config = self.storage_config.add_common_config(common_config).await?;
450445
store_config
451-
.run_with_storage(&genesis_config, None, ProxyContext::from_options(self)?)
446+
.run_with_storage(None, ProxyContext::from_options(self)?)
452447
.boxed()
453448
.await?
454449
}

linera-service/src/server.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,6 @@ enum ServerCommand {
340340
#[command(flatten)]
341341
notification_config: NotificationConfig,
342342

343-
/// Path to the file describing the initial user chains (aka genesis state)
344-
#[arg(long = "genesis")]
345-
genesis_config_path: PathBuf,
346-
347343
/// Runs a specific shard (from 0 to shards-1)
348344
#[arg(long)]
349345
shard: Option<usize>,
@@ -529,7 +525,6 @@ async fn run(options: ServerOptions) {
529525
storage_config,
530526
cross_chain_config,
531527
notification_config,
532-
genesis_config_path,
533528
shard,
534529
grace_period,
535530
wasm_runtime,
@@ -543,8 +538,6 @@ async fn run(options: ServerOptions) {
543538
} => {
544539
linera_version::VERSION_INFO.log();
545540

546-
let genesis_config: GenesisConfig =
547-
util::read_json(&genesis_config_path).expect("Failed to read initial chain config");
548541
let server_config: ValidatorServerConfig =
549542
util::read_json(&server_config_path).expect("Failed to read server config");
550543

@@ -573,7 +566,7 @@ async fn run(options: ServerOptions) {
573566
.await
574567
.unwrap();
575568
store_config
576-
.run_with_storage(&genesis_config, wasm_runtime, job)
569+
.run_with_storage(wasm_runtime, job)
577570
.boxed()
578571
.await
579572
.unwrap()

0 commit comments

Comments
 (0)