From a0a5485d3a3d95a3bc42e854ebc7d3d6fed6d092 Mon Sep 17 00:00:00 2001
From: Liam Aharon <liam.aharon@hotmail.com>
Date: Fri, 10 May 2024 07:24:48 +0500
Subject: [PATCH] move parse to common

---
 core/src/commands/execute_block.rs   | 2 +-
 core/src/commands/follow_chain.rs    | 4 +++-
 core/src/commands/offchain_worker.rs | 4 +++-
 core/src/common/mod.rs               | 1 +
 core/src/{ => common}/parse.rs       | 0
 core/src/common/shared_parameters.rs | 2 +-
 core/src/lib.rs                      | 1 -
 core/src/state.rs                    | 7 +++++--
 8 files changed, 14 insertions(+), 7 deletions(-)
 rename core/src/{ => common}/parse.rs (100%)

diff --git a/core/src/commands/execute_block.rs b/core/src/commands/execute_block.rs
index 1c918424b91..e63724d75b5 100644
--- a/core/src/commands/execute_block.rs
+++ b/core/src/commands/execute_block.rs
@@ -58,7 +58,7 @@ pub struct Command {
     /// If `state` is `Live`, this can be ignored and the same uri is used for both.
     #[arg(
 		long,
-		value_parser = crate::parse::url
+		value_parser = crate::common::parse::url
 	)]
     pub block_ws_uri: Option<String>,
 
diff --git a/core/src/commands/follow_chain.rs b/core/src/commands/follow_chain.rs
index 1381d67c9c9..d6707af98b7 100644
--- a/core/src/commands/follow_chain.rs
+++ b/core/src/commands/follow_chain.rs
@@ -28,7 +28,9 @@ use sp_runtime::{
 use substrate_rpc_client::{ws_client, ChainApi, FinalizedHeaders, Subscription, WsClient};
 
 use crate::{
-    build_executor, full_extensions, parse, rpc_err_handler,
+    build_executor,
+    common::parse,
+    full_extensions, rpc_err_handler,
     state::{LiveState, RuntimeChecks, State},
     state_machine_call_with_proof, SharedParams, LOG_TARGET,
 };
diff --git a/core/src/commands/offchain_worker.rs b/core/src/commands/offchain_worker.rs
index 5b0ab78a579..f5d82466035 100644
--- a/core/src/commands/offchain_worker.rs
+++ b/core/src/commands/offchain_worker.rs
@@ -23,7 +23,9 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
 use substrate_rpc_client::{ws_client, ChainApi};
 
 use crate::{
-    build_executor, full_extensions, parse, rpc_err_handler,
+    build_executor,
+    common::parse,
+    full_extensions, rpc_err_handler,
     state::{LiveState, RuntimeChecks, State},
     state_machine_call, SharedParams, LOG_TARGET,
 };
diff --git a/core/src/common/mod.rs b/core/src/common/mod.rs
index 52aecd378c5..296231dff4b 100644
--- a/core/src/common/mod.rs
+++ b/core/src/common/mod.rs
@@ -1,2 +1,3 @@
 pub mod misc_logging;
+pub mod parse;
 pub mod shared_parameters;
diff --git a/core/src/parse.rs b/core/src/common/parse.rs
similarity index 100%
rename from core/src/parse.rs
rename to core/src/common/parse.rs
diff --git a/core/src/common/shared_parameters.rs b/core/src/common/shared_parameters.rs
index 968d3b255b3..0b4f3020c72 100644
--- a/core/src/common/shared_parameters.rs
+++ b/core/src/common/shared_parameters.rs
@@ -23,7 +23,7 @@ use sc_cli::{
 };
 use sp_runtime::StateVersion;
 
-use crate::parse;
+use crate::common::parse;
 
 /// Shared parameters of the `try-runtime` commands
 #[derive(Debug, Clone, clap::Parser)]
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 2199351041c..f3a6daa1988 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -42,7 +42,6 @@ use sp_weights::Weight;
 pub mod commands;
 pub mod common;
 mod inherents;
-mod parse;
 pub mod state;
 
 pub(crate) const LOG_TARGET: &str = "try-runtime::cli";
diff --git a/core/src/state.rs b/core/src/state.rs
index adce4450656..a5f97547e58 100644
--- a/core/src/state.rs
+++ b/core/src/state.rs
@@ -33,8 +33,11 @@ use sp_runtime::{
 use substrate_rpc_client::{ws_client, ChainApi};
 
 use crate::{
-    common::shared_parameters::{Runtime, SharedParams},
-    ensure_try_runtime, hash_of, parse, rpc_err_handler, LOG_TARGET,
+    common::{
+        parse,
+        shared_parameters::{Runtime, SharedParams},
+    },
+    ensure_try_runtime, hash_of, rpc_err_handler, LOG_TARGET,
 };
 
 /// A `Live` variant for [`State`]