diff --git a/Cargo.lock b/Cargo.lock index 7fc55cdd81..5c6eb46d2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1771,12 +1771,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]] @@ -1852,7 +1853,7 @@ dependencies = [ "futures-util", "h2 0.3.0", "http", - "http-body 0.4.0", + "http-body 0.4.2", "httparse", "httpdate", "itoa", @@ -1879,6 +1880,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" @@ -1988,6 +2001,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.5" @@ -3079,9 +3101,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", @@ -3089,12 +3111,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", + "itertools 0.10.1", "proc-macro2 1.0.24", "quote 1.0.6", "syn 1.0.60", @@ -3102,9 +3124,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", @@ -3466,7 +3488,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", @@ -4084,7 +4106,7 @@ name = "solana-bench-exchange" version = "1.6.17" dependencies = [ "clap", - "itertools", + "itertools 0.9.0", "log 0.4.11", "num-derive", "num-traits", @@ -4366,7 +4388,7 @@ dependencies = [ "flate2", "fs_extra", "indexmap", - "itertools", + "itertools 0.9.0", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -4697,7 +4719,7 @@ dependencies = [ "fs_extra", "futures 0.3.8", "futures-util", - "itertools", + "itertools 0.9.0", "lazy_static", "libc", "log 0.4.11", @@ -4750,7 +4772,7 @@ dependencies = [ "futures 0.3.8", "futures-util", "histogram", - "itertools", + "itertools 0.9.0", "log 0.4.11", "regex", "serde", @@ -4781,7 +4803,7 @@ dependencies = [ "crossbeam-channel 0.4.4", "fs_extra", "gag", - "itertools", + "itertools 0.9.0", "log 0.4.11", "rand 0.7.3", "rayon", @@ -4997,7 +5019,7 @@ dependencies = [ "bv", "curve25519-dalek 2.1.0", "hex", - "itertools", + "itertools 0.9.0", "lazy_static", "log 0.4.11", "num-derive", @@ -5032,7 +5054,7 @@ dependencies = [ "bv", "curve25519-dalek 2.1.0", "hex", - "itertools", + "itertools 0.9.0", "lazy_static", "log 0.4.11", "num-derive", @@ -5143,7 +5165,7 @@ dependencies = [ "dir-diff", "flate2", "fnv", - "itertools", + "itertools 0.9.0", "lazy_static", "libc", "libloading 0.6.2", @@ -5204,7 +5226,7 @@ dependencies = [ "generic-array 0.14.3", "hex", "hmac 0.10.1", - "itertools", + "itertools 0.9.0", "lazy_static", "libsecp256k1", "log 0.4.11", @@ -6150,6 +6172,16 @@ dependencies = [ "log 0.4.11", ] +[[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" @@ -6375,9 +6407,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ba8f479158947373b6df40cf48f4779bb25c99ca3c661bd95e0ab1963ad8b0e" +checksum = "b584f064fdfc50017ec39162d5aebce49912f1eb16fd128e04b7f4ce4907c7e5" dependencies = [ "async-stream", "async-trait", @@ -6387,8 +6419,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.1", "prost", @@ -6398,6 +6431,7 @@ dependencies = [ "tokio-stream", "tokio-util 0.6.3", "tower", + "tower-layer", "tower-service", "tracing", "tracing-futures", @@ -6405,9 +6439,9 @@ dependencies = [ [[package]] name = "tower" -version = "0.4.4" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd7b451959622e21de79261673d658a0944b835012c58c51878ea55957fb51a" +checksum = "f60422bc7fefa2f3ec70359b8ff1caff59d785877eb70595904605bcc412470f" dependencies = [ "futures-core", "futures-util", @@ -6417,6 +6451,7 @@ dependencies = [ "slab", "tokio 1.8.1", "tokio-stream", + "tokio-util 0.6.3", "tower-layer", "tower-service", "tracing", @@ -7006,6 +7041,6 @@ checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b" dependencies = [ "cc", "glob", - "itertools", + "itertools 0.9.0", "libc", ] 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 758d695127..8b63cb3a3e 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -26,7 +26,7 @@ lazy_static = "1.4.0" libc = "0.2.81" log = { version = "0.4.11" } 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.0" diff --git a/storage-bigtable/Cargo.toml b/storage-bigtable/Cargo.toml index 073fcf1eb8..9e1ee8e2f4 100644 --- a/storage-bigtable/Cargo.toml +++ b/storage-bigtable/Cargo.toml @@ -18,8 +18,8 @@ enum-iterator = "0.6.0" flate2 = "1.0.14" goauth = "0.9.0" log = "0.4.11" -prost = "0.7.0" -prost-types = "0.7.0" +prost = "0.8.0" +prost-types = "0.8.0" rand_core = "0.6.2" serde = "1.0.122" serde_derive = "1.0.103" @@ -29,7 +29,7 @@ solana-storage-proto = { path = "../storage-proto", version = "=1.6.17" } solana-transaction-status = { path = "../transaction-status", version = "=1.6.17" } thiserror = "1.0" futures = "0.3.8" -tonic = { version = "0.4.0", features = ["tls", "transport"] } +tonic = { version = "0.5.0", features = ["tls", "transport"] } zstd = "0.5.1" [lib] diff --git a/storage-bigtable/build-proto/Cargo.lock b/storage-bigtable/build-proto/Cargo.lock index 675d2533df..09a9901213 100644 --- a/storage-bigtable/build-proto/Cargo.lock +++ b/storage-bigtable/build-proto/Cargo.lock @@ -77,9 +77,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", ] @@ -132,9 +132,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", @@ -142,9 +142,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", @@ -160,9 +160,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", @@ -173,9 +173,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", @@ -300,9 +300,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 168a55caf8..1e45fb1da3 100644 --- a/storage-bigtable/build-proto/Cargo.toml +++ b/storage-bigtable/build-proto/Cargo.toml @@ -12,4 +12,4 @@ version = "1.6.17" [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 9936e2d1d4..75568f812e 100644 --- a/storage-bigtable/proto/google.bigtable.v2.rs +++ b/storage-bigtable/proto/google.bigtable.v2.rs @@ -897,6 +897,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, } @@ -914,17 +915,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,"] @@ -1052,16 +1079,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 964b4f60a0..cb153f48ca 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 caf0d7dabc..f9d5f237e7 100644 --- a/storage-proto/Cargo.toml +++ b/storage-proto/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] bincode = "1.2.1" bs58 = "0.3.1" -prost = "0.7.0" +prost = "0.8.0" serde = "1.0.122" serde_derive = "1.0.103" solana-account-decoder = { path = "../account-decoder", version = "=1.6.17" } diff --git a/storage-proto/build-proto/Cargo.lock b/storage-proto/build-proto/Cargo.lock index f403f00e6d..3f02e585f8 100644 --- a/storage-proto/build-proto/Cargo.lock +++ b/storage-proto/build-proto/Cargo.lock @@ -74,9 +74,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", ] @@ -129,9 +129,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", @@ -139,9 +139,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", @@ -157,9 +157,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", @@ -170,9 +170,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", @@ -297,9 +297,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 168a55caf8..1e45fb1da3 100644 --- a/storage-proto/build-proto/Cargo.toml +++ b/storage-proto/build-proto/Cargo.toml @@ -12,4 +12,4 @@ version = "1.6.17" [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 {