Skip to content

Commit

Permalink
Refactor en
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Jun 25, 2024
1 parent d196cc6 commit e4b9eac
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion core/tests/ts-integration/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ function loadConfig(pathToHome: string, chainName: string, config: string, mode:
suffixPath = path.join('external_node', suffixPath);
}
configPath = path.join(configPath, suffixPath);
console.log(configPath);
if (!fs.existsSync(configPath)) {
return [];
}
Expand Down
6 changes: 3 additions & 3 deletions zk_toolbox/crates/zk_inception/src/commands/chain/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::{
MSG_CHAIN_NOT_INITIALIZED, MSG_FAILED_TO_DROP_PROVER_DATABASE_ERR,
MSG_FAILED_TO_DROP_SERVER_DATABASE_ERR, MSG_GENESIS_COMPLETED,
MSG_INITIALIZING_DATABASES_SPINNER, MSG_INITIALIZING_PROVER_DATABASE,
MSG_INITIALIZING_SERVER_DATABASE, MSG_SELECTED_CONFIG, MSG_STARTING_GENESIS,
MSG_STARTING_GENESIS_SPINNER,
MSG_INITIALIZING_SERVER_DATABASE, MSG_RECREATE_ROCKS_DB_ERRROR, MSG_SELECTED_CONFIG,
MSG_STARTING_GENESIS, MSG_STARTING_GENESIS_SPINNER,
},
server::{RunServer, ServerMode},
utils::rocks_db::{recreate_rocksdb_dirs, RocksDBDirOption},
Expand Down Expand Up @@ -48,7 +48,7 @@ pub async fn genesis(
shell.create_dir(&config.rocks_db_path)?;

let rocks_db = recreate_rocksdb_dirs(shell, &config.rocks_db_path, RocksDBDirOption::Main)
.context("Failed to create rocks db path")?;
.context(MSG_RECREATE_ROCKS_DB_ERRROR)?;
let mut general = config.get_general_config()?;
general.set_rocks_db_config(rocks_db)?;
if config.prover_version != ProverMode::NoProofs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use xshell::Shell;
use crate::{
consts::SERVER_MIGRATIONS,
messages::{
MSG_CHAIN_NOT_INITIALIZED, MSG_FAILED_TO_DROP_SERVER_DATABASE_ERR,
MSG_INITIALIZING_DATABASES_SPINNER,
MSG_CHAIN_NOT_INITIALIZED, MSG_EXTERNAL_NODE_CONFIG_NOT_INITIALIZED,
MSG_FAILED_TO_DROP_SERVER_DATABASE_ERR, MSG_INITIALIZING_DATABASES_SPINNER,
},
utils::rocks_db::{recreate_rocksdb_dirs, RocksDBDirOption},
};
Expand All @@ -34,7 +34,7 @@ pub async fn init(shell: &Shell, chain_config: &ChainConfig) -> anyhow::Result<(
chain_config
.external_node_config_path
.clone()
.context("External node is not initalized")?,
.context(MSG_EXTERNAL_NODE_CONFIG_NOT_INITIALIZED)?,
)?;
let db_config = DatabaseConfig::from_url(secrets.database.server_url)?;
drop_db_if_exists(&db_config)
Expand Down
4 changes: 3 additions & 1 deletion zk_toolbox/crates/zk_inception/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub(super) const MSG_ECOSYSTEM_CONTRACTS_PATH_PROMPT: &str = "Provide the path t
pub(super) const MSG_L1_RPC_URL_INVALID_ERR: &str = "Invalid RPC URL";
pub(super) const MSG_ECOSYSTEM_CONTRACTS_PATH_INVALID_ERR: &str = "Invalid path";
pub(super) const MSG_GENESIS_DATABASE_ERR: &str = "Unable to perform genesis on the database";
pub(super) const MSG_CONTRACTS_CONFIG_NOT_FOUND_ERR: &str = "Ecosystem contracts config not found";
pub(super) const MSG_CHAIN_NOT_FOUND_ERR: &str = "Chain not found";
pub(super) const MSG_INITIALIZING_ECOSYSTEM: &str = "Initializing ecosystem";
pub(super) const MSG_DEPLOYING_ERC20: &str = "Deploying ERC20 contracts";
Expand All @@ -57,6 +56,7 @@ pub(super) const MSG_DEPLOYING_ECOSYSTEM_CONTRACTS_SPINNER: &str =
"Deploying ecosystem contracts...";
pub(super) const MSG_REGISTERING_CHAIN_SPINNER: &str = "Registering chain...";
pub(super) const MSG_ACCEPTING_ADMIN_SPINNER: &str = "Accepting admin...";
pub(super) const MSG_RECREATE_ROCKS_DB_ERRROR: &str = "Failed to create rocks db path";

pub(super) fn msg_initializing_chain(chain_name: &str) -> String {
format!("Initializing chain {chain_name}")
Expand Down Expand Up @@ -204,6 +204,8 @@ pub(super) fn msg_preparing_en_config_is_done(path: &Path) -> String {
format!("External nodes configs could be found in: {path:?}")
}

pub(super) const MSG_EXTERNAL_NODE_CONFIG_NOT_INITIALIZED: &str =
"External node is not initialized";
/// Prover related messages
pub(super) const MSG_GENERATING_SK_SPINNER: &str = "Generating setup keys...";
pub(super) const MSG_SK_GENERATED: &str = "Setup keys generated successfully";
Expand Down
2 changes: 1 addition & 1 deletion zk_toolbox/crates/zk_supervisor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ strum_macros.workspace = true
tokio.workspace = true
url.workspace = true
xshell.workspace = true
serde = { version = "1.0.197", features = ["derive"] }
serde.workspace = true
4 changes: 2 additions & 2 deletions zk_toolbox/crates/zk_supervisor/src/dals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use config::{EcosystemConfig, SecretsConfig};
use url::Url;
use xshell::Shell;

use crate::messages::MSG_CHAIN_NOT_FOUND_ERR;
use crate::messages::{MSG_CHAIN_NOT_FOUND_ERR, MSG_PROVER_URL_MUST_BE_PRESENTED};

const CORE_DAL_PATH: &str = "core/lib/dal";
const PROVER_DAL_PATH: &str = "prover/prover_dal";
Expand Down Expand Up @@ -49,7 +49,7 @@ pub fn get_prover_dal(shell: &Shell) -> anyhow::Result<Dal> {
url: secrets
.database
.prover_url
.context("Prover url must be presented")?
.context(MSG_PROVER_URL_MUST_BE_PRESENTED)?
.clone(),
})
}
Expand Down
2 changes: 2 additions & 0 deletions zk_toolbox/crates/zk_supervisor/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub(super) const MSG_DATABASE_RESET_PAST: &str = "reset";
pub(super) const MSG_DATABASE_SETUP_GERUND: &str = "Setting up";
pub(super) const MSG_DATABASE_SETUP_PAST: &str = "set up";

pub(super) const MSG_PROVER_URL_MUST_BE_PRESENTED: &str = "Prover url must be presented";

pub(super) const MSG_DATABASE_COMMON_PROVER_HELP: &str = "Prover database";
pub(super) const MSG_DATABASE_COMMON_CORE_HELP: &str = "Core database";
pub(super) const MSG_DATABASE_NEW_MIGRATION_DATABASE_HELP: &str =
Expand Down

0 comments on commit e4b9eac

Please sign in to comment.