From d53228591f7395c8a882a3927f09c1e9b8b98cf9 Mon Sep 17 00:00:00 2001 From: Mikhail Zabaluev Date: Mon, 12 Jul 2021 16:18:41 +0300 Subject: [PATCH] Update to tonic 0.5 and prost 0.8 --- chain-network/Cargo.toml | 7 ++++--- chain-network/src/grpc/client.rs | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/chain-network/Cargo.toml b/chain-network/Cargo.toml index 48f58f024..c1728491c 100644 --- a/chain-network/Cargo.toml +++ b/chain-network/Cargo.toml @@ -9,13 +9,14 @@ license = "MIT OR Apache-2.0" chain-crypto = { path = "../chain-crypto" } async-trait = "0.1" futures = "0.3" +http-body = "0.4" pin-project = "1.0" -prost = "0.7" +prost = "0.8" rand_core = "0.6" thiserror = "1.0" [dependencies.tonic] -version = "0.4" +version = "0.5" default-features = false features = ["codegen", "prost"] @@ -23,7 +24,7 @@ features = ["codegen", "prost"] rand = "0.8" [build-dependencies.tonic-build] -version = "0.4" +version = "0.5" default-features = false features = ["prost"] diff --git a/chain-network/src/grpc/client.rs b/chain-network/src/grpc/client.rs index 3caf5da0d..0225b51b5 100644 --- a/chain-network/src/grpc/client.rs +++ b/chain-network/src/grpc/client.rs @@ -12,9 +12,10 @@ use crate::data::{Gossip, HandshakeResponse}; use crate::error::{Error, HandshakeError}; use crate::PROTOCOL_VERSION; use futures::prelude::*; -use tonic::body::{Body, BoxBody}; +use http_body::Body; +use tonic::body::BoxBody; use tonic::client::GrpcService; -use tonic::codegen::{HttpBody, StdError}; +use tonic::codegen::StdError; #[cfg(feature = "legacy")] use tonic::metadata::MetadataValue; @@ -23,6 +24,7 @@ use tonic::metadata::MetadataValue; use tonic::transport; use std::convert::TryFrom; +use std::fmt::Debug; #[cfg(feature = "transport")] use std::convert::TryInto; @@ -54,9 +56,9 @@ impl Builder { pub fn build(&self, service: T) -> Client where T: GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { Client { inner: proto::node_client::NodeClient::new(service), @@ -110,9 +112,9 @@ impl Client { impl Client where T: GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { pub fn new(service: T) -> Self { Builder::new().build(service) @@ -135,9 +137,10 @@ impl Client where T: GrpcService + Send, T::Future: Send, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, + T: Debug, // https://github.com/hyperium/tonic/issues/718 { /// Requests the identifier of the genesis block from the service node. ///