Skip to content

Commit

Permalink
fix all docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kianenigma committed Dec 13, 2022
1 parent 4eb028e commit a35bca9
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions utils/frame/try-runtime/cli/src/commands/create_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
use std::{fmt::Debug, str::FromStr};
use substrate_rpc_client::{ws_client, StateApi};

/// Configurations of the [`Command::CreateSnapshot`].
/// Configurations of the [`crate::Command::CreateSnapshot`].
#[derive(Debug, Clone, clap::Parser)]
pub struct CreateSnapshotCmd {
/// The source of the snapshot. Must be a remote node.
#[clap(flatten)]
from: LiveState,
pub from: LiveState,

/// The snapshot path to write to.
///
/// If not provided `<spec-name>-<spec-version>@<block-hash>.snap` will be used.
snapshot_path: Option<String>,
pub snapshot_path: Option<String>,
}

/// inner command for `Command::CreateSnapshot`.
Expand Down
8 changes: 4 additions & 4 deletions utils/frame/try-runtime/cli/src/commands/execute_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use sp_runtime::{
use std::{fmt::Debug, str::FromStr};
use substrate_rpc_client::{ws_client, ChainApi};

/// Configurations of the [`Command::ExecuteBlock`].
/// Configurations of the [`crate::Command::ExecuteBlock`].
///
/// This will always call into `TryRuntime_execute_block`, which can optionally skip the state-root
/// check (useful for trying a unreleased runtime), and can execute runtime sanity checks as well.
Expand All @@ -45,7 +45,7 @@ pub struct ExecuteBlockCmd {
/// - `rr-[x]` where `[x]` is a number. Then, the given number of pallets are checked in a
/// round-robin fashion.
#[arg(long, default_value = "all")]
try_state: frame_try_runtime::TryStateSelect,
pub try_state: frame_try_runtime::TryStateSelect,

/// The ws uri from which to fetch the block.
///
Expand All @@ -58,11 +58,11 @@ pub struct ExecuteBlockCmd {
long,
value_parser = crate::parse::url
)]
block_ws_uri: Option<String>,
pub block_ws_uri: Option<String>,

/// The state type to use.
#[command(subcommand)]
state: State,
pub state: State,
}

impl ExecuteBlockCmd {
Expand Down
10 changes: 5 additions & 5 deletions utils/frame/try-runtime/cli/src/commands/follow_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ use substrate_rpc_client::{ws_client, ChainApi, FinalizedHeaders, Subscription,
const SUB: &str = "chain_subscribeFinalizedHeads";
const UN_SUB: &str = "chain_unsubscribeFinalizedHeads";

/// Configurations of the [`Command::FollowChain`].
/// Configurations of the [`crate::Command::FollowChain`].
#[derive(Debug, Clone, clap::Parser)]
pub struct FollowChainCmd {
/// The url to connect to.
#[arg(short, long, value_parser = parse::url)]
uri: String,
pub uri: String,

/// If set, then the state root check is enabled.
#[arg(long)]
state_root_check: bool,
pub state_root_check: bool,

/// Which try-state targets to execute when running this command.
///
Expand All @@ -54,11 +54,11 @@ pub struct FollowChainCmd {
/// - `rr-[x]` where `[x]` is a number. Then, the given number of pallets are checked in a
/// round-robin fashion.
#[arg(long, default_value = "all")]
try_state: frame_try_runtime::TryStateSelect,
pub try_state: frame_try_runtime::TryStateSelect,

/// If present, a single connection to a node will be kept and reused for fetching blocks.
#[arg(long)]
keep_connection: bool,
pub keep_connection: bool,
}

/// Start listening for with `SUB` at `url`.
Expand Down
10 changes: 5 additions & 5 deletions utils/frame/try-runtime/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pub(crate) mod create_snapshot;
pub(crate) mod execute_block;
pub(crate) mod follow_chain;
pub(crate) mod offchain_worker;
pub(crate) mod on_runtime_upgrade;
pub mod create_snapshot;
pub mod execute_block;
pub mod follow_chain;
pub mod offchain_worker;
pub mod on_runtime_upgrade;
4 changes: 2 additions & 2 deletions utils/frame/try-runtime/cli/src/commands/offchain_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
use std::{fmt::Debug, str::FromStr};
use substrate_rpc_client::{ws_client, ChainApi};

/// Configurations of the [`Command::OffchainWorker`].
/// Configurations of the [`crate::Command::OffchainWorker`].
#[derive(Debug, Clone, clap::Parser)]
pub struct OffchainWorkerCmd {
/// The ws uri from which to fetch the header.
Expand All @@ -36,7 +36,7 @@ pub struct OffchainWorkerCmd {
long,
value_parser = parse::url
)]
header_ws_uri: Option<String>,
pub header_ws_uri: Option<String>,

/// The state type to use.
#[command(subcommand)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
use sp_weights::Weight;
use std::{fmt::Debug, str::FromStr};

/// Configurations of the [`Command::OnRuntimeUpgrade`].
/// Configurations of the [`crate::Command::OnRuntimeUpgrade`].
#[derive(Debug, Clone, clap::Parser)]
pub struct OnRuntimeUpgradeCmd {
/// The state type to use.
Expand Down
30 changes: 15 additions & 15 deletions utils/frame/try-runtime/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
//! To use any of the provided commands, [`SharedParams`] must be provided. The most important of
//! which being [`SharedParams::runtime`], which specifies which runtime to use. Furthermore,
//! [`SharedParams::overwrite_state_version`] can be used to alter the state-version (see
//! https://forum.polkadot.network/t/state-trie-migration/852 for more info).
//! <https://forum.polkadot.network/t/state-trie-migration/852> for more info).
//!
//! Then, the specific command has to be specified. See [`Command`] for more information about each
//! command's specific customization flags, and assumptions regarding the runtime being used.
Expand Down Expand Up @@ -133,7 +133,7 @@
//! given the right flag:
//!
//! ```ignore
//!
//!
//! #[cfg(feature = try-runtime)]
//! fn pre_upgrade() -> Result<Vec<u8>, &'static str> {}
//!
Expand All @@ -158,7 +158,7 @@
//! ```
//!
//! which is called on numerous code paths in the try-runtime tool. These checks should ensure that
//! the state of the pallet is consistent and correct. See [`frame_support::try_runtime::TryState`]
//! the state of the pallet is consistent and correct. See `frame_support::try_runtime::TryState`
//! for more info.
//!
//! #### Logging
Expand Down Expand Up @@ -281,7 +281,7 @@
//! --at 0xa1b16c1efd889a9f17375ec4dd5c1b4351a2be17fa069564fced10d23b9b3836
//! ```
//!
//! * Executing the same command with the [`Runtime::existing`] will fail because the existing
//! * Executing the same command with the [`Runtime::Existing`] will fail because the existing
//! runtime, stored onchain in `substrate` binary that we compiled earlier does not have
//! `try-runtime` feature!
//!
Expand Down Expand Up @@ -328,7 +328,7 @@
//! This can still be customized at a given block with `--at`. If you want to use a snapshot, you
//! can still use `--block-ws-uri` to provide a node form which the block data can be fetched.
//!
//! Moreover, this runs the [`frame_support::try_runtime::TryState`] hooks as well. The hooks to run
//! Moreover, this runs the `frame_support::try_runtime::TryState` hooks as well. The hooks to run
//! can be customized with the `--try-state`. For example:
//!
//! ```bash
Expand Down Expand Up @@ -390,7 +390,7 @@ use sp_state_machine::{CompactProof, OverlayedChanges, StateMachine, TrieBackend
use sp_version::StateVersion;
use std::{fmt::Debug, path::PathBuf, str::FromStr};

mod commands;
pub mod commands;
pub(crate) mod parse;
pub(crate) const LOG_TARGET: &str = "try-runtime::cli";

Expand All @@ -403,7 +403,7 @@ pub enum Command {
/// only triggers all of the `on_runtime_upgrade` hooks in the runtime, and optionally
/// `try_state`.
///
/// See [`frame_try_runtime::TryRuntime`] and [`commands::execute_block::OnRuntimeUpgrade`] for
/// See [`frame_try_runtime::TryRuntime`] and [`commands::on_runtime_upgrade::OnRuntimeUpgradeCmd`] for
/// more information.
OnRuntimeUpgrade(commands::on_runtime_upgrade::OnRuntimeUpgradeCmd),

Expand All @@ -422,7 +422,7 @@ pub enum Command {
/// This executes the same runtime api as normal block import, namely
/// `OffchainWorkerApi_offchain_worker`.
///
/// See [`frame_try_runtime::TryRuntime`] and [`commands::execute_block::OffchainWorkerCmd`]
/// See [`frame_try_runtime::TryRuntime`] and [`commands::offchain_worker::OffchainWorkerCmd`]
/// for more information.
OffchainWorker(commands::offchain_worker::OffchainWorkerCmd),

Expand Down Expand Up @@ -450,7 +450,7 @@ pub enum Command {
}

#[derive(Debug, Clone)]
enum Runtime {
pub enum Runtime {
/// Use the given path to the wasm binary file.
///
/// It must have been compiled with `try-runtime`.
Expand Down Expand Up @@ -484,7 +484,7 @@ pub struct SharedParams {
/// go away.
#[allow(missing_docs)]
#[clap(flatten)]
shared_params: sc_cli::SharedParams,
pub shared_params: sc_cli::SharedParams,

/// The runtime to use.
///
Expand All @@ -495,7 +495,7 @@ pub struct SharedParams {
/// against a remote node, as no (sane) blockchain should compile its onchain wasm with
/// `try-runtime` feature.
#[arg(long)]
runtime: Runtime,
pub runtime: Runtime,

/// Type of wasm execution used.
#[arg(
Expand All @@ -505,7 +505,7 @@ pub struct SharedParams {
ignore_case = true,
default_value_t = DEFAULT_WASM_EXECUTION_METHOD,
)]
wasm_method: WasmExecutionMethod,
pub wasm_method: WasmExecutionMethod,

/// The WASM instantiation method to use.
///
Expand All @@ -516,18 +516,18 @@ pub struct SharedParams {
default_value_t = DEFAULT_WASMTIME_INSTANTIATION_STRATEGY,
value_enum,
)]
wasmtime_instantiation_strategy: WasmtimeInstantiationStrategy,
pub wasmtime_instantiation_strategy: WasmtimeInstantiationStrategy,

/// The number of 64KB pages to allocate for Wasm execution. Defaults to
/// [`sc_service::Configuration.default_heap_pages`].
#[arg(long)]
heap_pages: Option<u64>,
pub heap_pages: Option<u64>,

/// Overwrite the `state_version`.
///
/// Otherwise `remote-externalities` will automatically set the correct state version.
#[arg(long, value_parser = parse::state_version)]
overwrite_state_version: Option<StateVersion>,
pub overwrite_state_version: Option<StateVersion>,
}

/// Our `try-runtime` command.
Expand Down

0 comments on commit a35bca9

Please sign in to comment.