Add inspect command to take a look at extrinsics. (#762)

* Add inspect command to take a look at extrinsics.

* cargo fmt --all

* New weight for on-chain remark in tests

* Minor style tweaks.

Co-authored-by: adoerr <0xad@gmx.net>
This commit is contained in:
Tomasz Drwięga
2021-02-25 06:21:39 +01:00
committed by Bastian Köcher
parent 4a1a990fa6
commit c3d651d29a
7 changed files with 28 additions and 12 deletions
+3 -2
View File
@@ -26,6 +26,7 @@ pallet-message-lane-rpc = { path = "../../../modules/message-lane/rpc" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master" } frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
node-inspect = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-basic-authorship = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master", features = ["wasmtime"] } sc-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master", features = ["wasmtime"] }
sc-client-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-client-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
@@ -35,14 +36,14 @@ sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "m
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" } substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
+5 -2
View File
@@ -31,6 +31,7 @@ pub struct Cli {
pub enum Subcommand { pub enum Subcommand {
/// Key management cli utilities /// Key management cli utilities
Key(sc_cli::KeySubcommand), Key(sc_cli::KeySubcommand),
/// Verify a signature for a message, provided on STDIN, with a given (public or secret) key. /// Verify a signature for a message, provided on STDIN, with a given (public or secret) key.
Verify(sc_cli::VerifyCmd), Verify(sc_cli::VerifyCmd),
@@ -61,7 +62,9 @@ pub enum Subcommand {
/// Revert the chain to a previous state. /// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd), Revert(sc_cli::RevertCmd),
/// The custom benchmark subcommmand benchmarking runtime pallets. /// Inspect blocks or extrinsics.
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] Inspect(node_inspect::cli::InspectCmd),
/// Benchmark runtime pallets.
Benchmark(frame_benchmarking_cli::BenchmarkCmd), Benchmark(frame_benchmarking_cli::BenchmarkCmd),
} }
+5 -1
View File
@@ -17,7 +17,7 @@
use crate::cli::{Cli, Subcommand}; use crate::cli::{Cli, Subcommand};
use crate::service; use crate::service;
use crate::service::new_partial; use crate::service::new_partial;
use millau_runtime::Block; use millau_runtime::{Block, RuntimeApi};
use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli}; use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents; use sc_service::PartialComponents;
@@ -154,6 +154,10 @@ pub fn run() -> sc_cli::Result<()> {
Ok((cmd.run(client, backend), task_manager)) Ok((cmd.run(client, backend), task_manager))
}) })
} }
Some(Subcommand::Inspect(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, service::Executor>(config))
}
None => { None => {
let runner = cli.create_runner(&cli.run)?; let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move { runner.run_node_until_exit(|config| async move {
+4 -3
View File
@@ -26,6 +26,7 @@ rialto-runtime = { path = "../runtime" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master" } frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
node-inspect = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-basic-authorship = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master", features = ["wasmtime"] } sc-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master", features = ["wasmtime"] }
sc-client-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-client-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
@@ -35,15 +36,15 @@ sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "m
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" } substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
+5 -2
View File
@@ -31,6 +31,7 @@ pub struct Cli {
pub enum Subcommand { pub enum Subcommand {
/// Key management cli utilities /// Key management cli utilities
Key(sc_cli::KeySubcommand), Key(sc_cli::KeySubcommand),
/// Verify a signature for a message, provided on STDIN, with a given (public or secret) key. /// Verify a signature for a message, provided on STDIN, with a given (public or secret) key.
Verify(sc_cli::VerifyCmd), Verify(sc_cli::VerifyCmd),
@@ -61,7 +62,9 @@ pub enum Subcommand {
/// Revert the chain to a previous state. /// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd), Revert(sc_cli::RevertCmd),
/// The custom benchmark subcommmand benchmarking runtime pallets. /// Inspect blocks or extrinsics.
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] Inspect(node_inspect::cli::InspectCmd),
/// Benchmark runtime pallets.
Benchmark(frame_benchmarking_cli::BenchmarkCmd), Benchmark(frame_benchmarking_cli::BenchmarkCmd),
} }
+5 -1
View File
@@ -17,7 +17,7 @@
use crate::cli::{Cli, Subcommand}; use crate::cli::{Cli, Subcommand};
use crate::service; use crate::service;
use crate::service::new_partial; use crate::service::new_partial;
use rialto_runtime::Block; use rialto_runtime::{Block, RuntimeApi};
use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli}; use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents; use sc_service::PartialComponents;
@@ -153,6 +153,10 @@ pub fn run() -> sc_cli::Result<()> {
Ok((cmd.run(client, backend), task_manager)) Ok((cmd.run(client, backend), task_manager))
}) })
} }
Some(Subcommand::Inspect(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, service::Executor>(config))
}
None => { None => {
let runner = cli.create_runner(&cli.run)?; let runner = cli.create_runner(&cli.run)?;
runner runner
+1 -1
View File
@@ -606,7 +606,7 @@ mod tests {
vec![EventRecord { vec![EventRecord {
phase: Phase::Initialization, phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch( event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
bridge, id, 1973000, 0, bridge, id, 1279000, 0,
)), )),
topics: vec![], topics: vec![],
}], }],