From bc07cf6d28ee3ca0a5ca0583f25c448f35dece64 Mon Sep 17 00:00:00 2001 From: Rodolfo Date: Thu, 25 Apr 2024 14:26:59 -0300 Subject: [PATCH 01/10] Bump rand version to 0.8 --- Cargo.toml | 34 ++++ core-client/Cargo.toml | 17 +- core-client/transports/Cargo.toml | 49 +++--- core-client/transports/src/lib.rs | 2 +- .../transports/src/transports/duplex.rs | 147 ++++++++---------- core-client/transports/src/transports/mod.rs | 3 +- core/Cargo.toml | 23 ++- core/src/io.rs | 21 +-- derive/Cargo.toml | 26 ++-- derive/src/rpc_attr.rs | 8 +- derive/src/rpc_trait.rs | 8 +- derive/src/to_client.rs | 42 +++-- derive/src/to_delegate.rs | 6 +- http/Cargo.toml | 32 ++-- http/src/handler.rs | 4 +- http/src/lib.rs | 4 +- http/src/response.rs | 2 +- ipc/Cargo.toml | 38 +++-- ipc/src/select_with_weak.rs | 2 +- ipc/src/server.rs | 2 +- pubsub/Cargo.toml | 31 ++-- pubsub/src/handler.rs | 6 +- pubsub/src/manager.rs | 4 +- server-utils/Cargo.toml | 31 ++-- server-utils/src/cors.rs | 14 +- server-utils/src/hosts.rs | 6 +- server-utils/src/reactor.rs | 6 +- stdio/Cargo.toml | 28 ++-- tcp/Cargo.toml | 28 ++-- test/Cargo.toml | 23 +-- ws/Cargo.toml | 24 +-- ws/src/error.rs | 7 +- ws/src/session.rs | 4 +- 33 files changed, 351 insertions(+), 331 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b509827d5..84ef78b65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,37 @@ members = [ "test", "ws", ] + +[workspace.package] +version = "18.0.1" +authors = ["Parity Technologies "] +repository = "https://github.com/paritytech/jsonrpc" +homepage = "https://github.com/paritytech/jsonrpc" +license = "MIT" +edition = "2018" +keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"] + +[workspace.dependencies] +# local projects +jsonrpc-core = { version = "18.0.0", path = "./core" } +jsonrpc-core-client = { version = "18.0.0", path = "./core-client" } +jsonrpc-http-server = { version = "18.0.0", path = "./http" } +jsonrpc-ipc-server = { version = "18.0.0", path = "./ipc" } +jsonrpc-pubsub = { version = "18.0.0", path = "./pubsub" } +jsonrpc-server-utils = { version = "18.0.0", path = "./server-utils" } +jsonrpc-tcp-server = { version = "18.0.0", path = "./tcp" } + +assert_matches = "1.3" +env_logger = "0.7" +futures = "0.3" +lazy_static = "1.0" +log = "0.4" +hyper = "0.14" +parking_lot = "0.11.0" +parity-tokio-ipc = "0.9" +serde = "1.0" +serde_json = "1.0" +tokio = "1" +tokio-util = "0.6" +tower-service = "0.3" +unicase = "2.0" diff --git a/core-client/Cargo.toml b/core-client/Cargo.toml index e4340540a..d0813580b 100644 --- a/core-client/Cargo.toml +++ b/core-client/Cargo.toml @@ -1,14 +1,13 @@ [package] -authors = ["Parity Technologies "] description = "Transport agnostic JSON-RPC 2.0 client implementation." documentation = "https://docs.rs/jsonrpc-core-client/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"] -license = "MIT" name = "jsonrpc-core-client" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true categories = [ "asynchronous", @@ -27,7 +26,7 @@ arbitrary_precision = ["jsonrpc-client-transports/arbitrary_precision"] [dependencies] jsonrpc-client-transports = { version = "18.0.0", path = "./transports", default-features = false } -futures = { version = "0.3", features = [ "compat" ] } +futures = { version = "0.3", features = ["compat"] } [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/core-client/transports/Cargo.toml b/core-client/transports/Cargo.toml index 66ef04a6b..15bb22f7d 100644 --- a/core-client/transports/Cargo.toml +++ b/core-client/transports/Cargo.toml @@ -22,40 +22,39 @@ categories = [ default = ["http", "tls", "ws"] tls = ["hyper-tls", "http"] http = ["hyper", "tokio/full"] -ws = [ - "websocket", - "tokio", - "futures/compat" +ws = ["websocket", "tokio", "futures/compat"] +ipc = ["parity-tokio-ipc", "jsonrpc-server-utils", "tokio"] +arbitrary_precision = [ + "serde_json/arbitrary_precision", + "jsonrpc-core/arbitrary_precision", ] -ipc = [ - "parity-tokio-ipc", - "jsonrpc-server-utils", - "tokio", -] -arbitrary_precision = ["serde_json/arbitrary_precision", "jsonrpc-core/arbitrary_precision"] [dependencies] derive_more = "0.99" -futures = "0.3" -jsonrpc-core = { version = "18.0.0", path = "../../core" } -jsonrpc-pubsub = { version = "18.0.0", path = "../../pubsub" } -log = "0.4" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +futures.workspace = true +jsonrpc-core.workspace = true +jsonrpc-pubsub.workspace = true +log.workspace = true +serde = { workspace = true, features = ["derive"] } +serde_json.workspace = true -hyper = { version = "0.14", features = ["client", "http1", "tcp"], optional = true } +hyper = { workspace = true, features = [ + "client", + "http1", + "tcp", +], optional = true } hyper-tls = { version = "0.5", optional = true } -jsonrpc-server-utils = { version = "18.0.0", path = "../../server-utils", optional = true } -parity-tokio-ipc = { version = "0.9", optional = true } -tokio = { version = "1", optional = true } +jsonrpc-server-utils = { workspace = true, optional = true } +parity-tokio-ipc = { workspace = true, optional = true } +tokio = { workspace = true, optional = true } websocket = { version = "0.26", optional = true } [dev-dependencies] -assert_matches = "1.1" -jsonrpc-http-server = { version = "18.0.0", path = "../../http" } -jsonrpc-ipc-server = { version = "18.0.0", path = "../../ipc" } -lazy_static = "1.0" -env_logger = "0.7" +assert_matches.workspace = true +jsonrpc-http-server.workspace = true +jsonrpc-ipc-server.workspace = true +lazy_static.workspace = true +env_logger.workspace = true [badges] travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/core-client/transports/src/lib.rs b/core-client/transports/src/lib.rs index 8b1112945..8b93b802d 100644 --- a/core-client/transports/src/lib.rs +++ b/core-client/transports/src/lib.rs @@ -205,7 +205,7 @@ impl RawClient { }; let result = self.0.send(msg.into()); async move { - let () = result.map_err(|e| RpcError::Other(Box::new(e)))?; + result.map_err(|e| RpcError::Other(Box::new(e)))?; receiver.await.map_err(|e| RpcError::Other(Box::new(e)))? } diff --git a/core-client/transports/src/transports/duplex.rs b/core-client/transports/src/transports/duplex.rs index 28751f64d..59fcc360b 100644 --- a/core-client/transports/src/transports/duplex.rs +++ b/core-client/transports/src/transports/duplex.rs @@ -101,12 +101,9 @@ where fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { // Handle requests from the client. log::debug!("handle requests from client"); - loop { - // Check that the client channel is open - let channel = match self.channel.as_mut() { - Some(channel) => channel, - None => break, - }; + + // Check that the client channel is open + while let Some(channel) = self.channel.as_mut() { let msg = match channel.poll_next_unpin(cx) { Poll::Ready(Some(msg)) => msg, Poll::Ready(None) => { @@ -185,87 +182,79 @@ where // Handle incoming queue. log::debug!("handle incoming"); - loop { - match self.incoming.pop_front() { - Some((id, result, method, sid)) => { - let sid_and_method = sid.and_then(|sid| method.map(|method| (sid, method))); - // Handle the response to a pending request. - match self.pending_requests.remove(&id) { - // It's a regular Req-Res call, so just answer. - Some(PendingRequest::Call(tx)) => { - tx.send(result) - .map_err(|_| RpcError::Client("oneshot channel closed".into()))?; - continue; - } - // It was a subscription request, - // turn it into a proper subscription. - Some(PendingRequest::Subscription(mut subscription)) => { - let sid = result.as_ref().ok().and_then(|res| SubscriptionId::parse_value(res)); - let method = subscription.notification.clone(); + while let Some((id, result, method, sid)) = self.incoming.pop_front() { + let sid_and_method = sid.and_then(|sid| method.map(|method| (sid, method))); + // Handle the response to a pending request. + match self.pending_requests.remove(&id) { + // It's a regular Req-Res call, so just answer. + Some(PendingRequest::Call(tx)) => { + tx.send(result) + .map_err(|_| RpcError::Client("oneshot channel closed".into()))?; + continue; + } + // It was a subscription request, + // turn it into a proper subscription. + Some(PendingRequest::Subscription(mut subscription)) => { + let sid = result.as_ref().ok().and_then(SubscriptionId::parse_value); + let method = subscription.notification.clone(); - if let Some(sid) = sid { - subscription.id = Some(sid.clone()); - if self - .subscriptions - .insert((sid.clone(), method.clone()), subscription) - .is_some() - { - log::warn!( - "Overwriting existing subscription under {:?} ({:?}). \ + if let Some(sid) = sid { + subscription.id = Some(sid.clone()); + if self + .subscriptions + .insert((sid.clone(), method.clone()), subscription) + .is_some() + { + log::warn!( + "Overwriting existing subscription under {:?} ({:?}). \ Seems that server returned the same subscription id.", - sid, - method, - ); - } - } else { - let err = RpcError::Client(format!( - "Subscription {:?} ({:?}) rejected: {:?}", - id, method, result, - )); - - if subscription.channel.unbounded_send(result).is_err() { - log::warn!("{}, but the reply channel has closed.", err); - } - } - continue; - } - // It's not a pending request nor a notification - None if sid_and_method.is_none() => { - log::warn!("Got unexpected response with id {:?} ({:?})", id, sid_and_method); - continue; + sid, + method, + ); } - // just fall-through in case it's a notification - None => {} - }; - - let sid_and_method = if let Some(x) = sid_and_method { - x } else { - continue; - }; + let err = + RpcError::Client(format!("Subscription {:?} ({:?}) rejected: {:?}", id, method, result,)); - if let Some(subscription) = self.subscriptions.get_mut(&sid_and_method) { - let res = subscription.channel.unbounded_send(result); - if res.is_err() { - let subscription = self - .subscriptions - .remove(&sid_and_method) - .expect("Subscription was just polled; qed"); - let sid = subscription.id.expect( - "Every subscription that ends up in `self.subscriptions` has id already \ - assigned; assignment happens during response to subscribe request.", - ); - let (_id, request_str) = - self.request_builder.unsubscribe_request(subscription.unsubscribe, sid); - log::debug!("outgoing: {}", request_str); - self.outgoing.push_back(request_str); - log::debug!("unsubscribed from {:?}", sid_and_method); + if subscription.channel.unbounded_send(result).is_err() { + log::warn!("{}, but the reply channel has closed.", err); } - } else { - log::warn!("Received unexpected subscription notification: {:?}", sid_and_method); } + continue; } - None => break, + // It's not a pending request nor a notification + None if sid_and_method.is_none() => { + log::warn!("Got unexpected response with id {:?} ({:?})", id, sid_and_method); + continue; + } + // just fall-through in case it's a notification + None => {} + }; + + let sid_and_method = if let Some(x) = sid_and_method { + x + } else { + continue; + }; + + if let Some(subscription) = self.subscriptions.get_mut(&sid_and_method) { + let res = subscription.channel.unbounded_send(result); + if res.is_err() { + let subscription = self + .subscriptions + .remove(&sid_and_method) + .expect("Subscription was just polled; qed"); + let sid = subscription.id.expect( + "Every subscription that ends up in `self.subscriptions` has id already \ + assigned; assignment happens during response to subscribe request.", + ); + let (_id, request_str) = self.request_builder.unsubscribe_request(subscription.unsubscribe, sid); + log::debug!("outgoing: {}", request_str); + self.outgoing.push_back(request_str); + log::debug!("unsubscribed from {:?}", sid_and_method); + } + } else { + log::warn!("Received unexpected subscription notification: {:?}", sid_and_method); } } diff --git a/core-client/transports/src/transports/mod.rs b/core-client/transports/src/transports/mod.rs index 9df534a0d..cb35d13c3 100644 --- a/core-client/transports/src/transports/mod.rs +++ b/core-client/transports/src/transports/mod.rs @@ -19,6 +19,7 @@ pub mod ws; pub use duplex::duplex; /// Creates JSON-RPC requests +#[derive(Default)] pub struct RequestBuilder { id: u64, } @@ -26,7 +27,7 @@ pub struct RequestBuilder { impl RequestBuilder { /// Create a new RequestBuilder pub fn new() -> Self { - RequestBuilder { id: 0 } + Self::default() } fn next_id(&mut self) -> Id { diff --git a/core/Cargo.toml b/core/Cargo.toml index b1ba659e9..bd631897f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,14 +1,13 @@ [package] -authors = ["Parity Technologies "] description = "Transport agnostic rust implementation of JSON-RPC 2.0 Specification." documentation = "https://docs.rs/jsonrpc-core/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"] -license = "MIT" name = "jsonrpc-core" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true categories = [ "asynchronous", @@ -19,15 +18,15 @@ categories = [ ] [dependencies] -log = "0.4" +log.workspace = true # FIXME: Currently a lot of jsonrpc-* crates depend on entire `futures` being # re-exported but it's not strictly required for this crate. Either adapt the # remaining crates or settle for this re-export to be a single, common dependency -futures = { version = "0.3", optional = true } +futures = { workspace = true, optional = true } futures-util = { version = "0.3", default-features = false, features = ["std"] } futures-executor = { version = "0.3", optional = true } -serde = "1.0" -serde_json = "1.0" +serde.workspace = true +serde_json.workspace = true serde_derive = "1.0" [features] @@ -35,4 +34,4 @@ default = ["futures-executor", "futures"] arbitrary_precision = ["serde_json/arbitrary_precision"] [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/core/src/io.rs b/core/src/io.rs index c67ff2620..c37630f5d 100644 --- a/core/src/io.rs +++ b/core/src/io.rs @@ -41,22 +41,17 @@ pub type FutureRpcResult = future::Either< >; /// `IoHandler` json-rpc protocol compatibility -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)] pub enum Compatibility { /// Compatible only with JSON-RPC 1.x V1, /// Compatible only with JSON-RPC 2.0 + #[default] V2, /// Compatible with both Both, } -impl Default for Compatibility { - fn default() -> Self { - Compatibility::V2 - } -} - impl Compatibility { fn is_version_valid(self, version: Option) -> bool { matches!( @@ -274,9 +269,9 @@ impl> MetaIoHandler { let result = match (valid_version, self.methods.get(&method.method)) { (false, _) => Err(Error::invalid_version()), - (true, Some(&RemoteProcedure::Method(ref method))) => Ok(call_method(method)), - (true, Some(&RemoteProcedure::Alias(ref alias))) => match self.methods.get(alias) { - Some(&RemoteProcedure::Method(ref method)) => Ok(call_method(method)), + (true, Some(RemoteProcedure::Method(method))) => Ok(call_method(method)), + (true, Some(RemoteProcedure::Alias(alias))) => match self.methods.get(alias) { + Some(RemoteProcedure::Method(method)) => Ok(call_method(method)), _ => Err(Error::method_not_found()), }, (true, _) => Err(Error::method_not_found()), @@ -297,11 +292,11 @@ impl> MetaIoHandler { } match self.methods.get(¬ification.method) { - Some(&RemoteProcedure::Notification(ref notification)) => { + Some(RemoteProcedure::Notification(notification)) => { notification.execute(params, meta); } - Some(&RemoteProcedure::Alias(ref alias)) => { - if let Some(&RemoteProcedure::Notification(ref notification)) = self.methods.get(alias) { + Some(RemoteProcedure::Alias(alias)) => { + if let Some(RemoteProcedure::Notification(notification)) = self.methods.get(alias) { notification.execute(params, meta); } } diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 41ae32c10..425c82e6b 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,13 +1,13 @@ [package] -authors = ["Parity Technologies "] documentation = "https://docs.rs/jsonrpc-derive/" description = "High level, typed wrapper for `jsonrpc-core`" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -license = "MIT" name = "jsonrpc-derive" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [lib] proc-macro = true @@ -19,11 +19,11 @@ quote = "1.0.6" proc-macro-crate = "0.1.4" [dev-dependencies] -assert_matches = "1.3" -jsonrpc-core = { version = "18.0.0", path = "../core" } -jsonrpc-core-client = { version = "18.0.0", path = "../core-client" } -jsonrpc-pubsub = { version = "18.0.0", path = "../pubsub" } -jsonrpc-tcp-server = { version = "18.0.0", path = "../tcp" } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +assert_matches.workspace = true +jsonrpc-core.workspace = true +jsonrpc-core-client.workspace = true +jsonrpc-pubsub.workspace = true +jsonrpc-tcp-server.workspace = true +serde = { workspace = true, features = ["derive"] } +serde_json.workspace = true trybuild = "1.0" diff --git a/derive/src/rpc_attr.rs b/derive/src/rpc_attr.rs index b66967efb..5b695c5a1 100644 --- a/derive/src/rpc_attr.rs +++ b/derive/src/rpc_attr.rs @@ -58,7 +58,7 @@ impl RpcMethodAttribute { let attrs = method .attrs .iter() - .filter_map(|attr| Self::parse_meta(attr, &output)) + .filter_map(|attr| Self::parse_meta(attr, output)) .collect::>>()?; if attrs.len() <= 1 { @@ -81,7 +81,7 @@ impl RpcMethodAttribute { get_meta_list(meta) .and_then(|ml| get_name_value(RPC_NAME_KEY, ml)) .map_or(Err(Error::new_spanned(attr, MISSING_NAME_ERR)), |name| { - let aliases = get_meta_list(&meta).map_or(Vec::new(), |ml| get_aliases(ml)); + let aliases = get_meta_list(meta).map_or(Vec::new(), get_aliases); let raw_params = get_meta_list(meta).map_or(false, |ml| has_meta_word(RAW_PARAMS_META_WORD, ml)); let params_style = match raw_params { @@ -117,7 +117,7 @@ impl RpcMethodAttribute { }; if is_notification && returns.is_some() { - return Err(syn::Error::new_spanned(output, &"Notifications must return ()")); + return Err(syn::Error::new_spanned(output, "Notifications must return ()")); } Ok(AttributeKind::Rpc { @@ -257,7 +257,7 @@ fn get_name_value(key: &str, ml: &syn::MetaList) -> Option { fn has_meta_word(word: &str, ml: &syn::MetaList) -> bool { ml.nested.iter().any(|nested| { if let syn::NestedMeta::Meta(syn::Meta::Path(p)) = nested { - path_eq_str(&p, word) + path_eq_str(p, word) } else { false } diff --git a/derive/src/rpc_trait.rs b/derive/src/rpc_trait.rs index 25bc004b6..0eecd16a2 100644 --- a/derive/src/rpc_trait.rs +++ b/derive/src/rpc_trait.rs @@ -160,7 +160,7 @@ fn compute_method_registrations(item_trait: &syn::ItemTrait) -> Result<(Vec { return Err(syn::Error::new_spanned( - &item_trait, + item_trait, format!("subscription '{}'. {}", name, MISSING_UNSUBSCRIBE_METHOD_ERR), )); } @@ -185,7 +185,7 @@ fn generate_server_module( let mut rpc_server_trait = fold::fold_item_trait(&mut rpc_trait, item_trait.clone()); let to_delegate_method = generate_trait_item_method( - &method_registrations, + method_registrations, &rpc_server_trait, rpc_trait.has_metadata, has_pubsub_methods, @@ -218,7 +218,7 @@ fn generate_server_module( fn rpc_wrapper_mod_name(rpc_trait: &syn::ItemTrait) -> syn::Ident { let name = rpc_trait.ident.clone(); - let mod_name = format!("{}{}", RPC_MOD_NAME_PREFIX, name.to_string()); + let mod_name = format!("{}{}", RPC_MOD_NAME_PREFIX, name); syn::Ident::new(&mod_name, proc_macro2::Span::call_site()) } @@ -231,7 +231,7 @@ fn has_named_params(methods: &[RpcMethod]) -> bool { pub fn crate_name(name: &str) -> Result { proc_macro_crate::crate_name(name) .map(|name| Ident::new(&name, Span::call_site())) - .map_err(|e| Error::new(Span::call_site(), &e)) + .map_err(|e| Error::new(Span::call_site(), e)) } pub fn rpc_impl(input: syn::Item, options: &DeriveOptions) -> Result { diff --git a/derive/src/to_client.rs b/derive/src/to_client.rs index 6de28a745..f7b986914 100644 --- a/derive/src/to_client.rs +++ b/derive/src/to_client.rs @@ -13,9 +13,9 @@ pub fn generate_client_module( item_trait: &syn::ItemTrait, options: &DeriveOptions, ) -> Result { - let client_methods = generate_client_methods(methods, &options)?; + let client_methods = generate_client_methods(methods, options)?; let generics = &item_trait.generics; - let where_clause = generate_where_clause_serialization_predicates(&item_trait, true); + let where_clause = generate_where_clause_serialization_predicates(item_trait, true); let where_clause2 = where_clause.clone(); let markers = generics .params @@ -187,17 +187,13 @@ fn generate_client_methods(methods: &[MethodRegistration], options: &DeriveOptio fn get_doc_comments(attrs: &[syn::Attribute]) -> Vec { let mut doc_comments = vec![]; for attr in attrs { - match attr { - syn::Attribute { - path: syn::Path { segments, .. }, - .. - } => match &segments[0] { - syn::PathSegment { ident, .. } => { - if *ident == "doc" { - doc_comments.push(attr.to_owned()); - } - } - }, + let syn::Attribute { + path: syn::Path { segments, .. }, + .. + } = attr; + let syn::PathSegment { ident, .. } = &segments[0]; + if *ident == "doc" { + doc_comments.push(attr.to_owned()); } } doc_comments @@ -218,7 +214,6 @@ fn compute_args(method: &syn::TraitItemMethod) -> Punctuated continue, }; let syn::PathSegment { ident, .. } = &segments[0]; - let ident = ident; if *ident == "Self" { continue; } @@ -279,16 +274,15 @@ fn try_infer_returns(output: &syn::ReturnType) -> Option { match output { syn::ReturnType::Type(_, ty) => { - let segments = extract_path_segments(&**ty)?; - let check_segment = |seg: &syn::PathSegment| match seg { - syn::PathSegment { ident, arguments, .. } => { - let id = ident.to_string(); - let inner = get_first_type_argument(arguments); - if id.ends_with("Result") { - Ok(inner) - } else { - Err(inner) - } + let segments = extract_path_segments(ty)?; + let check_segment = |seg: &syn::PathSegment| { + let syn::PathSegment { ident, arguments, .. } = seg; + let id = ident.to_string(); + let inner = get_first_type_argument(arguments); + if id.ends_with("Result") { + Ok(inner) + } else { + Err(inner) } }; // Try out first argument (Result) or nested types like: diff --git a/derive/src/to_delegate.rs b/derive/src/to_delegate.rs index 7e9148a82..7ebebbe50 100644 --- a/derive/src/to_delegate.rs +++ b/derive/src/to_delegate.rs @@ -153,7 +153,7 @@ pub fn generate_trait_item_method( } }; - let predicates = generate_where_clause_serialization_predicates(&trait_item, false); + let predicates = generate_where_clause_serialization_predicates(trait_item, false); let mut method = method; method.sig.generics.make_where_clause().predicates.extend(predicates); Ok(method) @@ -224,7 +224,7 @@ impl RpcMethod { if param_types.len() > TUPLE_FIELD_NAMES.len() { return Err(syn::Error::new_spanned( &self.trait_item, - &format!("Maximum supported number of params is {}", TUPLE_FIELD_NAMES.len()), + format!("Maximum supported number of params is {}", TUPLE_FIELD_NAMES.len()), )); } let tuple_fields: &Vec<_> = &(TUPLE_FIELD_NAMES @@ -440,7 +440,7 @@ pub fn generate_where_clause_serialization_predicates( self.visiting_subscriber_arg = self.visiting_subscriber_arg && segment.ident != SUBSCRIBER_TYPE_IDENT; } fn visit_ident(&mut self, ident: &'ast syn::Ident) { - if self.trait_generics.contains(&ident) { + if self.trait_generics.contains(ident) { if self.visiting_return_type || self.visiting_subscriber_arg { self.server_to_client_type_params.insert(ident.clone()); } diff --git a/http/Cargo.toml b/http/Cargo.toml index 276c5f78d..99be5b539 100644 --- a/http/Cargo.toml +++ b/http/Cargo.toml @@ -1,27 +1,27 @@ [package] -authors = ["Parity Technologies "] description = "Rust http server using JSONRPC 2.0." documentation = "https://docs.rs/jsonrpc-http-server/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -keywords = ["jsonrpc", "json-rpc", "json", "rpc", "server"] -license = "MIT" name = "jsonrpc-http-server" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version = { workspace = true } +authors = { workspace = true } +keywords.workspace = true +repository = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +edition = { workspace = true } [dependencies] -futures = "0.3" -hyper = { version = "0.14", features = ["http1", "tcp", "server", "stream"] } -jsonrpc-core = { version = "18.0.0", path = "../core" } -jsonrpc-server-utils = { version = "18.0.0", path = "../server-utils" } -log = "0.4" +futures.workspace = true +hyper = { workspace = true, features = ["http1", "tcp", "server", "stream"] } +jsonrpc-core.workspace = true +jsonrpc-server-utils.workspace = true +log.workspace = true net2 = "0.2" -parking_lot = "0.11.0" -unicase = "2.0" +parking_lot.workspace = true +unicase.workspace = true [dev-dependencies] -env_logger = "0.7" +env_logger.workspace = true [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/http/src/handler.rs b/http/src/handler.rs index 0466ee844..4f59e3399 100644 --- a/http/src/handler.rs +++ b/http/src/handler.rs @@ -487,7 +487,7 @@ where { return Err(BodyError::TooLarge); } - request.extend_from_slice(&*chunk) + request.extend_from_slice(&chunk) } Poll::Ready(None) => { if let (Some(uri), true) = (uri, request.is_empty()) { @@ -578,7 +578,7 @@ where /// message. fn is_json(content_type: Option<&header::HeaderValue>) -> bool { match content_type.and_then(|val| val.to_str().ok()) { - Some(ref content) + Some(content) if content.eq_ignore_ascii_case("application/json") || content.eq_ignore_ascii_case("application/json; charset=utf-8") || content.eq_ignore_ascii_case("application/json;charset=utf-8") => diff --git a/http/src/lib.rs b/http/src/lib.rs index 7702df394..8f440898d 100644 --- a/http/src/lib.rs +++ b/http/src/lib.rs @@ -288,7 +288,7 @@ where handler: Arc::new(handler.into()), executor: UninitializedExecutor::Unspawned, meta_extractor: Arc::new(extractor), - request_middleware: Arc::new(NoopRequestMiddleware::default()), + request_middleware: Arc::new(NoopRequestMiddleware), cors_domains: None, cors_max_age: None, allowed_headers: cors::AccessControlAllowHeaders::Any, @@ -539,7 +539,7 @@ fn serve>( }; configure_port(reuse_port, &listener)?; listener.reuse_address(true)?; - listener.bind(&addr)?; + listener.bind(addr)?; let listener = listener.listen(1024)?; let local_addr = listener.local_addr()?; diff --git a/http/src/response.rs b/http/src/response.rs index a66fec9ca..5994fa6c5 100644 --- a/http/src/response.rs +++ b/http/src/response.rs @@ -1,6 +1,6 @@ //! Basic Request/Response structures used internally. -pub use hyper::{self, header::HeaderValue, Body, Method, StatusCode}; +pub use hyper::{self, header::HeaderValue, Body, StatusCode}; /// Simple server response structure #[derive(Debug)] diff --git a/ipc/Cargo.toml b/ipc/Cargo.toml index 1bb5d66ba..ab7e9f667 100644 --- a/ipc/Cargo.toml +++ b/ipc/Cargo.toml @@ -1,29 +1,33 @@ [package] -authors = ["Parity Technologies "] description = "IPC server for JSON-RPC" documentation = "https://docs.rs/jsonrpc-ipc-server/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -license = "MIT" name = "jsonrpc-ipc-server" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [dependencies] -futures = "0.3" -log = "0.4" -tower-service = "0.3" -jsonrpc-core = { version = "18.0.0", path = "../core" } -jsonrpc-server-utils = { version = "18.0.0", path = "../server-utils", default-features = false } -parity-tokio-ipc = "0.9" -parking_lot = "0.11.0" +futures.workspace = true +log.workspace = true +tower-service.workspace = true +jsonrpc-core.workspace = true +jsonrpc-server-utils.workspace = true +parity-tokio-ipc.workspace = true +parking_lot.workspace = true [dev-dependencies] -env_logger = "0.7" -lazy_static = "1.0" +env_logger.workspace = true +lazy_static.workspace = true [target.'cfg(not(windows))'.dev-dependencies] -tokio = { version = "1", default-features = false, features = ["net", "time", "rt-multi-thread"] } +tokio = { version = "1", default-features = false, features = [ + "net", + "time", + "rt-multi-thread", +] } [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/ipc/src/select_with_weak.rs b/ipc/src/select_with_weak.rs index 43c90b783..3e553f190 100644 --- a/ipc/src/select_with_weak.rs +++ b/ipc/src/select_with_weak.rs @@ -60,7 +60,7 @@ where type Item = S1::Item; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - let mut this = Pin::into_inner(self); + let this = Pin::into_inner(self); let mut checked_strong = false; loop { if this.use_strong { diff --git a/ipc/src/server.rs b/ipc/src/server.rs index 1f1411a47..5349d24e3 100644 --- a/ipc/src/server.rs +++ b/ipc/src/server.rs @@ -420,7 +420,7 @@ mod tests { let mut handles = Vec::new(); for _ in 0..4 { - let path = path.clone(); + let path = path; let mut stop_signal = stop_signal.clone(); handles.push(thread::spawn(move || { for _ in 0..100 { diff --git a/pubsub/Cargo.toml b/pubsub/Cargo.toml index 89c462655..5e5704f43 100644 --- a/pubsub/Cargo.toml +++ b/pubsub/Cargo.toml @@ -1,27 +1,26 @@ [package] -authors = ["Parity Technologies "] description = "Publish-Subscribe extension for jsonrpc." documentation = "https://docs.rs/jsonrpc-pubsub/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -keywords = ["jsonrpc", "json-rpc", "json", "rpc", "macros"] -license = "MIT" name = "jsonrpc-pubsub" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [dependencies] -futures = { version = "0.3", features = ["thread-pool"] } -jsonrpc-core = { version = "18.0.0", path = "../core" } -lazy_static = "1.4" -log = "0.4" +futures = { workspace = true, features = ["thread-pool"] } +jsonrpc-core.workspace = true +lazy_static.workspace = true +log.workspace = true parking_lot = "0.11.0" -rand = "0.7" -serde = "1.0" +rand = "0.8" +serde.workspace = true [dev-dependencies] -jsonrpc-tcp-server = { version = "18.0.0", path = "../tcp" } -serde_json = "1.0" +jsonrpc-tcp-server.workspace = true +serde_json.workspace = true [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/pubsub/src/handler.rs b/pubsub/src/handler.rs index 912f7701f..01209415e 100644 --- a/pubsub/src/handler.rs +++ b/pubsub/src/handler.rs @@ -86,9 +86,9 @@ impl> ::std::ops::DerefMut for PubSubH } } -impl> Into> for PubSubHandler { - fn into(self) -> core::MetaIoHandler { - self.handler +impl> From> for core::MetaIoHandler { + fn from(val: PubSubHandler) -> Self { + val.handler } } diff --git a/pubsub/src/manager.rs b/pubsub/src/manager.rs index 1948dde10..a292b5855 100644 --- a/pubsub/src/manager.rs +++ b/pubsub/src/manager.rs @@ -111,9 +111,9 @@ impl IdProvider for RandomStringIdProvider { fn next_id(&self) -> Self::Id { let mut rng = thread_rng(); let id: String = iter::repeat(()) - .map(|()| rng.sample(Alphanumeric)) + .map(|()| rng.sample(Alphanumeric) as char) .take(self.len) - .collect(); + .collect::(); id } } diff --git a/server-utils/Cargo.toml b/server-utils/Cargo.toml index c03b74f06..b66ad52fd 100644 --- a/server-utils/Cargo.toml +++ b/server-utils/Cargo.toml @@ -1,27 +1,32 @@ [package] -authors = ["Parity Technologies "] description = "Server utils for jsonrpc-core crate." documentation = "https://docs.rs/jsonrpc-server-utils/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"] -license = "MIT" name = "jsonrpc-server-utils" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [dependencies] bytes = "1.0" -futures = "0.3" +futures.workspace = true globset = "0.4" jsonrpc-core = { version = "18.0.0", path = "../core" } -lazy_static = "1.1.0" -log = "0.4" -tokio = { version = "1", features = ["rt-multi-thread", "io-util", "time", "net"] } -tokio-util = { version = "0.6", features = ["codec"] } +lazy_static.workspace = true +log.workspace = true +tokio = { workspace = true, features = [ + "rt-multi-thread", + "io-util", + "time", + "net", +] } +tokio-util = { workspace = true, features = ["codec"] } tokio-stream = { version = "0.1", features = ["net"] } -unicase = "2.0" +unicase.workspace = true [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/server-utils/src/cors.rs b/server-utils/src/cors.rs index 78eab604c..9a5351aaa 100644 --- a/server-utils/src/cors.rs +++ b/server-utils/src/cors.rs @@ -172,11 +172,11 @@ impl AllowCors { } } -impl Into> for AllowCors { - fn into(self) -> Option { +impl From> for Option { + fn from(val: AllowCors) -> Self { use self::AllowCors::*; - match self { + match val { NotRequired | Invalid => None, Ok(header) => Some(header), } @@ -206,13 +206,13 @@ pub fn get_cors_allow_origin( match allowed.as_ref() { None if *origin == "null" => AllowCors::Ok(AccessControlAllowOrigin::Null), None => AllowCors::Ok(AccessControlAllowOrigin::Value(Origin::parse(origin))), - Some(ref allowed) if *origin == "null" => allowed + Some(allowed) if *origin == "null" => allowed .iter() .find(|cors| **cors == AccessControlAllowOrigin::Null) .cloned() .map(AllowCors::Ok) .unwrap_or(AllowCors::Invalid), - Some(ref allowed) => allowed + Some(allowed) => allowed .iter() .find(|cors| match **cors { AccessControlAllowOrigin::Any => true, @@ -238,7 +238,7 @@ pub fn get_cors_allow_headers, O, F: Fn(T) -> O>( if let AccessControlAllowHeaders::Only(only) = cors_allow_headers { let are_all_allowed = headers.all(|header| { let name = &Ascii::new(header.as_ref()); - only.iter().any(|h| Ascii::new(&*h) == name) || ALWAYS_ALLOWED_HEADERS.contains(name) + only.iter().any(|h| Ascii::new(h) == name) || ALWAYS_ALLOWED_HEADERS.contains(name) }); if !are_all_allowed { @@ -258,7 +258,7 @@ pub fn get_cors_allow_headers, O, F: Fn(T) -> O>( .filter(|header| { let name = &Ascii::new(header.as_ref()); filtered = true; - only.iter().any(|h| Ascii::new(&*h) == name) || ALWAYS_ALLOWED_HEADERS.contains(name) + only.iter().any(|h| Ascii::new(h) == name) || ALWAYS_ALLOWED_HEADERS.contains(name) }) .map(to_result) .collect(); diff --git a/server-utils/src/hosts.rs b/server-utils/src/hosts.rs index ab2270ea6..48a27ffdf 100644 --- a/server-utils/src/hosts.rs +++ b/server-utils/src/hosts.rs @@ -128,10 +128,10 @@ pub enum DomainsValidation { Disabled, } -impl Into>> for DomainsValidation { - fn into(self) -> Option> { +impl From> for Option> { + fn from(val: DomainsValidation) -> Self { use self::DomainsValidation::*; - match self { + match val { AllowOnly(list) => Some(list), Disabled => None, } diff --git a/server-utils/src/reactor.rs b/server-utils/src/reactor.rs index 041328528..646184a3b 100644 --- a/server-utils/src/reactor.rs +++ b/server-utils/src/reactor.rs @@ -75,7 +75,7 @@ impl Executor { /// A handle to running event loop. Dropping the handle will cause event loop to finish. #[derive(Debug)] pub struct RpcEventLoop { - executor: TaskExecutor, + _executor: TaskExecutor, close: Option>, runtime: Option, } @@ -105,14 +105,14 @@ impl RpcEventLoop { } let runtime = tb.build()?; - let executor = runtime.handle().to_owned(); + let _executor = runtime.handle().to_owned(); runtime.spawn(async { let _ = stopped.await; }); Ok(RpcEventLoop { - executor, + _executor, close: Some(stop), runtime: Some(runtime), }) diff --git a/stdio/Cargo.toml b/stdio/Cargo.toml index fe39581ea..d7f62b251 100644 --- a/stdio/Cargo.toml +++ b/stdio/Cargo.toml @@ -1,25 +1,25 @@ [package] -authors = ["Parity Technologies "] description = "STDIN/STDOUT server for JSON-RPC" documentation = "https://docs.rs/jsonrpc-stdio-server/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -license = "MIT" name = "jsonrpc-stdio-server" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [dependencies] -futures = "0.3" +futures.workspace = true jsonrpc-core = { version = "18.0.0", path = "../core" } -log = "0.4" -tokio = { version = "1", features = ["io-std", "io-util"] } -tokio-util = { version = "0.6", features = ["codec"] } +log.workspace = true +tokio = { workspace = true, features = ["io-std", "io-util"] } +tokio-util = { workspace = true, features = ["codec"] } [dev-dependencies] -tokio = { version = "1", features = ["rt", "macros"] } -lazy_static = "1.0" -env_logger = "0.7" +tokio = { workspace = true, features = ["rt", "macros"] } +lazy_static.workspace = true +env_logger.workspace = true [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 3b5eefe33..fcf9db932 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,24 +1,24 @@ [package] -authors = ["Parity Technologies "] description = "TCP/IP server for JSON-RPC" documentation = "https://docs.rs/jsonrpc-tcp-server/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -license = "MIT" name = "jsonrpc-tcp-server" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [dependencies] -jsonrpc-core = { version = "18.0.0", path = "../core" } -jsonrpc-server-utils = { version = "18.0.0", path = "../server-utils" } -log = "0.4" -parking_lot = "0.11.0" -tower-service = "0.3" +jsonrpc-core.workspace = true +jsonrpc-server-utils.workspace = true +log.workspace = true +parking_lot.workspace = true +tower-service.workspace = true [dev-dependencies] -lazy_static = "1.0" -env_logger = "0.7" +lazy_static.workspace = true +env_logger.workspace = true [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/test/Cargo.toml b/test/Cargo.toml index e3f150450..5393b38ca 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,25 +1,28 @@ [package] name = "jsonrpc-test" description = "Simple test framework for JSON-RPC." -version = "18.0.0" authors = ["Tomasz DrwiÄ™ga "] -license = "MIT" -homepage = "https://github.com/paritytech/jsonrpc" -repository = "https://github.com/paritytech/jsonrpc" documentation = "https://docs.rs/jsonrpc-test/" -edition = "2018" +version.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [dependencies] jsonrpc-core = { version = "18.0.0", path = "../core" } jsonrpc-core-client = { version = "18.0.0", path = "../core-client" } jsonrpc-pubsub = { version = "18.0.0", path = "../pubsub" } -log = "0.4" -serde = "1.0" -serde_json = "1.0" +log.workspace = true +serde.workspace = true +serde_json.workspace = true [features] -arbitrary_precision = ["jsonrpc-core-client/arbitrary_precision", "serde_json/arbitrary_precision", "jsonrpc-core/arbitrary_precision"] +arbitrary_precision = [ + "jsonrpc-core-client/arbitrary_precision", + "serde_json/arbitrary_precision", + "jsonrpc-core/arbitrary_precision", +] [dev-dependencies] jsonrpc-derive = { version = "18.0.0", path = "../derive" } - diff --git a/ws/Cargo.toml b/ws/Cargo.toml index 3807dd81c..7f68e9fde 100644 --- a/ws/Cargo.toml +++ b/ws/Cargo.toml @@ -1,22 +1,22 @@ [package] -authors = ["Parity Technologies "] description = "WebSockets server for JSON-RPC" documentation = "https://docs.rs/jsonrpc-ws-server/" -edition = "2018" -homepage = "https://github.com/paritytech/jsonrpc" -license = "MIT" name = "jsonrpc-ws-server" -repository = "https://github.com/paritytech/jsonrpc" -version = "18.0.0" +version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true +edition.workspace = true [dependencies] -futures = "0.3" -jsonrpc-core = { version = "18.0.0", path = "../core" } -jsonrpc-server-utils = { version = "18.0.0", path = "../server-utils" } -log = "0.4" -parking_lot = "0.11.0" +futures.workspace = true +jsonrpc-core.workspace = true +jsonrpc-server-utils.workspace = true +log.workspace = true +parking_lot.workspace = true slab = "0.4" parity-ws = "0.11.1" [badges] -travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} +travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } diff --git a/ws/src/error.rs b/ws/src/error.rs index 553c27c50..9028e1d5c 100644 --- a/ws/src/error.rs +++ b/ws/src/error.rs @@ -1,6 +1,5 @@ -use std::{error, fmt, io, result}; - use crate::ws; +use std::{error, fmt, io, result}; /// WebSockets Server Error #[derive(Debug)] @@ -8,7 +7,7 @@ pub enum Error { /// Io Error Io(io::Error), /// WebSockets Error - WsError(ws::Error), + WsError(Box), /// Connection Closed ConnectionClosed, } @@ -46,7 +45,7 @@ impl From for Error { fn from(err: ws::Error) -> Self { match err.kind { ws::ErrorKind::Io(err) => Error::Io(err), - _ => Error::WsError(err), + _ => Error::WsError(err.into()), } } } diff --git a/ws/src/session.rs b/ws/src/session.rs index eef7b0e9e..1efde9653 100644 --- a/ws/src/session.rs +++ b/ws/src/session.rs @@ -243,12 +243,12 @@ where .protocols() .ok() .map(|protos| protos.into_iter().map(Into::into).collect()) - .unwrap_or_else(Vec::new); + .unwrap_or_default(); self.metadata = Some(self.meta_extractor.extract(&self.context)); match action { MiddlewareAction::Proceed => ws::Response::from_request(req).map(|mut res| { - if let Some(protocol) = self.context.protocols.get(0) { + if let Some(protocol) = self.context.protocols.first() { res.set_protocol(protocol); } res From 8457ec69689955a5de63ea485d67c288960a675d Mon Sep 17 00:00:00 2001 From: Rodolfo Date: Thu, 25 Apr 2024 14:27:11 -0300 Subject: [PATCH 02/10] Fix local versions --- Cargo.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 84ef78b65..81e7cb2bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,13 +26,13 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"] [workspace.dependencies] # local projects -jsonrpc-core = { version = "18.0.0", path = "./core" } -jsonrpc-core-client = { version = "18.0.0", path = "./core-client" } -jsonrpc-http-server = { version = "18.0.0", path = "./http" } -jsonrpc-ipc-server = { version = "18.0.0", path = "./ipc" } -jsonrpc-pubsub = { version = "18.0.0", path = "./pubsub" } -jsonrpc-server-utils = { version = "18.0.0", path = "./server-utils" } -jsonrpc-tcp-server = { version = "18.0.0", path = "./tcp" } +jsonrpc-core = { version = "18.0.1", path = "./core" } +jsonrpc-core-client = { version = "18.0.1", path = "./core-client" } +jsonrpc-http-server = { version = "18.0.1", path = "./http" } +jsonrpc-ipc-server = { version = "18.0.1", path = "./ipc" } +jsonrpc-pubsub = { version = "18.0.1", path = "./pubsub" } +jsonrpc-server-utils = { version = "18.0.1", path = "./server-utils" } +jsonrpc-tcp-server = { version = "18.0.1", path = "./tcp" } assert_matches = "1.3" env_logger = "0.7" From 828eea1e187fadb7ccd9a4adba7461daa3752c4c Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:26:05 -0300 Subject: [PATCH 03/10] Update Cargo.toml --- core-client/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-client/Cargo.toml b/core-client/Cargo.toml index d0813580b..f9e44bbde 100644 --- a/core-client/Cargo.toml +++ b/core-client/Cargo.toml @@ -26,7 +26,7 @@ arbitrary_precision = ["jsonrpc-client-transports/arbitrary_precision"] [dependencies] jsonrpc-client-transports = { version = "18.0.0", path = "./transports", default-features = false } -futures = { version = "0.3", features = ["compat"] } +futures = { workspace = true, features = ["compat"] } [badges] travis-ci = { repository = "paritytech/jsonrpc", branch = "master" } From f3759ec5a569624755da3922548090015a58b657 Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:30:18 -0300 Subject: [PATCH 04/10] Adding jsonrpc-derive to the workspace dependencies --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 81e7cb2bd..f09fe3530 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"] # local projects jsonrpc-core = { version = "18.0.1", path = "./core" } jsonrpc-core-client = { version = "18.0.1", path = "./core-client" } +jsonrpc-derive = { version = "18.0.0", path = "./derive" } jsonrpc-http-server = { version = "18.0.1", path = "./http" } jsonrpc-ipc-server = { version = "18.0.1", path = "./ipc" } jsonrpc-pubsub = { version = "18.0.1", path = "./pubsub" } From 09fa00c9dc543f253bc76887583967a2659b720f Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:32:00 -0300 Subject: [PATCH 05/10] using workspace dependencies --- test/Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Cargo.toml b/test/Cargo.toml index 5393b38ca..896ebe761 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -10,9 +10,9 @@ license.workspace = true edition.workspace = true [dependencies] -jsonrpc-core = { version = "18.0.0", path = "../core" } -jsonrpc-core-client = { version = "18.0.0", path = "../core-client" } -jsonrpc-pubsub = { version = "18.0.0", path = "../pubsub" } +jsonrpc-core.workspace = true +jsonrpc-core-client.workspace = true +jsonrpc-pubsub.workspace = true log.workspace = true serde.workspace = true serde_json.workspace = true @@ -25,4 +25,4 @@ arbitrary_precision = [ ] [dev-dependencies] -jsonrpc-derive = { version = "18.0.0", path = "../derive" } +jsonrpc-derive.workspace = true From ae3db411bb387d70464d346be268236680892b1f Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:34:39 -0300 Subject: [PATCH 06/10] Using workspace dependencies --- ipc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/Cargo.toml b/ipc/Cargo.toml index ab7e9f667..6571c0100 100644 --- a/ipc/Cargo.toml +++ b/ipc/Cargo.toml @@ -23,7 +23,7 @@ env_logger.workspace = true lazy_static.workspace = true [target.'cfg(not(windows))'.dev-dependencies] -tokio = { version = "1", default-features = false, features = [ +tokio = { workspace = true, default-features = false, features = [ "net", "time", "rt-multi-thread", From 6ce77f803bcb4c31efb0744f7945733cfeb54053 Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:35:40 -0300 Subject: [PATCH 07/10] Using workspace dependencies --- server-utils/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-utils/Cargo.toml b/server-utils/Cargo.toml index b66ad52fd..008df46d9 100644 --- a/server-utils/Cargo.toml +++ b/server-utils/Cargo.toml @@ -14,7 +14,7 @@ edition.workspace = true bytes = "1.0" futures.workspace = true globset = "0.4" -jsonrpc-core = { version = "18.0.0", path = "../core" } +jsonrpc-core.workspace = true lazy_static.workspace = true log.workspace = true tokio = { workspace = true, features = [ From bfee58a54e17dd5045020b7042ccace5d6e4e1d7 Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:36:24 -0300 Subject: [PATCH 08/10] Using workspace dependencies --- stdio/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdio/Cargo.toml b/stdio/Cargo.toml index d7f62b251..16539c33e 100644 --- a/stdio/Cargo.toml +++ b/stdio/Cargo.toml @@ -11,7 +11,7 @@ edition.workspace = true [dependencies] futures.workspace = true -jsonrpc-core = { version = "18.0.0", path = "../core" } +jsonrpc-core.workspace = true log.workspace = true tokio = { workspace = true, features = ["io-std", "io-util"] } tokio-util = { workspace = true, features = ["codec"] } From 0f19ff24b0cc602cad01994d90d8558547b96a0c Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:38:18 -0300 Subject: [PATCH 09/10] Adding workspace dependencies --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index f09fe3530..30848ae6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"] # local projects jsonrpc-core = { version = "18.0.1", path = "./core" } jsonrpc-core-client = { version = "18.0.1", path = "./core-client" } +jsonrpc-client-transports = { version = "18.0.0", path = "./core-client/transports" } jsonrpc-derive = { version = "18.0.0", path = "./derive" } jsonrpc-http-server = { version = "18.0.1", path = "./http" } jsonrpc-ipc-server = { version = "18.0.1", path = "./ipc" } From ca0adf7795342810656b43bfb9b16fa32428f9f0 Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:38:55 -0300 Subject: [PATCH 10/10] Update Cargo.toml --- core-client/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-client/Cargo.toml b/core-client/Cargo.toml index f9e44bbde..5e5ba6b9e 100644 --- a/core-client/Cargo.toml +++ b/core-client/Cargo.toml @@ -25,7 +25,7 @@ ipc = ["jsonrpc-client-transports/ipc"] arbitrary_precision = ["jsonrpc-client-transports/arbitrary_precision"] [dependencies] -jsonrpc-client-transports = { version = "18.0.0", path = "./transports", default-features = false } +jsonrpc-client-transports = { workspace = true, default-features = false } futures = { workspace = true, features = ["compat"] } [badges]