From 6589433043b9f03abe38688269286fffd164f3c5 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Thu, 16 Sep 2021 16:32:43 +0200 Subject: [PATCH] show the new API --- Cargo.lock | 32 +++++++------- bin/node-template/node/Cargo.toml | 2 +- bin/node/cli/Cargo.toml | 2 +- bin/node/rpc-client/Cargo.toml | 2 +- client/consensus/babe/rpc/Cargo.toml | 2 +- client/consensus/babe/rpc/src/lib.rs | 12 +++--- client/consensus/manual-seal/Cargo.toml | 2 +- client/consensus/manual-seal/src/rpc.rs | 10 ++--- client/finality-grandpa/rpc/Cargo.toml | 2 +- client/finality-grandpa/rpc/src/lib.rs | 14 +++---- client/rpc-api/Cargo.toml | 2 +- client/rpc-api/src/author/mod.rs | 18 ++++---- client/rpc-api/src/chain/mod.rs | 16 +++---- client/rpc-api/src/child_state/mod.rs | 16 +++---- client/rpc-api/src/offchain/mod.rs | 6 +-- client/rpc-api/src/state/mod.rs | 41 +++++++----------- client/rpc-api/src/system/mod.rs | 36 ++++++++-------- client/rpc-servers/Cargo.toml | 2 +- client/rpc-servers/src/lib.rs | 17 ++++---- client/rpc/Cargo.toml | 2 +- client/rpc/src/author/mod.rs | 28 ++++++------- client/rpc/src/chain/mod.rs | 18 ++++---- client/rpc/src/offchain/mod.rs | 16 +++---- client/rpc/src/state/mod.rs | 46 ++++++++++----------- client/rpc/src/system/mod.rs | 36 ++++++++-------- client/service/Cargo.toml | 2 +- client/sync-state-rpc/Cargo.toml | 2 +- client/sync-state-rpc/src/lib.rs | 6 +-- frame/contracts/rpc/Cargo.toml | 2 +- frame/contracts/rpc/src/lib.rs | 14 +++---- frame/merkle-mountain-range/rpc/Cargo.toml | 2 +- frame/merkle-mountain-range/rpc/src/lib.rs | 6 +-- frame/transaction-payment/rpc/Cargo.toml | 2 +- frame/transaction-payment/rpc/src/lib.rs | 10 ++--- test-utils/test-runner/Cargo.toml | 2 +- utils/frame/remote-externalities/Cargo.toml | 6 +-- utils/frame/rpc/support/Cargo.toml | 2 +- utils/frame/rpc/system/Cargo.toml | 2 +- utils/frame/rpc/system/src/lib.rs | 10 ++--- 39 files changed, 220 insertions(+), 228 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b01481eaaa72..ae42ef159c637 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2781,28 +2781,28 @@ dependencies = [ [[package]] name = "jsonrpsee" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "jsonrpsee-http-client", "jsonrpsee-http-server", - "jsonrpsee-proc-macros 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", - "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", + "jsonrpsee-proc-macros 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", + "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", "jsonrpsee-utils", - "jsonrpsee-ws-client 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", + "jsonrpsee-ws-client 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", "jsonrpsee-ws-server", ] [[package]] name = "jsonrpsee-http-client" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "async-trait", "fnv", "futures 0.3.16", "hyper", "hyper-rustls", - "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", + "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", "jsonrpsee-utils", "log", "serde", @@ -2815,13 +2815,13 @@ dependencies = [ [[package]] name = "jsonrpsee-http-server" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "futures-channel", "futures-util", "globset", "hyper", - "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", + "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", "jsonrpsee-utils", "lazy_static", "log", @@ -2850,7 +2850,7 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "Inflector", "bae", @@ -2882,7 +2882,7 @@ dependencies = [ [[package]] name = "jsonrpsee-types" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "anyhow", "async-trait", @@ -2900,13 +2900,13 @@ dependencies = [ [[package]] name = "jsonrpsee-utils" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "beef", "futures-channel", "futures-util", "hyper", - "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", + "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", "log", "parking_lot 0.11.1", "rand 0.8.4", @@ -2943,12 +2943,12 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "async-trait", "fnv", "futures 0.3.16", - "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", + "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", "log", "pin-project 1.0.5", "rustls", @@ -2966,11 +2966,11 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-server" version = "0.3.0" -source = "git+https://github.com/paritytech/jsonrpsee?branch=master#c13f97ba8bb5a5862dd0372053f5d9aa56531c3b" +source = "git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder#2d813b4ba5011a132b8283dcc1445d0533f92088" dependencies = [ "futures-channel", "futures-util", - "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=master)", + "jsonrpsee-types 0.3.0 (git+https://github.com/paritytech/jsonrpsee?branch=na-http-server-unify-acl-builder)", "jsonrpsee-utils", "log", "rustc-hash", diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml index 796c20c9576ed..15260c1e93c9c 100644 --- a/bin/node-template/node/Cargo.toml +++ b/bin/node-template/node/Cargo.toml @@ -38,7 +38,7 @@ sp-runtime = { version = "4.0.0-dev", path = "../../../primitives/runtime" } sp-timestamp = { version = "4.0.0-dev", path = "../../../primitives/timestamp" } # These dependencies are used for the node template's RPCs -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } sc-rpc = { version = "4.0.0-dev", path = "../../../client/rpc" } sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" } sc-rpc-api = { version = "0.10.0-dev", path = "../../../client/rpc-api" } diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 171f9542785f7..538f15fd7c2a8 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -34,7 +34,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] # third-party dependencies -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } serde = { version = "1.0.126", features = ["derive"] } futures = "0.3.16" hex-literal = "0.3.1" diff --git a/bin/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml index e368e812c183e..2c85222865487 100644 --- a/bin/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -12,7 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.16" -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["client", "macros"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["client", "macros"] } tokio = { version = "1.10", features = ["full"] } node-primitives = { version = "2.0.0", path = "../primitives" } sp-tracing = { version = "4.0.0-dev", path = "../../../primitives/tracing" } diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index 10bed97fe34bd..9a55f6df973be 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } sc-consensus-babe = { version = "0.10.0-dev", path = "../" } sc-rpc-api = { version = "0.10.0-dev", path = "../../../rpc-api" } sp-consensus-babe = { version = "0.10.0-dev", path = "../../../../primitives/consensus/babe" } diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index 0baab0dbf212a..71a000186e114 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -21,7 +21,7 @@ use futures::TryFutureExt; use jsonrpsee::{ proc_macros::rpc, - types::{async_trait, Error as JsonRpseeError, JsonRpcResult}, + types::{async_trait, Error as JsonRpseeError, RpcResult}, }; use sc_consensus_babe::{authorship, Config, Epoch}; @@ -44,7 +44,7 @@ pub trait BabeApi { /// Returns data about which slots (primary or secondary) can be claimed in the current epoch /// with the keys in the keystore. #[method(name = "epochAuthorship")] - async fn epoch_authorship(&self) -> JsonRpcResult>; + async fn epoch_authorship(&self) -> RpcResult>; } /// Provides RPC methods for interacting with Babe. @@ -88,7 +88,7 @@ where C::Api: BabeRuntimeApi, SC: SelectChain + Clone + 'static, { - async fn epoch_authorship(&self) -> JsonRpcResult> { + async fn epoch_authorship(&self) -> RpcResult> { self.deny_unsafe.check_if_safe()?; let header = self.select_chain.best_chain().map_err(Error::Consensus).await?; let epoch_start = self @@ -133,13 +133,13 @@ where match claim { PreDigest::Primary { .. } => { claims.entry(key).or_default().primary.push(slot); - }, + } PreDigest::SecondaryPlain { .. } => { claims.entry(key).or_default().secondary.push(slot); - }, + } PreDigest::SecondaryVRF { .. } => { claims.entry(key).or_default().secondary_vrf.push(slot.into()); - }, + } }; } } diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 86a3e1d12df1a..ee23ba0ded76f 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] derive_more = "0.99.2" futures = "0.3.9" -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } log = "0.4.8" codec = { package = "parity-scale-codec", version = "2.0.0" } serde = { version = "1.0", features = ["derive"] } diff --git a/client/consensus/manual-seal/src/rpc.rs b/client/consensus/manual-seal/src/rpc.rs index b5c7ca911e7e8..1e27ea99c1fcd 100644 --- a/client/consensus/manual-seal/src/rpc.rs +++ b/client/consensus/manual-seal/src/rpc.rs @@ -25,7 +25,7 @@ use futures::{ }; use jsonrpsee::{ proc_macros::rpc, - types::{async_trait, Error as JsonRpseeError, JsonRpcResult}, + types::{async_trait, Error as JsonRpseeError, RpcResult}, }; use sc_consensus::ImportedAux; use serde::{Deserialize, Serialize}; @@ -74,7 +74,7 @@ pub trait ManualSealApi { create_empty: bool, finalize: bool, parent_hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Instructs the manual-seal authorship task to finalize a block #[method(name = "finalizeBlock")] @@ -82,7 +82,7 @@ pub trait ManualSealApi { &self, hash: Hash, justification: Option, - ) -> JsonRpcResult; + ) -> RpcResult; } /// A struct that implements the [`ManualSealApi`]. @@ -113,7 +113,7 @@ impl ManualSealApiServer for ManualSeal { create_empty: bool, finalize: bool, parent_hash: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { let mut sink = self.import_block_channel.clone(); let (sender, receiver) = oneshot::channel(); // NOTE: this sends a Result over the channel. @@ -137,7 +137,7 @@ impl ManualSealApiServer for ManualSeal { &self, hash: Hash, justification: Option, - ) -> JsonRpcResult { + ) -> RpcResult { let mut sink = self.import_block_channel.clone(); let (sender, receiver) = oneshot::channel(); let command = EngineCommand::FinalizeBlock { hash, sender: Some(sender), justification }; diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index 96ff5d504eb8b..05329503ff9fd 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -15,7 +15,7 @@ sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" sp-core = { version = "4.0.0-dev", path = "../../../primitives/core" } sp-runtime = { version = "4.0.0-dev", path = "../../../primitives/runtime" } finality-grandpa = { version = "0.14.1", features = ["derive-codec"] } -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } futures = { version = "0.3.4", features = ["compat"] } serde = { version = "1.0.105", features = ["derive"] } serde_json = "1.0.50" diff --git a/client/finality-grandpa/rpc/src/lib.rs b/client/finality-grandpa/rpc/src/lib.rs index e942bcca4c4a1..6442343d2a7b7 100644 --- a/client/finality-grandpa/rpc/src/lib.rs +++ b/client/finality-grandpa/rpc/src/lib.rs @@ -25,7 +25,7 @@ use std::sync::Arc; use jsonrpsee::{ proc_macros::rpc, - types::{async_trait, error::Error as JsonRpseeError, JsonRpcResult}, + types::{async_trait, error::Error as JsonRpseeError, RpcResult}, SubscriptionSink, }; @@ -48,7 +48,7 @@ pub trait GrandpaApi { /// Returns the state of the current best round state as well as the /// ongoing background rounds. #[method(name = "roundState")] - async fn round_state(&self) -> JsonRpcResult; + async fn round_state(&self) -> RpcResult; /// Returns the block most recently finalized by Grandpa, alongside /// side its justification. @@ -57,12 +57,12 @@ pub trait GrandpaApi { aliases = "grandpa_justifications" item = Notification )] - fn subscribe_justifications(&self) -> JsonRpcResult<()>; + fn subscribe_justifications(&self) -> RpcResult<()>; /// Prove finality for the given block number by returning the Justification for the last block /// in the set and all the intermediary headers to link them together. #[method(name = "proveFinality")] - async fn prove_finality(&self, block: Number) -> JsonRpcResult>; + async fn prove_finality(&self, block: Number) -> RpcResult>; } /// Provides RPC methods for interacting with GRANDPA. @@ -98,12 +98,12 @@ where Block: BlockT, ProofProvider: RpcFinalityProofProvider + Send + Sync + 'static, { - async fn round_state(&self) -> JsonRpcResult { + async fn round_state(&self) -> RpcResult { ReportedRoundStates::from(&self.authority_set, &self.voter_state) .map_err(|e| JsonRpseeError::to_call_error(e)) } - fn subscribe_justifications(&self, mut sink: SubscriptionSink) -> JsonRpcResult<()> { + fn subscribe_justifications(&self, mut sink: SubscriptionSink) -> RpcResult<()> { let stream = self.justification_stream.subscribe().map( |x: sc_finality_grandpa::GrandpaJustification| { JustificationNotification::from(x) @@ -134,7 +134,7 @@ where async fn prove_finality( &self, block: NumberFor, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.finality_proof_provider .rpc_prove_finality(block) .map_err(|finality_err| error::Error::ProveFinalityFailed(finality_err)) diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index f5f83ebbe77a8..e4902577e21a5 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -26,7 +26,7 @@ sc-chain-spec = { path = "../chain-spec", version = "4.0.0-dev" } serde = { version = "1.0.126", features = ["derive"] } serde_json = "1.0.41" -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["full"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["full"] } sc-transaction-pool-api = { version = "4.0.0-dev", path = "../transaction-pool/api" } sp-rpc = { version = "4.0.0-dev", path = "../../primitives/rpc" } diff --git a/client/rpc-api/src/author/mod.rs b/client/rpc-api/src/author/mod.rs index e269311c72433..1084e54054368 100644 --- a/client/rpc-api/src/author/mod.rs +++ b/client/rpc-api/src/author/mod.rs @@ -18,7 +18,7 @@ //! Substrate block-author/full-node API. -use jsonrpsee::{proc_macros::rpc, types::JsonRpcResult}; +use jsonrpsee::{proc_macros::rpc, types::RpcResult}; use sc_transaction_pool_api::TransactionStatus; use sp_core::Bytes; @@ -30,15 +30,15 @@ pub mod hash; pub trait AuthorApi { /// Submit hex-encoded extrinsic for inclusion in block. #[method(name = "submitExtrinsic")] - async fn submit_extrinsic(&self, extrinsic: Bytes) -> JsonRpcResult; + async fn submit_extrinsic(&self, extrinsic: Bytes) -> RpcResult; /// Insert a key into the keystore. #[method(name = "insertKey")] - fn insert_key(&self, key_type: String, suri: String, public: Bytes) -> JsonRpcResult<()>; + fn insert_key(&self, key_type: String, suri: String, public: Bytes) -> RpcResult<()>; /// Generate new session keys and returns the corresponding public keys. #[method(name = "rotateKeys")] - fn rotate_keys(&self) -> JsonRpcResult; + fn rotate_keys(&self) -> RpcResult; /// Checks if the keystore has private keys for the given session public keys. /// @@ -46,24 +46,24 @@ pub trait AuthorApi { /// /// Returns `true` iff all private keys could be found. #[method(name = "hasSessionKeys")] - fn has_session_keys(&self, session_keys: Bytes) -> JsonRpcResult; + fn has_session_keys(&self, session_keys: Bytes) -> RpcResult; /// Checks if the keystore has private keys for the given public key and key type. /// /// Returns `true` if a private key could be found. #[method(name = "hasKey")] - fn has_key(&self, public_key: Bytes, key_type: String) -> JsonRpcResult; + fn has_key(&self, public_key: Bytes, key_type: String) -> RpcResult; /// Returns all pending extrinsics, potentially grouped by sender. #[method(name = "pendingExtrinsics")] - fn pending_extrinsics(&self) -> JsonRpcResult>; + fn pending_extrinsics(&self) -> RpcResult>; /// Remove given extrinsic from the pool and temporarily ban it to prevent reimporting. #[method(name = "removeExtrinsic")] fn remove_extrinsic( &self, bytes_or_hash: Vec>, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Submit an extrinsic to watch. /// @@ -75,5 +75,5 @@ pub trait AuthorApi { unsubscribe_aliases = "author_unwatchExtrinsic", item = TransactionStatus )] - fn watch_extrinsic(&self, bytes: Bytes) -> JsonRpcResult<()>; + fn watch_extrinsic(&self, bytes: Bytes) -> RpcResult<()>; } diff --git a/client/rpc-api/src/chain/mod.rs b/client/rpc-api/src/chain/mod.rs index e98b3ff5118d0..dcbb1d216c76e 100644 --- a/client/rpc-api/src/chain/mod.rs +++ b/client/rpc-api/src/chain/mod.rs @@ -18,7 +18,7 @@ //! Substrate blockchain API. -use jsonrpsee::{proc_macros::rpc, types::JsonRpcResult}; +use jsonrpsee::{proc_macros::rpc, types::RpcResult}; use sp_rpc::{list::ListOrValue, number::NumberOrHex}; pub mod error; @@ -27,11 +27,11 @@ pub mod error; pub trait ChainApi { /// Get header. #[method(name = "getHeader")] - async fn header(&self, hash: Option) -> JsonRpcResult>; + async fn header(&self, hash: Option) -> RpcResult>; /// Get header and body of a relay chain block. #[method(name = "getBlock")] - async fn block(&self, hash: Option) -> JsonRpcResult>; + async fn block(&self, hash: Option) -> RpcResult>; /// Get hash of the n-th block in the canon chain. /// @@ -40,11 +40,11 @@ pub trait ChainApi { fn block_hash( &self, hash: Option>, - ) -> JsonRpcResult>>; + ) -> RpcResult>>; /// Get hash of the last finalized block in the canon chain. #[method(name = "getFinalizedHead", aliases = "chain_getFinalisedHead")] - fn finalized_head(&self) -> JsonRpcResult; + fn finalized_head(&self) -> RpcResult; /// All head subscription. #[subscription( @@ -53,7 +53,7 @@ pub trait ChainApi { unsubscribe_aliases = "chain_unsubscribeAllHeads", item = Header )] - fn subscribe_all_heads(&self) -> JsonRpcResult<()>; + fn subscribe_all_heads(&self) -> RpcResult<()>; /// New head subscription. #[subscription( @@ -62,7 +62,7 @@ pub trait ChainApi { unsubscribe_aliases = "chain_unsubscribeNewHead, chain_unsubscribeNewHeads", item = Header )] - fn subscribe_new_heads(&self) -> JsonRpcResult<()>; + fn subscribe_new_heads(&self) -> RpcResult<()>; /// Finalized head subscription. #[subscription( @@ -71,5 +71,5 @@ pub trait ChainApi { unsubscribe_aliases = "chain_unsubscribeFinalizedHeads, chain_unsubscribeFinalisedHeads", item = Header )] - fn subscribe_finalized_heads(&self) -> JsonRpcResult<()>; + fn subscribe_finalized_heads(&self) -> RpcResult<()>; } diff --git a/client/rpc-api/src/child_state/mod.rs b/client/rpc-api/src/child_state/mod.rs index 524261e5ec6b1..4e7785f331440 100644 --- a/client/rpc-api/src/child_state/mod.rs +++ b/client/rpc-api/src/child_state/mod.rs @@ -17,7 +17,7 @@ // along with this program. If not, see . use crate::state::ReadProof; -use jsonrpsee::{proc_macros::rpc, types::JsonRpcResult}; +use jsonrpsee::{proc_macros::rpc, types::RpcResult}; use sp_core::storage::{PrefixedStorageKey, StorageData, StorageKey}; /// Substrate child state API @@ -34,7 +34,7 @@ pub trait ChildStateApi { child_storage_key: PrefixedStorageKey, prefix: StorageKey, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns the keys with prefix from a child storage with pagination support. /// Up to `count` keys will be returned. @@ -47,7 +47,7 @@ pub trait ChildStateApi { count: u32, start_key: Option, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns a child storage entry at a specific block's state. #[method(name = "getStorage")] @@ -56,7 +56,7 @@ pub trait ChildStateApi { child_storage_key: PrefixedStorageKey, key: StorageKey, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns child storage entries for multiple keys at a specific block's state. #[method(name = "getStorageEntries")] @@ -65,7 +65,7 @@ pub trait ChildStateApi { child_storage_key: PrefixedStorageKey, keys: Vec, hash: Option, - ) -> JsonRpcResult>>; + ) -> RpcResult>>; /// Returns the hash of a child storage entry at a block's state. #[method(name = "getStorageHash")] @@ -74,7 +74,7 @@ pub trait ChildStateApi { child_storage_key: PrefixedStorageKey, key: StorageKey, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns the size of a child storage entry at a block's state. #[method(name = "getStorageSize")] @@ -83,7 +83,7 @@ pub trait ChildStateApi { child_storage_key: PrefixedStorageKey, key: StorageKey, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns proof of storage for child key entries at a specific block's state. #[method(name = "getChildReadProof", aliases = "state_getChildReadProof")] @@ -92,5 +92,5 @@ pub trait ChildStateApi { child_storage_key: PrefixedStorageKey, keys: Vec, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; } diff --git a/client/rpc-api/src/offchain/mod.rs b/client/rpc-api/src/offchain/mod.rs index 9069583f4cfcb..dde781a6a977a 100644 --- a/client/rpc-api/src/offchain/mod.rs +++ b/client/rpc-api/src/offchain/mod.rs @@ -18,7 +18,7 @@ //! Substrate offchain API. -use jsonrpsee::{proc_macros::rpc, types::JsonRpcResult}; +use jsonrpsee::{proc_macros::rpc, types::RpcResult}; use sp_core::{offchain::StorageKind, Bytes}; pub mod error; @@ -28,9 +28,9 @@ pub mod error; pub trait OffchainApi { /// Set offchain local storage under given key and prefix. #[method(name = "localStorageSet")] - fn set_local_storage(&self, kind: StorageKind, key: Bytes, value: Bytes) -> JsonRpcResult<()>; + fn set_local_storage(&self, kind: StorageKind, key: Bytes, value: Bytes) -> RpcResult<()>; /// Get offchain local storage under given key and prefix. #[method(name = "localStorageGet")] - fn get_local_storage(&self, kind: StorageKind, key: Bytes) -> JsonRpcResult>; + fn get_local_storage(&self, kind: StorageKind, key: Bytes) -> RpcResult>; } diff --git a/client/rpc-api/src/state/mod.rs b/client/rpc-api/src/state/mod.rs index 6affa23e6096a..d964a5c06f408 100644 --- a/client/rpc-api/src/state/mod.rs +++ b/client/rpc-api/src/state/mod.rs @@ -18,7 +18,7 @@ //! Substrate state API. -use jsonrpsee::{proc_macros::rpc, types::JsonRpcResult}; +use jsonrpsee::{proc_macros::rpc, types::RpcResult}; use sp_core::{ storage::{StorageChangeSet, StorageData, StorageKey}, Bytes, @@ -35,7 +35,7 @@ pub use self::helpers::ReadProof; pub trait StateApi { /// Call a contract at a block's state. #[method(name = "call", aliases = "state_callAt")] - async fn call(&self, name: String, bytes: Bytes, hash: Option) -> JsonRpcResult; + async fn call(&self, name: String, bytes: Bytes, hash: Option) -> RpcResult; /// DEPRECATED: Please use `getKeysPaged` with proper paging support. /// Returns the keys with prefix, leave empty to get all the keys. @@ -44,7 +44,7 @@ pub trait StateApi { &self, prefix: StorageKey, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns the keys with prefix, leave empty to get all the keys #[method(name = "getPairs")] @@ -52,7 +52,7 @@ pub trait StateApi { &self, prefix: StorageKey, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns the keys with prefix with pagination support. /// Up to `count` keys will be returned. @@ -64,36 +64,27 @@ pub trait StateApi { count: u32, start_key: Option, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns a storage entry at a specific block's state. #[method(name = "getStorage", aliases = "state_getStorageAt")] - async fn storage( - &self, - key: StorageKey, - hash: Option, - ) -> JsonRpcResult>; + async fn storage(&self, key: StorageKey, hash: Option) -> RpcResult>; /// Returns the hash of a storage entry at a block's state. #[method(name = "getStorageHash", aliases = "state_getStorageHashAt")] - async fn storage_hash( - &self, - key: StorageKey, - hash: Option, - ) -> JsonRpcResult>; + async fn storage_hash(&self, key: StorageKey, hash: Option) -> RpcResult>; /// Returns the size of a storage entry at a block's state. #[method(name = "getStorageSize", aliases = "state_getStorageSizeAt")] - async fn storage_size(&self, key: StorageKey, hash: Option) - -> JsonRpcResult>; + async fn storage_size(&self, key: StorageKey, hash: Option) -> RpcResult>; /// Returns the runtime metadata as an opaque blob. #[method(name = "getMetadata")] - async fn metadata(&self, hash: Option) -> JsonRpcResult; + async fn metadata(&self, hash: Option) -> RpcResult; /// Get the runtime version. #[method(name = "getRuntimeVersion", aliases = "chain_getRuntimeVersion")] - async fn runtime_version(&self, hash: Option) -> JsonRpcResult; + async fn runtime_version(&self, hash: Option) -> RpcResult; /// Query historical storage entries (by key) starting from a block given as the second /// parameter. @@ -106,7 +97,7 @@ pub trait StateApi { keys: Vec, block: Hash, hash: Option, - ) -> JsonRpcResult>>; + ) -> RpcResult>>; /// Query storage entries (by key) starting at block hash given as the second parameter. #[method(name = "queryStorageAt")] @@ -114,7 +105,7 @@ pub trait StateApi { &self, keys: Vec, at: Option, - ) -> JsonRpcResult>>; + ) -> RpcResult>>; /// Returns proof of storage entries at a specific block's state. #[method(name = "getReadProof")] @@ -122,7 +113,7 @@ pub trait StateApi { &self, keys: Vec, hash: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// New runtime version subscription #[subscription( @@ -131,7 +122,7 @@ pub trait StateApi { unsubscribe_aliases = "state_unsubscribeRuntimeVersion, chain_unsubscribeRuntimeVersion", item = RuntimeVersion, )] - fn subscribe_runtime_version(&self) -> JsonRpcResult<()>; + fn subscribe_runtime_version(&self) -> RpcResult<()>; /// New storage subscription #[subscription( @@ -140,7 +131,7 @@ pub trait StateApi { unsubscribe_aliases = "state_unsubscribeStorage", item = StorageChangeSet, )] - fn subscribe_storage(&self, keys: Option>) -> JsonRpcResult<()>; + fn subscribe_storage(&self, keys: Option>) -> RpcResult<()>; /// The `traceBlock` RPC provides a way to trace the re-execution of a single /// block, collecting Spans and Events from both the client and the relevant WASM runtime. @@ -301,5 +292,5 @@ pub trait StateApi { targets: Option, storage_keys: Option, methods: Option, - ) -> JsonRpcResult; + ) -> RpcResult; } diff --git a/client/rpc-api/src/system/mod.rs b/client/rpc-api/src/system/mod.rs index 101452e83c5d5..829982cb5addc 100644 --- a/client/rpc-api/src/system/mod.rs +++ b/client/rpc-api/src/system/mod.rs @@ -20,7 +20,7 @@ use jsonrpsee::{ proc_macros::rpc, - types::{JsonRpcResult, JsonValue}, + types::{JsonValue, RpcResult}, }; pub use self::helpers::{Health, NodeRole, PeerInfo, SyncState, SystemInfo}; @@ -33,23 +33,23 @@ pub mod helpers; pub trait SystemApi { /// Get the node's implementation name. Plain old string. #[method(name = "name")] - fn system_name(&self) -> JsonRpcResult; + fn system_name(&self) -> RpcResult; /// Get the node implementation's version. Should be a semver string. #[method(name = "version")] - fn system_version(&self) -> JsonRpcResult; + fn system_version(&self) -> RpcResult; /// Get the chain's name. Given as a string identifier. #[method(name = "chain")] - fn system_chain(&self) -> JsonRpcResult; + fn system_chain(&self) -> RpcResult; /// Get the chain's type. #[method(name = "chainType")] - fn system_type(&self) -> JsonRpcResult; + fn system_type(&self) -> RpcResult; /// Get a custom set of properties as a JSON object, defined in the chain spec. #[method(name = "properties")] - fn system_properties(&self) -> JsonRpcResult; + fn system_properties(&self) -> RpcResult; /// Return health status of the node. /// @@ -57,22 +57,22 @@ pub trait SystemApi { /// - connected to some peers (unless running in dev mode) /// - not performing a major sync #[method(name = "health")] - async fn system_health(&self) -> JsonRpcResult; + async fn system_health(&self) -> RpcResult; /// Returns the base58-encoded PeerId of the node. #[method(name = "localPeerId")] - async fn system_local_peer_id(&self) -> JsonRpcResult; + async fn system_local_peer_id(&self) -> RpcResult; /// Returns the multi-addresses that the local node is listening on /// /// The addresses include a trailing `/p2p/` with the local PeerId, and are thus suitable to /// be passed to `addReservedPeer` or as a bootnode address for example. #[method(name = "localListenAddresses")] - async fn system_local_listen_addresses(&self) -> JsonRpcResult>; + async fn system_local_listen_addresses(&self) -> RpcResult>; /// Returns currently connected peers #[method(name = "peers")] - async fn system_peers(&self) -> JsonRpcResult>>; + async fn system_peers(&self) -> RpcResult>>; /// Returns current state of the network. /// @@ -81,7 +81,7 @@ pub trait SystemApi { // TODO: the future of this call is uncertain: https://github.com/paritytech/substrate/issues/1890 // https://github.com/paritytech/substrate/issues/5541 #[method(name = "unstable_networkState")] - async fn system_network_state(&self) -> JsonRpcResult; + async fn system_network_state(&self) -> RpcResult; /// Adds a reserved peer. Returns the empty string or an error. The string /// parameter should encode a `p2p` multiaddr. @@ -89,25 +89,25 @@ pub trait SystemApi { /// `/ip4/198.51.100.19/tcp/30333/p2p/QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV` /// is an example of a valid, passing multiaddr with PeerId attached. #[method(name = "addReservedPeer")] - async fn system_add_reserved_peer(&self, peer: String) -> JsonRpcResult<()>; + async fn system_add_reserved_peer(&self, peer: String) -> RpcResult<()>; /// Remove a reserved peer. Returns the empty string or an error. The string /// should encode only the PeerId e.g. `QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV`. #[method(name = "removeReservedPeer")] - async fn system_remove_reserved_peer(&self, peer_id: String) -> JsonRpcResult<()>; + async fn system_remove_reserved_peer(&self, peer_id: String) -> RpcResult<()>; /// Returns the list of reserved peers #[method(name = "reservedPeers")] - async fn system_reserved_peers(&self) -> JsonRpcResult>; + async fn system_reserved_peers(&self) -> RpcResult>; /// Returns the roles the node is running as. #[method(name = "nodeRoles")] - async fn system_node_roles(&self) -> JsonRpcResult>; + async fn system_node_roles(&self) -> RpcResult>; /// Returns the state of the syncing of the node: starting block, current best block, highest /// known block. #[method(name = "syncState")] - async fn system_sync_state(&self) -> JsonRpcResult>; + async fn system_sync_state(&self) -> RpcResult>; /// Adds the supplied directives to the current log filter /// @@ -115,9 +115,9 @@ pub trait SystemApi { /// /// `sync=debug,state=trace` #[method(name = "addLogFilter")] - fn system_add_log_filter(&self, directives: String) -> JsonRpcResult<()>; + fn system_add_log_filter(&self, directives: String) -> RpcResult<()>; /// Resets the log filter to Substrate defaults #[method(name = "resetLogFilter")] - fn system_reset_log_filter(&self) -> JsonRpcResult<()>; + fn system_reset_log_filter(&self) -> RpcResult<()>; } diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 96a3163738b86..a4f13dabb9227 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -18,5 +18,5 @@ log = "0.4.8" prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.9.0"} serde_json = "1.0.41" futures-channel = "0.3" -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } tokio = { version = "1.10", features = ["full"] } diff --git a/client/rpc-servers/src/lib.rs b/client/rpc-servers/src/lib.rs index 9e03400f833fa..12dc0b31399d5 100644 --- a/client/rpc-servers/src/lib.rs +++ b/client/rpc-servers/src/lib.rs @@ -21,7 +21,7 @@ #![warn(missing_docs)] use jsonrpsee::{ - http_server::{AccessControlBuilder, Host, HttpServerBuilder, HttpStopHandle}, + http_server::{AccessControlBuilder, HttpServerBuilder, HttpStopHandle}, ws_server::{WsServerBuilder, WsStopHandle}, RpcModule, }; @@ -105,15 +105,14 @@ pub fn start_http( if let Some(cors) = cors { // Whitelist listening address. - let host = Host::parse(&format!("localhost:{}", addr.port())); - acl = acl.allow_host(host); - let host = Host::parse(&format!("127.0.0.1:{}", addr.port())); - acl = acl.allow_host(host); - // Set allowed origins. - for origin in cors { - acl = acl.cors_allow_origin(origin.into()); - } + acl = acl.set_allowed_hosts([ + format!("localhost:{}", addr.port()), + format!("127.0.0.1:{}", addr.port()), + ])?; + + let origins: Vec = cors.iter().map(Into::into).collect(); + acl = acl.set_allowed_origins(origins)?; }; let server = HttpServerBuilder::default() diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 7b338492248a3..5415445776db0 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -38,7 +38,7 @@ sc-tracing = { version = "4.0.0-dev", path = "../tracing" } hash-db = { version = "0.15.2", default-features = false } parking_lot = "0.11.1" lazy_static = { version = "1.4.0", optional = true } -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } sc-transaction-pool-api = { version = "4.0.0-dev", path = "../transaction-pool/api" } [dev-dependencies] diff --git a/client/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs index 67b6bdd4c5ed6..eaf07dc995b60 100644 --- a/client/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -28,7 +28,7 @@ use crate::SubscriptionTaskExecutor; use codec::{Decode, Encode}; use futures::StreamExt; use jsonrpsee::{ - types::{async_trait, error::Error as JsonRpseeError, JsonRpcResult}, + types::{async_trait, error::Error as JsonRpseeError, RpcResult}, SubscriptionSink, }; use sc_rpc_api::DenyUnsafe; @@ -83,7 +83,7 @@ where P::Hash: Unpin, ::Hash: Unpin, { - async fn submit_extrinsic(&self, ext: Bytes) -> JsonRpcResult> { + async fn submit_extrinsic(&self, ext: Bytes) -> RpcResult> { let xt = match Decode::decode(&mut &ext[..]) { Ok(xt) => xt, Err(err) => return Err(JsonRpseeError::to_call_error(err)), @@ -99,7 +99,7 @@ where }) } - fn insert_key(&self, key_type: String, suri: String, public: Bytes) -> JsonRpcResult<()> { + fn insert_key(&self, key_type: String, suri: String, public: Bytes) -> RpcResult<()> { self.deny_unsafe.check_if_safe()?; let key_type = key_type.as_str().try_into().map_err(|_| Error::BadKeyType)?; @@ -108,7 +108,7 @@ where Ok(()) } - fn rotate_keys(&self) -> JsonRpcResult { + fn rotate_keys(&self) -> RpcResult { self.deny_unsafe.check_if_safe()?; let best_block_hash = self.client.info().best_hash; @@ -119,7 +119,7 @@ where .map_err(|api_err| Error::Client(Box::new(api_err)).into()) } - fn has_session_keys(&self, session_keys: Bytes) -> JsonRpcResult { + fn has_session_keys(&self, session_keys: Bytes) -> RpcResult { self.deny_unsafe.check_if_safe()?; let best_block_hash = self.client.info().best_hash; @@ -133,21 +133,21 @@ where Ok(SyncCryptoStore::has_keys(&*self.keystore, &keys)) } - fn has_key(&self, public_key: Bytes, key_type: String) -> JsonRpcResult { + fn has_key(&self, public_key: Bytes, key_type: String) -> RpcResult { self.deny_unsafe.check_if_safe()?; let key_type = key_type.as_str().try_into().map_err(|_| Error::BadKeyType)?; Ok(SyncCryptoStore::has_keys(&*self.keystore, &[(public_key.to_vec(), key_type)])) } - fn pending_extrinsics(&self) -> JsonRpcResult> { + fn pending_extrinsics(&self) -> RpcResult> { Ok(self.pool.ready().map(|tx| tx.data().encode().into()).collect()) } fn remove_extrinsic( &self, bytes_or_hash: Vec>>, - ) -> JsonRpcResult>> { + ) -> RpcResult>> { self.deny_unsafe.check_if_safe()?; let hashes = bytes_or_hash .into_iter() @@ -156,7 +156,7 @@ where hash::ExtrinsicOrHash::Extrinsic(bytes) => { let xt = Decode::decode(&mut &bytes[..])?; Ok(self.pool.hash_of(&xt)) - }, + } }) .collect::>>()?; @@ -168,14 +168,14 @@ where .collect()) } - fn watch_extrinsic(&self, mut sink: SubscriptionSink, xt: Bytes) -> JsonRpcResult<()> { + fn watch_extrinsic(&self, mut sink: SubscriptionSink, xt: Bytes) -> RpcResult<()> { let best_block_hash = self.client.info().best_hash; let dxt = match TransactionFor::

::decode(&mut &xt[..]) { Ok(dxt) => dxt, Err(e) => { log::error!("[watch_extrinsic sub] failed to decode extrinsic: {:?}", e); - return Err(JsonRpseeError::to_call_error(e)) - }, + return Err(JsonRpseeError::to_call_error(e)); + } }; let executor = self.executor.clone(); @@ -191,8 +191,8 @@ where "txpool subscription failed: {:?}; subscription useless", e )); - return - }, + return; + } }; stream diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index 181d077b3668a..a60f078dcf73e 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -30,7 +30,7 @@ use std::sync::Arc; use crate::SubscriptionTaskExecutor; use jsonrpsee::{ - types::{async_trait, JsonRpcResult}, + types::{async_trait, RpcResult}, SubscriptionSink, }; use sc_client_api::{ @@ -96,7 +96,7 @@ where .header(BlockId::number(block_num)) .map_err(client_err)? .map(|h| h.hash())) - }, + } } } @@ -164,18 +164,18 @@ where Block::Header: Unpin, Client: HeaderBackend + BlockchainEvents + 'static, { - async fn header(&self, hash: Option) -> JsonRpcResult> { + async fn header(&self, hash: Option) -> RpcResult> { self.backend.header(hash).await.map_err(Into::into) } - async fn block(&self, hash: Option) -> JsonRpcResult>> { + async fn block(&self, hash: Option) -> RpcResult>> { self.backend.block(hash).await.map_err(Into::into) } fn block_hash( &self, number: Option>, - ) -> JsonRpcResult>> { + ) -> RpcResult>> { match number { None => self.backend.block_hash(None).map(ListOrValue::Value).map_err(Into::into), Some(ListOrValue::Value(number)) => self @@ -191,19 +191,19 @@ where } } - fn finalized_head(&self) -> JsonRpcResult { + fn finalized_head(&self) -> RpcResult { self.backend.finalized_head().map_err(Into::into) } - fn subscribe_all_heads(&self, sink: SubscriptionSink) -> JsonRpcResult<()> { + fn subscribe_all_heads(&self, sink: SubscriptionSink) -> RpcResult<()> { self.backend.subscribe_all_heads(sink).map_err(Into::into) } - fn subscribe_new_heads(&self, sink: SubscriptionSink) -> JsonRpcResult<()> { + fn subscribe_new_heads(&self, sink: SubscriptionSink) -> RpcResult<()> { self.backend.subscribe_new_heads(sink).map_err(Into::into) } - fn subscribe_finalized_heads(&self, sink: SubscriptionSink) -> JsonRpcResult<()> { + fn subscribe_finalized_heads(&self, sink: SubscriptionSink) -> RpcResult<()> { self.backend.subscribe_finalized_heads(sink).map_err(Into::into) } } diff --git a/client/rpc/src/offchain/mod.rs b/client/rpc/src/offchain/mod.rs index 63fc0e48a6be4..c03762b6d6ec6 100644 --- a/client/rpc/src/offchain/mod.rs +++ b/client/rpc/src/offchain/mod.rs @@ -22,7 +22,7 @@ mod tests; use self::error::Error; -use jsonrpsee::types::{async_trait, Error as JsonRpseeError, JsonRpcResult}; +use jsonrpsee::types::{async_trait, Error as JsonRpseeError, RpcResult}; use parking_lot::RwLock; /// Re-export the API for backward compatibility. pub use sc_rpc_api::offchain::*; @@ -50,25 +50,27 @@ impl Offchain { #[async_trait] impl OffchainApiServer for Offchain { - fn set_local_storage(&self, kind: StorageKind, key: Bytes, value: Bytes) -> JsonRpcResult<()> { + fn set_local_storage(&self, kind: StorageKind, key: Bytes, value: Bytes) -> RpcResult<()> { self.deny_unsafe.check_if_safe()?; let prefix = match kind { StorageKind::PERSISTENT => sp_offchain::STORAGE_PREFIX, - StorageKind::LOCAL => - return Err(JsonRpseeError::to_call_error(Error::UnavailableStorageKind)), + StorageKind::LOCAL => { + return Err(JsonRpseeError::to_call_error(Error::UnavailableStorageKind)) + } }; self.storage.write().set(prefix, &*key, &*value); Ok(()) } - fn get_local_storage(&self, kind: StorageKind, key: Bytes) -> JsonRpcResult> { + fn get_local_storage(&self, kind: StorageKind, key: Bytes) -> RpcResult> { self.deny_unsafe.check_if_safe()?; let prefix = match kind { StorageKind::PERSISTENT => sp_offchain::STORAGE_PREFIX, - StorageKind::LOCAL => - return Err(JsonRpseeError::to_call_error(Error::UnavailableStorageKind)), + StorageKind::LOCAL => { + return Err(JsonRpseeError::to_call_error(Error::UnavailableStorageKind)) + } }; Ok(self.storage.read().get(prefix, &*key).map(Into::into)) diff --git a/client/rpc/src/state/mod.rs b/client/rpc/src/state/mod.rs index 702b851e354e4..556be5f1af2ca 100644 --- a/client/rpc/src/state/mod.rs +++ b/client/rpc/src/state/mod.rs @@ -29,7 +29,7 @@ use std::sync::Arc; use crate::SubscriptionTaskExecutor; use jsonrpsee::{ - types::{async_trait, error::Error as JsonRpseeError, JsonRpcResult}, + types::{async_trait, error::Error as JsonRpseeError, RpcResult}, ws_server::SubscriptionSink, }; @@ -255,7 +255,7 @@ where method: String, data: Bytes, block: Option, - ) -> JsonRpcResult { + ) -> RpcResult { self.backend .call(block, method, data) .await @@ -266,7 +266,7 @@ where &self, key_prefix: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage_keys(block, key_prefix) .await @@ -277,7 +277,7 @@ where &self, key_prefix: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.deny_unsafe.check_if_safe()?; self.backend .storage_pairs(block, key_prefix) @@ -291,7 +291,7 @@ where count: u32, start_key: Option, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { if count > STORAGE_KEYS_PAGED_MAX_COUNT { return Err(JsonRpseeError::to_call_error(Error::InvalidCount { value: count, @@ -308,7 +308,7 @@ where &self, key: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage(block, key) .await @@ -319,7 +319,7 @@ where &self, key: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage_hash(block, key) .await @@ -330,18 +330,18 @@ where &self, key: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage_size(block, key) .await .map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn metadata(&self, block: Option) -> JsonRpcResult { + async fn metadata(&self, block: Option) -> RpcResult { self.backend.metadata(block).await.map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn runtime_version(&self, at: Option) -> JsonRpcResult { + async fn runtime_version(&self, at: Option) -> RpcResult { self.backend .runtime_version(at) .await @@ -353,7 +353,7 @@ where keys: Vec, from: Block::Hash, to: Option, - ) -> JsonRpcResult>> { + ) -> RpcResult>> { self.deny_unsafe.check_if_safe()?; self.backend .query_storage(from, to, keys) @@ -365,7 +365,7 @@ where &self, keys: Vec, at: Option, - ) -> JsonRpcResult>> { + ) -> RpcResult>> { self.backend .query_storage_at(keys, at) .await @@ -376,7 +376,7 @@ where &self, keys: Vec, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .read_proof(block, keys) .await @@ -389,7 +389,7 @@ where targets: Option, storage_keys: Option, methods: Option, - ) -> JsonRpcResult { + ) -> RpcResult { self.deny_unsafe.check_if_safe()?; self.backend .trace_block(block, targets, storage_keys, methods) @@ -397,7 +397,7 @@ where .map_err(|e| JsonRpseeError::to_call_error(e)) } - fn subscribe_runtime_version(&self, sink: SubscriptionSink) -> JsonRpcResult<()> { + fn subscribe_runtime_version(&self, sink: SubscriptionSink) -> RpcResult<()> { self.backend .subscribe_runtime_version(sink) .map_err(|e| JsonRpseeError::to_call_error(e)) @@ -407,7 +407,7 @@ where &self, sink: SubscriptionSink, keys: Option>, - ) -> JsonRpcResult<()> { + ) -> RpcResult<()> { self.backend .subscribe_storage(sink, keys) .map_err(|e| JsonRpseeError::to_call_error(e)) @@ -499,7 +499,7 @@ where storage_key: PrefixedStorageKey, key_prefix: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage_keys(block, storage_key, key_prefix) .await @@ -513,7 +513,7 @@ where count: u32, start_key: Option, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage_keys_paged(block, storage_key, prefix, count, start_key) .await @@ -525,7 +525,7 @@ where storage_key: PrefixedStorageKey, key: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage(block, storage_key, key) .await @@ -537,7 +537,7 @@ where storage_key: PrefixedStorageKey, keys: Vec, block: Option, - ) -> JsonRpcResult>> { + ) -> RpcResult>> { self.backend .storage_entries(block, storage_key, keys) .await @@ -549,7 +549,7 @@ where storage_key: PrefixedStorageKey, key: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage_hash(block, storage_key, key) .await @@ -561,7 +561,7 @@ where storage_key: PrefixedStorageKey, key: StorageKey, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .storage_size(block, storage_key, key) .await @@ -573,7 +573,7 @@ where child_storage_key: PrefixedStorageKey, keys: Vec, block: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { self.backend .read_child_proof(block, child_storage_key, keys) .await diff --git a/client/rpc/src/system/mod.rs b/client/rpc/src/system/mod.rs index 94f7e63dfa287..73a5c9c678c26 100644 --- a/client/rpc/src/system/mod.rs +++ b/client/rpc/src/system/mod.rs @@ -22,7 +22,7 @@ mod tests; use futures::channel::oneshot; -use jsonrpsee::types::{async_trait, error::Error as JsonRpseeError, JsonRpcResult, JsonValue}; +use jsonrpsee::types::{async_trait, error::Error as JsonRpseeError, JsonValue, RpcResult}; use sc_rpc_api::DenyUnsafe; use sc_tracing::logging; use sc_utils::mpsc::TracingUnboundedSender; @@ -81,39 +81,39 @@ impl System { #[async_trait] impl SystemApiServer::Number> for System { - fn system_name(&self) -> JsonRpcResult { + fn system_name(&self) -> RpcResult { Ok(self.info.impl_name.clone()) } - fn system_version(&self) -> JsonRpcResult { + fn system_version(&self) -> RpcResult { Ok(self.info.impl_version.clone()) } - fn system_chain(&self) -> JsonRpcResult { + fn system_chain(&self) -> RpcResult { Ok(self.info.chain_name.clone()) } - fn system_type(&self) -> JsonRpcResult { + fn system_type(&self) -> RpcResult { Ok(self.info.chain_type.clone()) } - fn system_properties(&self) -> JsonRpcResult { + fn system_properties(&self) -> RpcResult { Ok(self.info.properties.clone()) } - async fn system_health(&self) -> JsonRpcResult { + async fn system_health(&self) -> RpcResult { let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::Health(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn system_local_peer_id(&self) -> JsonRpcResult { + async fn system_local_peer_id(&self) -> RpcResult { let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::LocalPeerId(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn system_local_listen_addresses(&self) -> JsonRpcResult> { + async fn system_local_listen_addresses(&self) -> RpcResult> { let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::LocalListenAddresses(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) @@ -121,21 +121,21 @@ impl SystemApiServer::Number> async fn system_peers( &self, - ) -> JsonRpcResult::Number>>> { + ) -> RpcResult::Number>>> { self.deny_unsafe.check_if_safe()?; let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::Peers(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn system_network_state(&self) -> JsonRpcResult { + async fn system_network_state(&self) -> RpcResult { self.deny_unsafe.check_if_safe()?; let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::NetworkState(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn system_add_reserved_peer(&self, peer: String) -> JsonRpcResult<()> { + async fn system_add_reserved_peer(&self, peer: String) -> RpcResult<()> { self.deny_unsafe.check_if_safe()?; let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::NetworkAddReservedPeer(peer, tx)); @@ -146,7 +146,7 @@ impl SystemApiServer::Number> } } - async fn system_remove_reserved_peer(&self, peer: String) -> JsonRpcResult<()> { + async fn system_remove_reserved_peer(&self, peer: String) -> RpcResult<()> { self.deny_unsafe.check_if_safe()?; let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::NetworkRemoveReservedPeer(peer, tx)); @@ -157,32 +157,32 @@ impl SystemApiServer::Number> } } - async fn system_reserved_peers(&self) -> JsonRpcResult> { + async fn system_reserved_peers(&self) -> RpcResult> { let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::NetworkReservedPeers(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn system_node_roles(&self) -> JsonRpcResult> { + async fn system_node_roles(&self) -> RpcResult> { let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::NodeRoles(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) } - async fn system_sync_state(&self) -> JsonRpcResult::Number>> { + async fn system_sync_state(&self) -> RpcResult::Number>> { let (tx, rx) = oneshot::channel(); let _ = self.send_back.unbounded_send(Request::SyncState(tx)); rx.await.map_err(|e| JsonRpseeError::to_call_error(e)) } - fn system_add_log_filter(&self, directives: String) -> JsonRpcResult<()> { + fn system_add_log_filter(&self, directives: String) -> RpcResult<()> { self.deny_unsafe.check_if_safe()?; logging::add_directives(&directives); logging::reload_filter().map_err(|e| anyhow::anyhow!("{:?}", e).into()) } - fn system_reset_log_filter(&self) -> JsonRpcResult<()> { + fn system_reset_log_filter(&self) -> RpcResult<()> { self.deny_unsafe.check_if_safe()?; logging::reset_log_filter().map_err(|e| anyhow::anyhow!("{:?}", e).into()) } diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index bf0dc7380abf3..553b1dc8f3654 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -22,7 +22,7 @@ wasmtime = ["sc-executor/wasmtime"] test-helpers = [] [dependencies] -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } thiserror = "1.0.21" futures01 = { package = "futures", version = "0.1.29" } diff --git a/client/sync-state-rpc/Cargo.toml b/client/sync-state-rpc/Cargo.toml index 1ab8f539768c9..b678fff08c8ea 100644 --- a/client/sync-state-rpc/Cargo.toml +++ b/client/sync-state-rpc/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] thiserror = "1.0.21" anyhow = "1" -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } log = "0.4" sc-chain-spec = { version = "4.0.0-dev", path = "../chain-spec" } diff --git a/client/sync-state-rpc/src/lib.rs b/client/sync-state-rpc/src/lib.rs index dd2a20c1147d1..3943fa6216e5d 100644 --- a/client/sync-state-rpc/src/lib.rs +++ b/client/sync-state-rpc/src/lib.rs @@ -43,7 +43,7 @@ use jsonrpsee::{ proc_macros::rpc, - types::{error::Error as JsonRpseeError, JsonRpcResult}, + types::{error::Error as JsonRpseeError, RpcResult}, }; use sc_client_api::StorageData; use sp_blockchain::HeaderBackend; @@ -116,7 +116,7 @@ pub trait SyncStateRpcApi { // NOTE(niklasad1): I changed to `JsonValue` -> `String` as the chainspec // already returns a JSON String. #[method(name = "genSyncSpec")] - fn system_gen_sync_spec(&self, raw: bool) -> JsonRpcResult; + fn system_gen_sync_spec(&self, raw: bool) -> RpcResult; } /// An api for sync state RPC calls. @@ -175,7 +175,7 @@ where Block: BlockT, Backend: HeaderBackend + sc_client_api::AuxStore + 'static, { - fn system_gen_sync_spec(&self, raw: bool) -> JsonRpcResult { + fn system_gen_sync_spec(&self, raw: bool) -> RpcResult { self.deny_unsafe.check_if_safe()?; let current_sync_state = diff --git a/frame/contracts/rpc/Cargo.toml b/frame/contracts/rpc/Cargo.toml index 477c5ad55ebb1..c32fc9acb7e05 100644 --- a/frame/contracts/rpc/Cargo.toml +++ b/frame/contracts/rpc/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "2" } -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } log = "0.4" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index 275e499fed091..a43913c5dcd6b 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -27,7 +27,7 @@ use jsonrpsee::{ types::{ async_trait, error::{CallError, Error as JsonRpseeError}, - JsonRpcResult, + RpcResult, }, }; use pallet_contracts_primitives::{Code, ContractExecResult, ContractInstantiateResult}; @@ -120,7 +120,7 @@ pub trait ContractsApi { &self, call_request: CallRequest, at: Option, - ) -> JsonRpcResult; + ) -> RpcResult; /// Instantiate a new contract. /// @@ -133,7 +133,7 @@ pub trait ContractsApi { &self, instantiate_request: InstantiateRequest, at: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; /// Returns the value under a specified storage `key` in a contract given by `address` param, /// or `None` if it is not set. @@ -143,7 +143,7 @@ pub trait ContractsApi { address: AccountId, key: H256, at: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; } /// Contracts RPC methods. @@ -186,7 +186,7 @@ where &self, call_request: CallRequest, at: Option<::Hash>, - ) -> JsonRpcResult { + ) -> RpcResult { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); @@ -207,7 +207,7 @@ where &self, instantiate_request: InstantiateRequest, at: Option<::Hash>, - ) -> JsonRpcResult> { + ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); let InstantiateRequest { origin, endowment, gas_limit, code, data, salt } = @@ -229,7 +229,7 @@ where address: AccountId, key: H256, at: Option<::Hash>, - ) -> JsonRpcResult> { + ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); let result = api diff --git a/frame/merkle-mountain-range/rpc/Cargo.toml b/frame/merkle-mountain-range/rpc/Cargo.toml index c05329715a720..08e9e87d53bf5 100644 --- a/frame/merkle-mountain-range/rpc/Cargo.toml +++ b/frame/merkle-mountain-range/rpc/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "2.0.0" } -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } serde_json = "1" serde = { version = "1.0.126", features = ["derive"] } log = "0.4" diff --git a/frame/merkle-mountain-range/rpc/src/lib.rs b/frame/merkle-mountain-range/rpc/src/lib.rs index ce019fec5e1e9..38440daabc65a 100644 --- a/frame/merkle-mountain-range/rpc/src/lib.rs +++ b/frame/merkle-mountain-range/rpc/src/lib.rs @@ -25,7 +25,7 @@ use std::{marker::PhantomData, sync::Arc}; use codec::{Codec, Encode}; use jsonrpsee::{ proc_macros::rpc, - types::{async_trait, error::CallError, JsonRpcResult}, + types::{async_trait, error::CallError, RpcResult}, }; use pallet_mmr_primitives::{Error as MmrError, Proof}; use serde::{Deserialize, Serialize}; @@ -80,7 +80,7 @@ pub trait MmrApi { &self, leaf_index: u64, at: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; } /// MMR RPC methods. @@ -109,7 +109,7 @@ where &self, leaf_index: u64, at: Option<::Hash>, - ) -> JsonRpcResult> { + ) -> RpcResult> { let api = self.client.runtime_api(); let block_hash = at.unwrap_or_else(|| self.client.info().best_hash); diff --git a/frame/transaction-payment/rpc/Cargo.toml b/frame/transaction-payment/rpc/Cargo.toml index b3463eaa9e578..827bd150a95a0 100644 --- a/frame/transaction-payment/rpc/Cargo.toml +++ b/frame/transaction-payment/rpc/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] anyhow = "1" codec = { package = "parity-scale-codec", version = "2.0.0" } -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } log = "0.4" sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" } diff --git a/frame/transaction-payment/rpc/src/lib.rs b/frame/transaction-payment/rpc/src/lib.rs index 9b1b85887ea91..0a4578527689b 100644 --- a/frame/transaction-payment/rpc/src/lib.rs +++ b/frame/transaction-payment/rpc/src/lib.rs @@ -26,7 +26,7 @@ use jsonrpsee::{ types::{ async_trait, error::{CallError, Error as JsonRpseeError}, - JsonRpcResult, + RpcResult, }, }; use pallet_transaction_payment_rpc_runtime_api::{FeeDetails, InclusionFee, RuntimeDispatchInfo}; @@ -44,14 +44,14 @@ pub use pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi as Tra #[rpc(client, server, namespace = "payment")] pub trait TransactionPaymentApi { #[method(name = "queryInfo")] - fn query_info(&self, encoded_xt: Bytes, at: Option) -> JsonRpcResult; + fn query_info(&self, encoded_xt: Bytes, at: Option) -> RpcResult; #[method(name = "queryFeeDetails")] fn query_fee_details( &self, encoded_xt: Bytes, at: Option, - ) -> JsonRpcResult>; + ) -> RpcResult>; } /// Provides RPC methods to query a dispatchable's class, weight and fee. @@ -83,7 +83,7 @@ where &self, encoded_xt: Bytes, at: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); @@ -99,7 +99,7 @@ where &self, encoded_xt: Bytes, at: Option, - ) -> JsonRpcResult> { + ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); diff --git a/test-utils/test-runner/Cargo.toml b/test-utils/test-runner/Cargo.toml index 506a411adbf64..ee2bf4d03e3c5 100644 --- a/test-utils/test-runner/Cargo.toml +++ b/test-utils/test-runner/Cargo.toml @@ -51,5 +51,5 @@ futures = "0.3.16" tokio = { version = "1.10", features = ["signal"] } # Calling RPC -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } num-traits = "0.2.14" diff --git a/utils/frame/remote-externalities/Cargo.toml b/utils/frame/remote-externalities/Cargo.toml index 5296bf3ab8bb8..23d5c260fc148 100644 --- a/utils/frame/remote-externalities/Cargo.toml +++ b/utils/frame/remote-externalities/Cargo.toml @@ -17,11 +17,11 @@ jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = "tokio1", ] } jsonrpsee-proc-macros = "0.3.0" -# jsonrpsee-ws-client = { git = "https://github.com/paritytech/jsonrpsee", branch = "master" } -# # jsonrpsee-ws-client = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", default-features = false, features = [ +# jsonrpsee-ws-client = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder" } +# # jsonrpsee-ws-client = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", default-features = false, features = [ # # "tokio02", # # ] } -# jsonrpsee-proc-macros = { git = "https://github.com/paritytech/jsonrpsee", branch = "master" } +# jsonrpsee-proc-macros = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder" } env_logger = "0.9" log = "0.4.11" diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index 93ee6e3e8c892..70872b1496aee 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] futures = "0.3.16" -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["client", "types"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["client", "types"] } codec = { package = "parity-scale-codec", version = "2.0.0" } serde = "1" frame-support = { version = "4.0.0-dev", path = "../../../../frame/support" } diff --git a/utils/frame/rpc/system/Cargo.toml b/utils/frame/rpc/system/Cargo.toml index 78699d4cdd0fd..dc5065dcc7ae7 100644 --- a/utils/frame/rpc/system/Cargo.toml +++ b/utils/frame/rpc/system/Cargo.toml @@ -19,7 +19,7 @@ serde_json = "1" sc-client-api = { version = "4.0.0-dev", path = "../../../../client/api" } codec = { package = "parity-scale-codec", version = "2.0.0" } futures = { version = "0.3.4", features = ["compat"] } -jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "master", features = ["server"] } +jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", branch = "na-http-server-unify-acl-builder", features = ["server"] } log = "0.4.8" sp-runtime = { version = "4.0.0-dev", path = "../../../../primitives/runtime" } sp-api = { version = "4.0.0-dev", path = "../../../../primitives/api" } diff --git a/utils/frame/rpc/system/src/lib.rs b/utils/frame/rpc/system/src/lib.rs index 163bdd5210085..5b00fbe0c95e9 100644 --- a/utils/frame/rpc/system/src/lib.rs +++ b/utils/frame/rpc/system/src/lib.rs @@ -22,7 +22,7 @@ use std::{fmt::Display, marker::PhantomData, sync::Arc}; use codec::{self, Codec, Decode, Encode}; use jsonrpsee::{ proc_macros::rpc, - types::{async_trait, error::CallError, Error as JsonRpseeError, JsonRpcResult}, + types::{async_trait, error::CallError, Error as JsonRpseeError, RpcResult}, }; use sc_client_api::light::{self, future_header, RemoteBlockchain, RemoteCallRequest}; use sc_rpc_api::DenyUnsafe; @@ -43,11 +43,11 @@ pub trait SystemApi { /// currently in the pool and if no transactions are found in the pool /// it fallbacks to query the index from the runtime (aka. state nonce). #[method(name = "accountNextIndex", aliases = "system_nextIndex")] - async fn nonce(&self, account: AccountId) -> JsonRpcResult; + async fn nonce(&self, account: AccountId) -> RpcResult; /// Dry run an extrinsic at a given block. Return SCALE encoded ApplyExtrinsicResult. #[method(name = "dryRun", aliases = "system_dryRunAt")] - async fn dry_run(&self, extrinsic: Bytes, at: Option) -> JsonRpcResult; + async fn dry_run(&self, extrinsic: Bytes, at: Option) -> RpcResult; } /// System RPC methods. @@ -76,11 +76,11 @@ where + traits::MaybeSerialize + 'static, { - async fn nonce(&self, account: AccountId) -> JsonRpcResult { + async fn nonce(&self, account: AccountId) -> RpcResult { self.backend.nonce(account).await } - async fn dry_run(&self, extrinsic: Bytes, at: Option) -> JsonRpcResult { + async fn dry_run(&self, extrinsic: Bytes, at: Option) -> RpcResult { self.backend.dry_run(extrinsic, at).await } }