diff --git a/Cargo.lock b/Cargo.lock index 996cfd679a..562dfaa094 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1853,12 +1853,13 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" +checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" dependencies = [ "bytes 1.0.1", "http", + "pin-project-lite 0.2.4", ] [[package]] @@ -1934,7 +1935,7 @@ dependencies = [ "futures-util", "h2 0.3.0", "http", - "http-body 0.4.0", + "http-body 0.4.2", "httparse", "httpdate", "itoa", @@ -1961,6 +1962,18 @@ dependencies = [ "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]] name = "hyper-tls" version = "0.5.0" @@ -3175,9 +3188,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes 1.0.1", "prost-derive", @@ -3185,12 +3198,12 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", - "itertools 0.9.0", + "itertools 0.10.1", "proc-macro2 1.0.24", "quote 1.0.6", "syn 1.0.67", @@ -3198,9 +3211,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes 1.0.1", "prost", @@ -3586,7 +3599,7 @@ dependencies = [ "futures-core", "futures-util", "http", - "http-body 0.4.0", + "http-body 0.4.2", "hyper 0.14.3", "hyper-rustls", "hyper-tls", @@ -6353,6 +6366,16 @@ dependencies = [ "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]] name = "tokio-macros" version = "0.2.6" @@ -6578,9 +6601,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac42cd97ac6bd2339af5bcabf105540e21e45636ec6fa6aae5e85d44db31be0" +checksum = "b584f064fdfc50017ec39162d5aebce49912f1eb16fd128e04b7f4ce4907c7e5" dependencies = [ "async-stream", "async-trait", @@ -6590,8 +6613,9 @@ dependencies = [ "futures-util", "h2 0.3.0", "http", - "http-body 0.4.0", + "http-body 0.4.2", "hyper 0.14.3", + "hyper-timeout", "percent-encoding 2.1.0", "pin-project 1.0.7", "prost", @@ -6601,6 +6625,7 @@ dependencies = [ "tokio-stream", "tokio-util 0.6.3", "tower", + "tower-layer", "tower-service", "tracing", "tracing-futures", diff --git a/ci/do-audit.sh b/ci/do-audit.sh index 89577fd0f2..b6c1b86be1 100755 --- a/ci/do-audit.sh +++ b/ci/do-audit.sh @@ -39,10 +39,5 @@ cargo_audit_ignores=( # https://github.com/paritytech/libsecp256k1/issues/66 --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[@]}" diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index 04b97c76be..ec57a32128 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -26,7 +26,7 @@ lazy_static = "1.4.0" libc = "0.2.98" log = { version = "0.4.14" } num_cpus = "1.13.0" -prost = "0.7.0" +prost = "0.8.0" rand = "0.7.0" rand_chacha = "0.2.2" rayon = "1.5.1" diff --git a/storage-bigtable/Cargo.toml b/storage-bigtable/Cargo.toml index 6b6b033297..1d53cc1c07 100644 --- a/storage-bigtable/Cargo.toml +++ b/storage-bigtable/Cargo.toml @@ -18,8 +18,8 @@ enum-iterator = "0.6.0" flate2 = "1.0.20" goauth = "0.10.0" log = "0.4.14" -prost = "0.7.0" -prost-types = "0.7.0" +prost = "0.8.0" +prost-types = "0.8.0" rand_core = "0.6.3" serde = "1.0.126" 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" } thiserror = "1.0" futures = "0.3.15" -tonic = { version = "0.4.3", features = ["tls", "transport"] } +tonic = { version = "0.5.0", features = ["tls", "transport"] } zstd = "0.9.0" [lib] diff --git a/storage-bigtable/build-proto/Cargo.lock b/storage-bigtable/build-proto/Cargo.lock index e0c95eea9c..d66c374ac9 100644 --- a/storage-bigtable/build-proto/Cargo.lock +++ b/storage-bigtable/build-proto/Cargo.lock @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" dependencies = [ "either", ] @@ -143,9 +143,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes", "prost-derive", @@ -153,9 +153,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" +checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes", "heck", @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", "itertools", @@ -184,9 +184,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes", "prost", @@ -313,9 +313,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e8546fd40d56d28089835c0a81bb396848103b00f888aea42d46eb5974df07" +checksum = "25db9a497663a9a779693ef67b6e6aef8345b3d3ff8d50ef92eae6c88cb1e386" dependencies = [ "proc-macro2", "prost-build", diff --git a/storage-bigtable/build-proto/Cargo.toml b/storage-bigtable/build-proto/Cargo.toml index 75f15a0d01..ded5f794e9 100644 --- a/storage-bigtable/build-proto/Cargo.toml +++ b/storage-bigtable/build-proto/Cargo.toml @@ -12,4 +12,4 @@ version = "1.8.0" [workspace] [dependencies] -tonic-build = "0.4.0" +tonic-build = "0.5.0" diff --git a/storage-bigtable/proto/google.bigtable.v2.rs b/storage-bigtable/proto/google.bigtable.v2.rs index 607f4fa9ef..d993d1df1f 100644 --- a/storage-bigtable/proto/google.bigtable.v2.rs +++ b/storage-bigtable/proto/google.bigtable.v2.rs @@ -898,6 +898,7 @@ pub mod bigtable_client { #![allow(unused_variables, dead_code, missing_docs)] use tonic::codegen::*; #[doc = " Service for reading from and writing to existing Bigtable tables."] + #[derive(Debug, Clone)] pub struct BigtableClient { inner: tonic::client::Grpc, } @@ -915,17 +916,43 @@ pub mod bigtable_client { impl BigtableClient where T: tonic::client::GrpcService, - T::ResponseBody: Body + HttpBody + Send + 'static, + T::ResponseBody: Body + Send + Sync + 'static, T::Error: Into, - ::Error: Into + Send, + ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { - let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); - Self { inner } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> BigtableClient> + where + F: FnMut(tonic::Request<()>) -> Result, tonic::Status>, + T: Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + 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 = " 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 } } - impl Clone for BigtableClient { - fn clone(&self) -> Self { - Self { - inner: self.inner.clone(), - } - } - } - impl std::fmt::Debug for BigtableClient { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "BigtableClient {{ ... }}") - } - } } diff --git a/storage-bigtable/src/bigtable.rs b/storage-bigtable/src/bigtable.rs index e0f99ee79c..3e4e142a6a 100644 --- a/storage-bigtable/src/bigtable.rs +++ b/storage-bigtable/src/bigtable.rs @@ -8,7 +8,10 @@ use crate::{ use log::*; use std::time::{Duration, Instant}; use thiserror::Error; -use tonic::{metadata::MetadataValue, transport::ClientTlsConfig, Request}; +use tonic::{ + codegen::InterceptedService, metadata::MetadataValue, transport::ClientTlsConfig, Request, + Status, +}; mod google { mod rpc { @@ -93,6 +96,7 @@ impl std::convert::From for Error { } pub type Result = std::result::Result; +type InterceptedRequestResult = std::result::Result, Status>; #[derive(Clone)] pub struct BigTableConnection { @@ -177,12 +181,12 @@ impl BigTableConnection { /// /// 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. - pub fn client(&self) -> BigTable { - let client = if let Some(access_token) = &self.access_token { - let access_token = access_token.clone(); - bigtable_client::BigtableClient::with_interceptor( - self.channel.clone(), - move |mut req: Request<()>| { + pub fn client(&self) -> BigTable) -> InterceptedRequestResult> { + let access_token = self.access_token.clone(); + let client = bigtable_client::BigtableClient::with_interceptor( + self.channel.clone(), + move |mut req: Request<()>| { + if let Some(access_token) = &access_token { match MetadataValue::from_str(&access_token.get()) { Ok(authorization_header) => { req.metadata_mut() @@ -192,12 +196,10 @@ impl BigTableConnection { warn!("Failed to set authorization header: {}", err); } } - Ok(req) - }, - ) - } else { - bigtable_client::BigtableClient::new(self.channel.clone()) - }; + } + Ok(req) + }, + ); BigTable { access_token: self.access_token.clone(), client, @@ -239,14 +241,14 @@ impl BigTableConnection { } } -pub struct BigTable { +pub struct BigTable) -> InterceptedRequestResult> { access_token: Option, - client: bigtable_client::BigtableClient, + client: bigtable_client::BigtableClient>, table_prefix: String, timeout: Option, } -impl BigTable { +impl) -> InterceptedRequestResult> BigTable { async fn decode_read_rows_response( &self, mut rrr: tonic::codec::Streaming, diff --git a/storage-proto/Cargo.toml b/storage-proto/Cargo.toml index cdd61eb699..0f52de8e13 100644 --- a/storage-proto/Cargo.toml +++ b/storage-proto/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] bincode = "1.3.3" bs58 = "0.4.0" -prost = "0.7.0" +prost = "0.8.0" serde = "1.0.126" serde_derive = "1.0.103" solana-account-decoder = { path = "../account-decoder", version = "=1.8.0" } diff --git a/storage-proto/build-proto/Cargo.lock b/storage-proto/build-proto/Cargo.lock index d112dc30fb..9bc8bd184e 100644 --- a/storage-proto/build-proto/Cargo.lock +++ b/storage-proto/build-proto/Cargo.lock @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" dependencies = [ "either", ] @@ -143,9 +143,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes", "prost-derive", @@ -153,9 +153,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" +checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes", "heck", @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", "itertools", @@ -184,9 +184,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes", "prost", @@ -313,9 +313,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e8546fd40d56d28089835c0a81bb396848103b00f888aea42d46eb5974df07" +checksum = "25db9a497663a9a779693ef67b6e6aef8345b3d3ff8d50ef92eae6c88cb1e386" dependencies = [ "proc-macro2", "prost-build", diff --git a/storage-proto/build-proto/Cargo.toml b/storage-proto/build-proto/Cargo.toml index 75f15a0d01..ded5f794e9 100644 --- a/storage-proto/build-proto/Cargo.toml +++ b/storage-proto/build-proto/Cargo.toml @@ -12,4 +12,4 @@ version = "1.8.0" [workspace] [dependencies] -tonic-build = "0.4.0" +tonic-build = "0.5.0" diff --git a/storage-proto/src/transaction_by_addr.proto b/storage-proto/src/transaction_by_addr.proto index 7394a3aa92..44e300ce34 100644 --- a/storage-proto/src/transaction_by_addr.proto +++ b/storage-proto/src/transaction_by_addr.proto @@ -99,6 +99,7 @@ enum InstructionErrorType { INVALID_ACCOUNT_OWNER = 46; ARITHMETIC_OVERFLOW = 47; UNSUPPORTED_SYSVAR = 48; + ILLEGAL_OWNER = 49; } message UnixTimestamp {