Run cargo fmt on the whole code base (#9394)

* Run cargo fmt on the whole code base

* Second run

* Add CI check

* Fix compilation

* More unnecessary braces

* Handle weights

* Use --all

* Use correct attributes...

* Fix UI tests

* AHHHHHHHHH

* 🤦

* Docs

* Fix compilation

* 🤷

* Please stop

* 🤦 x 2

* More

* make rustfmt.toml consistent with polkadot

Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
Bastian Köcher
2021-07-21 16:32:32 +02:00
committed by GitHub
parent d451c38c1c
commit 7b56ab15b4
1010 changed files with 53339 additions and 51208 deletions
+10 -10
View File
@@ -32,33 +32,33 @@ pub type FutureResult<T> = Box<dyn rpc::futures::Future<Item = T, Error = Error>
#[derive(Debug, derive_more::Display, derive_more::From)]
pub enum Error {
/// Client error.
#[display(fmt="Client error: {}", _0)]
#[display(fmt = "Client error: {}", _0)]
#[from(ignore)]
Client(Box<dyn std::error::Error + Send>),
/// Transaction pool error,
#[display(fmt="Transaction pool error: {}", _0)]
#[display(fmt = "Transaction pool error: {}", _0)]
Pool(sc_transaction_pool_api::error::Error),
/// Verification error
#[display(fmt="Extrinsic verification error: {}", _0)]
#[display(fmt = "Extrinsic verification error: {}", _0)]
#[from(ignore)]
Verification(Box<dyn std::error::Error + Send>),
/// Incorrect extrinsic format.
#[display(fmt="Invalid extrinsic format: {}", _0)]
#[display(fmt = "Invalid extrinsic format: {}", _0)]
BadFormat(codec::Error),
/// Incorrect seed phrase.
#[display(fmt="Invalid seed phrase/SURI")]
#[display(fmt = "Invalid seed phrase/SURI")]
BadSeedPhrase,
/// Key type ID has an unknown format.
#[display(fmt="Invalid key type ID format (should be of length four)")]
#[display(fmt = "Invalid key type ID format (should be of length four)")]
BadKeyType,
/// Key type ID has some unsupported crypto.
#[display(fmt="The crypto of key type ID is unknown")]
#[display(fmt = "The crypto of key type ID is unknown")]
UnsupportedKeyType,
/// Some random issue with the key store. Shouldn't happen.
#[display(fmt="The key store is unavailable")]
#[display(fmt = "The key store is unavailable")]
KeyStoreUnavailable,
/// Invalid session keys encoding.
#[display(fmt="Session keys are not encoded correctly")]
#[display(fmt = "Session keys are not encoded correctly")]
InvalidSessionKeys,
/// Call to an unsafe RPC was denied.
UnsafeRpcCalled(crate::policy::UnsafeRpcError),
@@ -105,7 +105,7 @@ const POOL_UNACTIONABLE: i64 = POOL_INVALID_TX + 8;
impl From<Error> for rpc::Error {
fn from(e: Error) -> Self {
use sc_transaction_pool_api::error::{Error as PoolError};
use sc_transaction_pool_api::error::Error as PoolError;
match e {
Error::BadFormat(e) => rpc::Error {
+1 -1
View File
@@ -18,8 +18,8 @@
//! Extrinsic helpers for author RPC module.
use serde::{Deserialize, Serialize};
use sp_core::Bytes;
use serde::{Serialize, Deserialize};
/// RPC Extrinsic or hash
///
+12 -14
View File
@@ -21,11 +21,11 @@
pub mod error;
pub mod hash;
use self::error::{FutureResult, Result};
use jsonrpc_derive::rpc;
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use sp_core::Bytes;
use sc_transaction_pool_api::TransactionStatus;
use self::error::{FutureResult, Result};
use sp_core::Bytes;
pub use self::gen_client::Client as AuthorClient;
@@ -41,12 +41,7 @@ pub trait AuthorApi<Hash, BlockHash> {
/// Insert a key into the keystore.
#[rpc(name = "author_insertKey")]
fn insert_key(
&self,
key_type: String,
suri: String,
public: Bytes,
) -> Result<()>;
fn insert_key(&self, key_type: String, suri: String, public: Bytes) -> Result<()>;
/// Generate new session keys and returns the corresponding public keys.
#[rpc(name = "author_rotateKeys")]
@@ -72,8 +67,9 @@ pub trait AuthorApi<Hash, BlockHash> {
/// Remove given extrinsic from the pool and temporarily ban it to prevent reimporting.
#[rpc(name = "author_removeExtrinsic")]
fn remove_extrinsic(&self,
bytes_or_hash: Vec<hash::ExtrinsicOrHash<Hash>>
fn remove_extrinsic(
&self,
bytes_or_hash: Vec<hash::ExtrinsicOrHash<Hash>>,
) -> Result<Vec<Hash>>;
/// Submit an extrinsic to watch.
@@ -85,10 +81,11 @@ pub trait AuthorApi<Hash, BlockHash> {
subscribe,
name = "author_submitAndWatchExtrinsic"
)]
fn watch_extrinsic(&self,
fn watch_extrinsic(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<TransactionStatus<Hash, BlockHash>>,
bytes: Bytes
bytes: Bytes,
);
/// Unsubscribe from extrinsic watching.
@@ -97,8 +94,9 @@ pub trait AuthorApi<Hash, BlockHash> {
unsubscribe,
name = "author_unwatchExtrinsic"
)]
fn unwatch_extrinsic(&self,
fn unwatch_extrinsic(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
id: SubscriptionId,
) -> Result<bool>;
}
+1 -1
View File
@@ -31,7 +31,7 @@ pub type FutureResult<T> = Box<dyn rpc::futures::Future<Item = T, Error = Error>
#[derive(Debug, derive_more::Display, derive_more::From)]
pub enum Error {
/// Client error.
#[display(fmt="Client error: {}", _0)]
#[display(fmt = "Client error: {}", _0)]
Client(Box<dyn std::error::Error + Send>),
/// Other error type.
Other(String),
+2 -2
View File
@@ -20,11 +20,11 @@
pub mod error;
use self::error::{FutureResult, Result};
use jsonrpc_core::Result as RpcResult;
use jsonrpc_derive::rpc;
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use sp_rpc::{number::NumberOrHex, list::ListOrValue};
use self::error::{FutureResult, Result};
use sp_rpc::{list::ListOrValue, number::NumberOrHex};
pub use self::gen_client::Client as ChainClient;
@@ -18,9 +18,9 @@
//! Substrate state API.
use jsonrpc_derive::rpc;
use sp_core::storage::{StorageKey, PrefixedStorageKey, StorageData};
use crate::state::error::FutureResult;
use jsonrpc_derive::rpc;
use sp_core::storage::{PrefixedStorageKey, StorageData, StorageKey};
pub use self::gen_client::Client as ChildStateClient;
use crate::state::ReadProof;
@@ -41,7 +41,7 @@ pub trait ChildStateApi<Hash> {
&self,
child_storage_key: PrefixedStorageKey,
prefix: StorageKey,
hash: Option<Hash>
hash: Option<Hash>,
) -> FutureResult<Vec<StorageKey>>;
/// Returns the keys with prefix from a child storage with pagination support.
@@ -63,7 +63,7 @@ pub trait ChildStateApi<Hash> {
&self,
child_storage_key: PrefixedStorageKey,
key: StorageKey,
hash: Option<Hash>
hash: Option<Hash>,
) -> FutureResult<Option<StorageData>>;
/// Returns the hash of a child storage entry at a block's state.
@@ -72,7 +72,7 @@ pub trait ChildStateApi<Hash> {
&self,
child_storage_key: PrefixedStorageKey,
key: StorageKey,
hash: Option<Hash>
hash: Option<Hash>,
) -> FutureResult<Option<Hash>>;
/// Returns the size of a child storage entry at a block's state.
@@ -81,7 +81,7 @@ pub trait ChildStateApi<Hash> {
&self,
child_storage_key: PrefixedStorageKey,
key: StorageKey,
hash: Option<Hash>
hash: Option<Hash>,
) -> FutureResult<Option<u64>>;
/// Returns proof of storage for child key entries at a specific block's state.
+1 -1
View File
@@ -16,8 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use jsonrpc_core::futures::prelude::*;
use futures::{channel::oneshot, compat::Compat};
use jsonrpc_core::futures::prelude::*;
/// Wraps around `oneshot::Receiver` and adjusts the error type to produce an internal error if the
/// sender gets dropped.
+1 -1
View File
@@ -34,7 +34,7 @@ pub use policy::DenyUnsafe;
pub mod author;
pub mod chain;
pub mod child_state;
pub mod offchain;
pub mod state;
pub mod child_state;
pub mod system;
+2 -4
View File
@@ -20,7 +20,7 @@
use std::sync::Arc;
use jsonrpc_core::futures::sync::mpsc;
use jsonrpc_pubsub::{Session, PubSubMetadata};
use jsonrpc_pubsub::{PubSubMetadata, Session};
/// RPC Metadata.
///
@@ -42,9 +42,7 @@ impl PubSubMetadata for Metadata {
impl Metadata {
/// Create new `Metadata` with session (Pub/Sub) support.
pub fn new(transport: mpsc::Sender<String>) -> Self {
Metadata {
session: Some(Arc::new(Session::new(transport))),
}
Metadata { session: Some(Arc::new(Session::new(transport))) }
}
/// Create new `Metadata` for tests.
@@ -27,7 +27,7 @@ pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, derive_more::Display, derive_more::From)]
pub enum Error {
/// Unavailable storage kind error.
#[display(fmt="This storage kind is not available yet.")]
#[display(fmt = "This storage kind is not available yet.")]
UnavailableStorageKind,
/// Call to an unsafe RPC was denied.
UnsafeRpcCalled(crate::policy::UnsafeRpcError),
@@ -50,7 +50,7 @@ impl From<Error> for rpc::Error {
match e {
Error::UnavailableStorageKind => rpc::Error {
code: rpc::ErrorCode::ServerError(BASE_ERROR + 1),
message: "This storage kind is not available yet" .into(),
message: "This storage kind is not available yet".into(),
data: None,
},
Error::UnsafeRpcCalled(e) => e.into(),
+2 -2
View File
@@ -20,9 +20,9 @@
pub mod error;
use jsonrpc_derive::rpc;
use self::error::Result;
use sp_core::{Bytes, offchain::StorageKind};
use jsonrpc_derive::rpc;
use sp_core::{offchain::StorageKind, Bytes};
pub use self::gen_client::Client as OffchainClient;
+1 -1
View File
@@ -31,7 +31,7 @@ pub type FutureResult<T> = Box<dyn rpc::futures::Future<Item = T, Error = Error>
#[derive(Debug, derive_more::Display, derive_more::From)]
pub enum Error {
/// Client error.
#[display(fmt="Client error: {}", _0)]
#[display(fmt = "Client error: {}", _0)]
Client(Box<dyn std::error::Error + Send>),
/// Provided block range couldn't be resolved to a list of blocks.
#[display(fmt = "Cannot resolve a block range ['{:?}' ... '{:?}]. {}", from, to, details)]
@@ -18,8 +18,8 @@
//! Substrate state API helpers.
use serde::{Deserialize, Serialize};
use sp_core::Bytes;
use serde::{Serialize, Deserialize};
/// ReadProof struct returned by the RPC
#[derive(Debug, PartialEq, Serialize, Deserialize)]
+64 -40
View File
@@ -21,16 +21,17 @@
pub mod error;
pub mod helpers;
use self::error::FutureResult;
use jsonrpc_core::Result as RpcResult;
use jsonrpc_derive::rpc;
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use sp_core::Bytes;
use sp_core::storage::{StorageKey, StorageData, StorageChangeSet};
use sp_core::{
storage::{StorageChangeSet, StorageData, StorageKey},
Bytes,
};
use sp_version::RuntimeVersion;
use self::error::FutureResult;
pub use self::gen_client::Client as StateClient;
pub use self::helpers::ReadProof;
pub use self::{gen_client::Client as StateClient, helpers::ReadProof};
/// Substrate state API
#[rpc]
@@ -45,11 +46,16 @@ pub trait StateApi<Hash> {
/// DEPRECATED: Please use `state_getKeysPaged` with proper paging support.
/// Returns the keys with prefix, leave empty to get all the keys.
#[rpc(name = "state_getKeys")]
fn storage_keys(&self, prefix: StorageKey, hash: Option<Hash>) -> FutureResult<Vec<StorageKey>>;
fn storage_keys(&self, prefix: StorageKey, hash: Option<Hash>)
-> FutureResult<Vec<StorageKey>>;
/// Returns the keys with prefix, leave empty to get all the keys
#[rpc(name = "state_getPairs")]
fn storage_pairs(&self, prefix: StorageKey, hash: Option<Hash>) -> FutureResult<Vec<(StorageKey, StorageData)>>;
fn storage_pairs(
&self,
prefix: StorageKey,
hash: Option<Hash>,
) -> FutureResult<Vec<(StorageKey, StorageData)>>;
/// Returns the keys with prefix with pagination support.
/// Up to `count` keys will be returned.
@@ -92,7 +98,7 @@ pub trait StateApi<Hash> {
&self,
keys: Vec<StorageKey>,
block: Hash,
hash: Option<Hash>
hash: Option<Hash>,
) -> FutureResult<Vec<StorageChangeSet<Hash>>>;
/// Query storage entries (by key) starting at block hash given as the second parameter.
@@ -105,7 +111,11 @@ pub trait StateApi<Hash> {
/// Returns proof of storage entries at a specific block's state.
#[rpc(name = "state_getReadProof")]
fn read_proof(&self, keys: Vec<StorageKey>, hash: Option<Hash>) -> FutureResult<ReadProof<Hash>>;
fn read_proof(
&self,
keys: Vec<StorageKey>,
hash: Option<Hash>,
) -> FutureResult<ReadProof<Hash>>;
/// New runtime version subscription
#[pubsub(
@@ -114,7 +124,11 @@ pub trait StateApi<Hash> {
name = "state_subscribeRuntimeVersion",
alias("chain_subscribeRuntimeVersion")
)]
fn subscribe_runtime_version(&self, metadata: Self::Metadata, subscriber: Subscriber<RuntimeVersion>);
fn subscribe_runtime_version(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<RuntimeVersion>,
);
/// Unsubscribe from runtime version subscription
#[pubsub(
@@ -123,18 +137,27 @@ pub trait StateApi<Hash> {
name = "state_unsubscribeRuntimeVersion",
alias("chain_unsubscribeRuntimeVersion")
)]
fn unsubscribe_runtime_version(&self, metadata: Option<Self::Metadata>, id: SubscriptionId) -> RpcResult<bool>;
fn unsubscribe_runtime_version(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId,
) -> RpcResult<bool>;
/// New storage subscription
#[pubsub(subscription = "state_storage", subscribe, name = "state_subscribeStorage")]
fn subscribe_storage(
&self, metadata: Self::Metadata, subscriber: Subscriber<StorageChangeSet<Hash>>, keys: Option<Vec<StorageKey>>
&self,
metadata: Self::Metadata,
subscriber: Subscriber<StorageChangeSet<Hash>>,
keys: Option<Vec<StorageKey>>,
);
/// Unsubscribe from storage subscription
#[pubsub(subscription = "state_storage", unsubscribe, name = "state_unsubscribeStorage")]
fn unsubscribe_storage(
&self, metadata: Option<Self::Metadata>, id: SubscriptionId
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId,
) -> RpcResult<bool>;
/// The `state_traceBlock` RPC provides a way to trace the re-execution of a single
@@ -174,7 +197,7 @@ pub trait StateApi<Hash> {
/// renamed/modified however you like, as long as it retains the `.wasm` extension.
/// - Run the node with the wasm blob overrides by placing them in a folder with all your runtimes,
/// and passing the path of this folder to your chain, e.g.:
/// - `./target/release/polkadot --wasm-runtime-overrides /home/user/my-custom-wasm-runtimes`
/// - `./target/release/polkadot --wasm-runtime-overrides /home/user/my-custom-wasm-runtimes`
///
/// You can also find some pre-built tracing enabled wasm runtimes in [substrate-archive][2]
///
@@ -199,7 +222,7 @@ pub trait StateApi<Hash> {
/// curl \
/// -H "Content-Type: application/json" \
/// -d '{"id":1, "jsonrpc":"2.0", "method": "state_traceBlock", \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264"]}' \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264"]}' \
/// http://localhost:9933/
/// ```
///
@@ -207,33 +230,34 @@ pub trait StateApi<Hash> {
///
/// - `block_hash` (param index 0): Hash of the block to trace.
/// - `targets` (param index 1): String of comma separated (no spaces) targets. Specified
/// targets match with trace targets by prefix (i.e if a target is in the beginning
/// of a trace target it is considered a match). If an empty string is specified no
/// targets will be filtered out. The majority of targets correspond to Rust module names,
/// and the ones that do not are typically "hardcoded" into span or event location
/// somewhere in the Substrate source code. ("Non-hardcoded" targets typically come from frame
/// support macros.)
/// targets match with trace targets by prefix (i.e if a target is in the beginning
/// of a trace target it is considered a match). If an empty string is specified no
/// targets will be filtered out. The majority of targets correspond to Rust module names,
/// and the ones that do not are typically "hardcoded" into span or event location
/// somewhere in the Substrate source code. ("Non-hardcoded" targets typically come from frame
/// support macros.)
/// - `storage_keys` (param index 2): String of comma separated (no spaces) hex encoded
/// (no `0x` prefix) storage keys. If an empty string is specified no events will
/// be filtered out. If anything other than an empty string is specified, events
/// will be filtered by storage key (so non-storage events will **not** show up).
/// You can specify any length of a storage key prefix (i.e. if a specified storage
/// key is in the beginning of an events storage key it is considered a match).
/// Example: for balance tracking on Polkadot & Kusama you would likely want
/// to track changes to account balances with the frame_system::Account storage item,
/// which is a map from `AccountId` to `AccountInfo`. The key filter for this would be
/// the storage prefix for the map:
/// `26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9`
/// Additionally you would want to track the extrinsic index, which is under the
/// `:extrinsic_index` key. The key for this would be the aforementioned string as bytes
/// in hex: `3a65787472696e7369635f696e646578`.
/// The following are some resources to learn more about storage keys in substrate:
/// [substrate storage][1], [transparent keys in substrate][2],
/// [querying substrate storage via rpc][3].
/// (no `0x` prefix) storage keys. If an empty string is specified no events will
/// be filtered out. If anything other than an empty string is specified, events
/// will be filtered by storage key (so non-storage events will **not** show up).
/// You can specify any length of a storage key prefix (i.e. if a specified storage
/// key is in the beginning of an events storage key it is considered a match).
/// Example: for balance tracking on Polkadot & Kusama you would likely want
/// to track changes to account balances with the frame_system::Account storage item,
/// which is a map from `AccountId` to `AccountInfo`. The key filter for this would be
/// the storage prefix for the map:
/// `26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9`
///
/// [1]: https://substrate.dev/docs/en/knowledgebase/advanced/storage#storage-map-key
/// [2]: https://www.shawntabrizi.com/substrate/transparent-keys-in-substrate/
/// [3]: https://www.shawntabrizi.com/substrate/querying-substrate-storage-via-rpc/
/// Additionally you would want to track the extrinsic index, which is under the
/// `:extrinsic_index` key. The key for this would be the aforementioned string as bytes
/// in hex: `3a65787472696e7369635f696e646578`.
/// The following are some resources to learn more about storage keys in substrate:
/// [substrate storage][1], [transparent keys in substrate][2],
/// [querying substrate storage via rpc][3].
///
/// [1]: https://substrate.dev/docs/en/knowledgebase/advanced/storage#storage-map-key
/// [2]: https://www.shawntabrizi.com/substrate/transparent-keys-in-substrate/
/// [3]: https://www.shawntabrizi.com/substrate/querying-substrate-storage-via-rpc/
///
/// ### Maximum payload size
///
+2 -2
View File
@@ -48,10 +48,10 @@ impl From<Error> for rpc::Error {
data: serde_json::to_value(h).ok(),
},
Error::MalformattedPeerArg(ref e) => rpc::Error {
code :rpc::ErrorCode::ServerError(BASE_ERROR + 2),
code: rpc::ErrorCode::ServerError(BASE_ERROR + 2),
message: e.clone(),
data: None,
}
},
}
}
}
+11 -9
View File
@@ -18,9 +18,9 @@
//! Substrate system API helpers.
use sc_chain_spec::{ChainType, Properties};
use serde::{Deserialize, Serialize};
use std::fmt;
use serde::{Serialize, Deserialize};
use sc_chain_spec::{Properties, ChainType};
/// Running node's static details.
#[derive(Clone, Debug)]
@@ -53,9 +53,7 @@ pub struct Health {
impl fmt::Display for Health {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{} peers ({})", self.peers, if self.is_syncing {
"syncing"
} else { "idle" })
write!(fmt, "{} peers ({})", self.peers, if self.is_syncing { "syncing" } else { "idle" })
}
}
@@ -107,7 +105,8 @@ mod tests {
peers: 1,
is_syncing: false,
should_have_peers: true,
}).unwrap(),
})
.unwrap(),
r#"{"peers":1,"isSyncing":false,"shouldHavePeers":true}"#,
);
}
@@ -120,7 +119,8 @@ mod tests {
roles: "a".into(),
best_hash: 5u32,
best_number: 6u32,
}).unwrap(),
})
.unwrap(),
r#"{"peerId":"2","roles":"a","bestHash":5,"bestNumber":6}"#,
);
}
@@ -132,7 +132,8 @@ mod tests {
starting_block: 12u32,
current_block: 50u32,
highest_block: Some(128u32),
}).unwrap(),
})
.unwrap(),
r#"{"startingBlock":12,"currentBlock":50,"highestBlock":128}"#,
);
@@ -141,7 +142,8 @@ mod tests {
starting_block: 12u32,
current_block: 50u32,
highest_block: None,
}).unwrap(),
})
.unwrap(),
r#"{"startingBlock":12,"currentBlock":50}"#,
);
}
+21 -15
View File
@@ -22,13 +22,15 @@ pub mod error;
pub mod helpers;
use crate::helpers::Receiver;
use futures::{compat::Compat, future::BoxFuture};
use jsonrpc_derive::rpc;
use futures::{future::BoxFuture, compat::Compat};
use self::error::Result as SystemResult;
pub use self::helpers::{SystemInfo, Health, PeerInfo, NodeRole, SyncState};
pub use self::gen_client::Client as SystemClient;
pub use self::{
gen_client::Client as SystemClient,
helpers::{Health, NodeRole, PeerInfo, SyncState, SystemInfo},
};
/// Substrate system RPC API
#[rpc]
@@ -74,8 +76,9 @@ pub trait SystemApi<Hash, Number> {
/// Returns currently connected peers
#[rpc(name = "system_peers", returns = "Vec<PeerInfo<Hash, Number>>")]
fn system_peers(&self)
-> Compat<BoxFuture<'static, jsonrpc_core::Result<Vec<PeerInfo<Hash, Number>>>>>;
fn system_peers(
&self,
) -> Compat<BoxFuture<'static, jsonrpc_core::Result<Vec<PeerInfo<Hash, Number>>>>>;
/// Returns current state of the network.
///
@@ -84,8 +87,9 @@ pub trait SystemApi<Hash, Number> {
// TODO: the future of this call is uncertain: https://github.com/paritytech/substrate/issues/1890
// https://github.com/paritytech/substrate/issues/5541
#[rpc(name = "system_unstable_networkState", returns = "jsonrpc_core::Value")]
fn system_network_state(&self)
-> Compat<BoxFuture<'static, jsonrpc_core::Result<jsonrpc_core::Value>>>;
fn system_network_state(
&self,
) -> Compat<BoxFuture<'static, jsonrpc_core::Result<jsonrpc_core::Value>>>;
/// Adds a reserved peer. Returns the empty string or an error. The string
/// parameter should encode a `p2p` multiaddr.
@@ -93,14 +97,18 @@ pub trait SystemApi<Hash, Number> {
/// `/ip4/198.51.100.19/tcp/30333/p2p/QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV`
/// is an example of a valid, passing multiaddr with PeerId attached.
#[rpc(name = "system_addReservedPeer", returns = "()")]
fn system_add_reserved_peer(&self, peer: String)
-> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
fn system_add_reserved_peer(
&self,
peer: String,
) -> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
/// Remove a reserved peer. Returns the empty string or an error. The string
/// should encode only the PeerId e.g. `QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV`.
#[rpc(name = "system_removeReservedPeer", returns = "()")]
fn system_remove_reserved_peer(&self, peer_id: String)
-> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
fn system_remove_reserved_peer(
&self,
peer_id: String,
) -> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
/// Returns the list of reserved peers
#[rpc(name = "system_reservedPeers", returns = "Vec<String>")]
@@ -121,11 +129,9 @@ pub trait SystemApi<Hash, Number> {
///
/// `sync=debug,state=trace`
#[rpc(name = "system_addLogFilter", returns = "()")]
fn system_add_log_filter(&self, directives: String)
-> Result<(), jsonrpc_core::Error>;
fn system_add_log_filter(&self, directives: String) -> Result<(), jsonrpc_core::Error>;
/// Resets the log filter to Substrate defaults
#[rpc(name = "system_resetLogFilter", returns = "()")]
fn system_reset_log_filter(&self)
-> Result<(), jsonrpc_core::Error>;
fn system_reset_log_filter(&self) -> Result<(), jsonrpc_core::Error>;
}