Bump prost, prost-types, and tonic (#18537)

* Bump prost+tonic and accommodate generated service changes

* Unignore advisory

* Fixup .proto error list
This commit is contained in:
Tyera Eulberg
2021-07-09 11:31:26 -06:00
committed by GitHub
parent 31443c5c61
commit 761de8b1a3
12 changed files with 121 additions and 83 deletions

53
Cargo.lock generated
View File

@ -1853,12 +1853,13 @@ dependencies = [
[[package]] [[package]]
name = "http-body" name = "http-body"
version = "0.4.0" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes 1.0.1",
"http", "http",
"pin-project-lite 0.2.4",
] ]
[[package]] [[package]]
@ -1934,7 +1935,7 @@ dependencies = [
"futures-util", "futures-util",
"h2 0.3.0", "h2 0.3.0",
"http", "http",
"http-body 0.4.0", "http-body 0.4.2",
"httparse", "httparse",
"httpdate", "httpdate",
"itoa", "itoa",
@ -1961,6 +1962,18 @@ dependencies = [
"webpki", "webpki",
] ]
[[package]]
name = "hyper-timeout"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
dependencies = [
"hyper 0.14.3",
"pin-project-lite 0.2.4",
"tokio 1.8.1",
"tokio-io-timeout",
]
[[package]] [[package]]
name = "hyper-tls" name = "hyper-tls"
version = "0.5.0" version = "0.5.0"
@ -3175,9 +3188,9 @@ dependencies = [
[[package]] [[package]]
name = "prost" name = "prost"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes 1.0.1",
"prost-derive", "prost-derive",
@ -3185,12 +3198,12 @@ dependencies = [
[[package]] [[package]]
name = "prost-derive" name = "prost-derive"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools 0.9.0", "itertools 0.10.1",
"proc-macro2 1.0.24", "proc-macro2 1.0.24",
"quote 1.0.6", "quote 1.0.6",
"syn 1.0.67", "syn 1.0.67",
@ -3198,9 +3211,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-types" name = "prost-types"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes 1.0.1",
"prost", "prost",
@ -3586,7 +3599,7 @@ dependencies = [
"futures-core", "futures-core",
"futures-util", "futures-util",
"http", "http",
"http-body 0.4.0", "http-body 0.4.2",
"hyper 0.14.3", "hyper 0.14.3",
"hyper-rustls", "hyper-rustls",
"hyper-tls", "hyper-tls",
@ -6353,6 +6366,16 @@ dependencies = [
"log 0.4.14", "log 0.4.14",
] ]
[[package]]
name = "tokio-io-timeout"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9"
dependencies = [
"pin-project-lite 0.2.4",
"tokio 1.8.1",
]
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "0.2.6" version = "0.2.6"
@ -6578,9 +6601,9 @@ dependencies = [
[[package]] [[package]]
name = "tonic" name = "tonic"
version = "0.4.3" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ac42cd97ac6bd2339af5bcabf105540e21e45636ec6fa6aae5e85d44db31be0" checksum = "b584f064fdfc50017ec39162d5aebce49912f1eb16fd128e04b7f4ce4907c7e5"
dependencies = [ dependencies = [
"async-stream", "async-stream",
"async-trait", "async-trait",
@ -6590,8 +6613,9 @@ dependencies = [
"futures-util", "futures-util",
"h2 0.3.0", "h2 0.3.0",
"http", "http",
"http-body 0.4.0", "http-body 0.4.2",
"hyper 0.14.3", "hyper 0.14.3",
"hyper-timeout",
"percent-encoding 2.1.0", "percent-encoding 2.1.0",
"pin-project 1.0.7", "pin-project 1.0.7",
"prost", "prost",
@ -6601,6 +6625,7 @@ dependencies = [
"tokio-stream", "tokio-stream",
"tokio-util 0.6.3", "tokio-util 0.6.3",
"tower", "tower",
"tower-layer",
"tower-service", "tower-service",
"tracing", "tracing",
"tracing-futures", "tracing-futures",

View File

@ -39,10 +39,5 @@ cargo_audit_ignores=(
# https://github.com/paritytech/libsecp256k1/issues/66 # https://github.com/paritytech/libsecp256k1/issues/66
--ignore RUSTSEC-2020-0146 --ignore RUSTSEC-2020-0146
# prost-types: Conversion from `prost_types::Timestamp` to `SystemTime` can cause an overflow and panic
#
# Blocked on googleapi protobuf build errors
--ignore RUSTSEC-2021-0073
) )
scripts/cargo-for-all-lock-files.sh stable audit "${cargo_audit_ignores[@]}" scripts/cargo-for-all-lock-files.sh stable audit "${cargo_audit_ignores[@]}"

View File

@ -26,7 +26,7 @@ lazy_static = "1.4.0"
libc = "0.2.98" libc = "0.2.98"
log = { version = "0.4.14" } log = { version = "0.4.14" }
num_cpus = "1.13.0" num_cpus = "1.13.0"
prost = "0.7.0" prost = "0.8.0"
rand = "0.7.0" rand = "0.7.0"
rand_chacha = "0.2.2" rand_chacha = "0.2.2"
rayon = "1.5.1" rayon = "1.5.1"

View File

@ -18,8 +18,8 @@ enum-iterator = "0.6.0"
flate2 = "1.0.20" flate2 = "1.0.20"
goauth = "0.10.0" goauth = "0.10.0"
log = "0.4.14" log = "0.4.14"
prost = "0.7.0" prost = "0.8.0"
prost-types = "0.7.0" prost-types = "0.8.0"
rand_core = "0.6.3" rand_core = "0.6.3"
serde = "1.0.126" serde = "1.0.126"
serde_derive = "1.0.103" serde_derive = "1.0.103"
@ -29,7 +29,7 @@ solana-storage-proto = { path = "../storage-proto", version = "=1.8.0" }
solana-transaction-status = { path = "../transaction-status", version = "=1.8.0" } solana-transaction-status = { path = "../transaction-status", version = "=1.8.0" }
thiserror = "1.0" thiserror = "1.0"
futures = "0.3.15" futures = "0.3.15"
tonic = { version = "0.4.3", features = ["tls", "transport"] } tonic = { version = "0.5.0", features = ["tls", "transport"] }
zstd = "0.9.0" zstd = "0.9.0"
[lib] [lib]

View File

@ -88,9 +88,9 @@ dependencies = [
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [ dependencies = [
"either", "either",
] ]
@ -143,9 +143,9 @@ dependencies = [
[[package]] [[package]]
name = "prost" name = "prost"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
dependencies = [ dependencies = [
"bytes", "bytes",
"prost-derive", "prost-derive",
@ -153,9 +153,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-build" name = "prost-build"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603"
dependencies = [ dependencies = [
"bytes", "bytes",
"heck", "heck",
@ -171,9 +171,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-derive" name = "prost-derive"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools", "itertools",
@ -184,9 +184,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-types" name = "prost-types"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
dependencies = [ dependencies = [
"bytes", "bytes",
"prost", "prost",
@ -313,9 +313,9 @@ dependencies = [
[[package]] [[package]]
name = "tonic-build" name = "tonic-build"
version = "0.4.0" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e8546fd40d56d28089835c0a81bb396848103b00f888aea42d46eb5974df07" checksum = "25db9a497663a9a779693ef67b6e6aef8345b3d3ff8d50ef92eae6c88cb1e386"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"prost-build", "prost-build",

View File

@ -12,4 +12,4 @@ version = "1.8.0"
[workspace] [workspace]
[dependencies] [dependencies]
tonic-build = "0.4.0" tonic-build = "0.5.0"

View File

@ -898,6 +898,7 @@ pub mod bigtable_client {
#![allow(unused_variables, dead_code, missing_docs)] #![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*; use tonic::codegen::*;
#[doc = " Service for reading from and writing to existing Bigtable tables."] #[doc = " Service for reading from and writing to existing Bigtable tables."]
#[derive(Debug, Clone)]
pub struct BigtableClient<T> { pub struct BigtableClient<T> {
inner: tonic::client::Grpc<T>, inner: tonic::client::Grpc<T>,
} }
@ -915,17 +916,43 @@ pub mod bigtable_client {
impl<T> BigtableClient<T> impl<T> BigtableClient<T>
where where
T: tonic::client::GrpcService<tonic::body::BoxBody>, T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static, T::ResponseBody: Body + Send + Sync + 'static,
T::Error: Into<StdError>, T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send, <T::ResponseBody as Body>::Error: Into<StdError> + Send,
{ {
pub fn new(inner: T) -> Self { pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner); let inner = tonic::client::Grpc::new(inner);
Self { inner } Self { inner }
} }
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self { pub fn with_interceptor<F>(
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); inner: T,
Self { inner } interceptor: F,
) -> BigtableClient<InterceptedService<T, F>>
where
F: FnMut(tonic::Request<()>) -> Result<tonic::Request<()>, tonic::Status>,
T: Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
BigtableClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
} }
#[doc = " Streams back the contents of all requested rows in key order, optionally"] #[doc = " Streams back the contents of all requested rows in key order, optionally"]
#[doc = " applying the same Reader filter to each. Depending on their size,"] #[doc = " applying the same Reader filter to each. Depending on their size,"]
@ -1053,16 +1080,4 @@ pub mod bigtable_client {
self.inner.unary(request.into_request(), path, codec).await self.inner.unary(request.into_request(), path, codec).await
} }
} }
impl<T: Clone> Clone for BigtableClient<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}
impl<T> std::fmt::Debug for BigtableClient<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "BigtableClient {{ ... }}")
}
}
} }

View File

@ -8,7 +8,10 @@ use crate::{
use log::*; use log::*;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use thiserror::Error; use thiserror::Error;
use tonic::{metadata::MetadataValue, transport::ClientTlsConfig, Request}; use tonic::{
codegen::InterceptedService, metadata::MetadataValue, transport::ClientTlsConfig, Request,
Status,
};
mod google { mod google {
mod rpc { mod rpc {
@ -93,6 +96,7 @@ impl std::convert::From<tonic::Status> for Error {
} }
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;
type InterceptedRequestResult = std::result::Result<Request<()>, Status>;
#[derive(Clone)] #[derive(Clone)]
pub struct BigTableConnection { pub struct BigTableConnection {
@ -177,12 +181,12 @@ impl BigTableConnection {
/// ///
/// Clients require `&mut self`, due to `Tonic::transport::Channel` limitations, however /// Clients require `&mut self`, due to `Tonic::transport::Channel` limitations, however
/// creating new clients is cheap and thus can be used as a work around for ease of use. /// creating new clients is cheap and thus can be used as a work around for ease of use.
pub fn client(&self) -> BigTable { pub fn client(&self) -> BigTable<impl FnMut(Request<()>) -> InterceptedRequestResult> {
let client = if let Some(access_token) = &self.access_token { let access_token = self.access_token.clone();
let access_token = access_token.clone(); let client = bigtable_client::BigtableClient::with_interceptor(
bigtable_client::BigtableClient::with_interceptor( self.channel.clone(),
self.channel.clone(), move |mut req: Request<()>| {
move |mut req: Request<()>| { if let Some(access_token) = &access_token {
match MetadataValue::from_str(&access_token.get()) { match MetadataValue::from_str(&access_token.get()) {
Ok(authorization_header) => { Ok(authorization_header) => {
req.metadata_mut() req.metadata_mut()
@ -192,12 +196,10 @@ impl BigTableConnection {
warn!("Failed to set authorization header: {}", err); warn!("Failed to set authorization header: {}", err);
} }
} }
Ok(req) }
}, Ok(req)
) },
} else { );
bigtable_client::BigtableClient::new(self.channel.clone())
};
BigTable { BigTable {
access_token: self.access_token.clone(), access_token: self.access_token.clone(),
client, client,
@ -239,14 +241,14 @@ impl BigTableConnection {
} }
} }
pub struct BigTable { pub struct BigTable<F: FnMut(Request<()>) -> InterceptedRequestResult> {
access_token: Option<AccessToken>, access_token: Option<AccessToken>,
client: bigtable_client::BigtableClient<tonic::transport::Channel>, client: bigtable_client::BigtableClient<InterceptedService<tonic::transport::Channel, F>>,
table_prefix: String, table_prefix: String,
timeout: Option<Duration>, timeout: Option<Duration>,
} }
impl BigTable { impl<F: FnMut(Request<()>) -> InterceptedRequestResult> BigTable<F> {
async fn decode_read_rows_response( async fn decode_read_rows_response(
&self, &self,
mut rrr: tonic::codec::Streaming<ReadRowsResponse>, mut rrr: tonic::codec::Streaming<ReadRowsResponse>,

View File

@ -12,7 +12,7 @@ edition = "2018"
[dependencies] [dependencies]
bincode = "1.3.3" bincode = "1.3.3"
bs58 = "0.4.0" bs58 = "0.4.0"
prost = "0.7.0" prost = "0.8.0"
serde = "1.0.126" serde = "1.0.126"
serde_derive = "1.0.103" serde_derive = "1.0.103"
solana-account-decoder = { path = "../account-decoder", version = "=1.8.0" } solana-account-decoder = { path = "../account-decoder", version = "=1.8.0" }

View File

@ -88,9 +88,9 @@ dependencies = [
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [ dependencies = [
"either", "either",
] ]
@ -143,9 +143,9 @@ dependencies = [
[[package]] [[package]]
name = "prost" name = "prost"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
dependencies = [ dependencies = [
"bytes", "bytes",
"prost-derive", "prost-derive",
@ -153,9 +153,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-build" name = "prost-build"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603"
dependencies = [ dependencies = [
"bytes", "bytes",
"heck", "heck",
@ -171,9 +171,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-derive" name = "prost-derive"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools", "itertools",
@ -184,9 +184,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-types" name = "prost-types"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
dependencies = [ dependencies = [
"bytes", "bytes",
"prost", "prost",
@ -313,9 +313,9 @@ dependencies = [
[[package]] [[package]]
name = "tonic-build" name = "tonic-build"
version = "0.4.0" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e8546fd40d56d28089835c0a81bb396848103b00f888aea42d46eb5974df07" checksum = "25db9a497663a9a779693ef67b6e6aef8345b3d3ff8d50ef92eae6c88cb1e386"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"prost-build", "prost-build",

View File

@ -12,4 +12,4 @@ version = "1.8.0"
[workspace] [workspace]
[dependencies] [dependencies]
tonic-build = "0.4.0" tonic-build = "0.5.0"

View File

@ -99,6 +99,7 @@ enum InstructionErrorType {
INVALID_ACCOUNT_OWNER = 46; INVALID_ACCOUNT_OWNER = 46;
ARITHMETIC_OVERFLOW = 47; ARITHMETIC_OVERFLOW = 47;
UNSUPPORTED_SYSVAR = 48; UNSUPPORTED_SYSVAR = 48;
ILLEGAL_OWNER = 49;
} }
message UnixTimestamp { message UnixTimestamp {