From 44aa8325448e93e2cad9fcf55d6eec569b032254 Mon Sep 17 00:00:00 2001 From: larry-aptos <112209412+larry-aptos@users.noreply.github.com> Date: Sun, 17 Sep 2023 01:30:18 -0700 Subject: [PATCH] [proto] Fix the proto build with newer prost plugins. (#10080) --- Cargo.lock | 137 +++++++++++++----- Cargo.toml | 12 +- crates/aptos-protos/Cargo.toml | 27 ++-- crates/aptos-protos/src/lib.rs | 1 + .../src/pb/aptos.indexer.v1.tonic.rs | 66 ++++++++- .../pb/aptos.internal.fullnode.v1.tonic.rs | 74 +++++++++- .../indexer-grpc-cache-worker/src/worker.rs | 4 +- 7 files changed, 246 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 36ac4b507184c..38d0c7b23c7cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1885,7 +1885,7 @@ dependencies = [ "futures", "futures-core", "once_cell", - "prost", + "prost 0.12.1", "redis", "reqwest", "serde", @@ -1893,7 +1893,7 @@ dependencies = [ "serde_yaml 0.8.26", "tempfile", "tokio", - "tonic 0.8.3", + "tonic 0.10.0", "tracing", ] @@ -1915,13 +1915,13 @@ dependencies = [ "cloud-storage", "futures", "once_cell", - "prost", + "prost 0.12.1", "redis", "serde", "serde_json", "tokio", "tokio-stream", - "tonic 0.8.3", + "tonic 0.10.0", "tonic-reflection", "tracing", "uuid", @@ -2000,7 +2000,7 @@ dependencies = [ "serde_json", "tokio", "tokio-stream", - "tonic 0.8.3", + "tonic 0.10.0", ] [[package]] @@ -2030,7 +2030,7 @@ dependencies = [ "futures-util", "itertools", "prometheus", - "prost", + "prost 0.12.1", "redis", "regex", "reqwest", @@ -2039,7 +2039,7 @@ dependencies = [ "serde_yaml 0.8.26", "tempfile", "tokio", - "tonic 0.8.3", + "tonic 0.10.0", "tracing", "url", "warp", @@ -2063,13 +2063,13 @@ dependencies = [ "futures", "hostname", "once_cell", - "prost", + "prost 0.12.1", "reqwest", "serde", "serde_json", "tokio", "toml 0.7.4", - "tonic 0.8.3", + "tonic 0.10.0", "tracing", "tracing-subscriber", ] @@ -2115,7 +2115,7 @@ dependencies = [ "itertools", "once_cell", "prometheus", - "prost", + "prost 0.12.1", "redis", "redis-test", "serde", @@ -2123,7 +2123,7 @@ dependencies = [ "serde_yaml 0.8.26", "tokio", "toml 0.7.4", - "tonic 0.8.3", + "tonic 0.10.0", "tracing", "tracing-subscriber", "warp", @@ -2916,12 +2916,13 @@ dependencies = [ [[package]] name = "aptos-protos" -version = "1.0.0" +version = "1.0.1" dependencies = [ + "futures-core", "pbjson", - "prost", + "prost 0.12.1", "serde", - "tonic 0.8.3", + "tonic 0.10.0", ] [[package]] @@ -5344,8 +5345,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e57ff02e8ad8e06ab9731d5dc72dc23bef9200778eae1a89d555d8c42e5d4a86" dependencies = [ - "prost", - "prost-types", + "prost 0.11.9", + "prost-types 0.11.9", "tonic 0.8.3", "tracing-core", ] @@ -5362,7 +5363,7 @@ dependencies = [ "futures", "hdrhistogram", "humantime", - "prost-types", + "prost-types 0.11.9", "serde", "serde_json", "thread_local", @@ -7095,8 +7096,8 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a3b24a3f57be08afc02344e693afb55e48172c9c2ab86ff3fdb8efff550e4b9" dependencies = [ - "prost", - "prost-types", + "prost 0.11.9", + "prost-types 0.11.9", "tonic 0.9.2", ] @@ -7123,7 +7124,7 @@ dependencies = [ "google-cloud-gax", "google-cloud-googleapis", "google-cloud-token", - "prost-types", + "prost-types 0.11.9", "thiserror", "tokio", "tokio-util 0.7.3", @@ -10434,9 +10435,9 @@ checksum = "9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22" [[package]] name = "pbjson" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "599fe9aefc2ca0df4a96179b3075faee2cacb89d4cf947a00b9a89152dfffc9d" +checksum = "048f9ac93c1eab514f9470c4bc8d97ca2a0a236b84f45cc19d69a59fc11467f6" dependencies = [ "base64 0.13.0", "serde", @@ -11159,7 +11160,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" +dependencies = [ + "bytes", + "prost-derive 0.12.1", ] [[package]] @@ -11175,13 +11186,35 @@ dependencies = [ "syn 1.0.105", ] +[[package]] +name = "prost-derive" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2 1.0.64", + "quote 1.0.29", + "syn 2.0.25", +] + [[package]] name = "prost-types" version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "prost", + "prost 0.11.9", +] + +[[package]] +name = "prost-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" +dependencies = [ + "prost 0.12.1", ] [[package]] @@ -11903,9 +11936,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", "rustls-pemfile 1.0.1", @@ -13457,7 +13490,6 @@ dependencies = [ "axum 0.6.18", "base64 0.13.0", "bytes", - "flate2", "futures-core", "futures-util", "h2", @@ -13467,12 +13499,9 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost", - "prost-derive", - "rustls-native-certs", - "rustls-pemfile 1.0.1", + "prost 0.11.9", + "prost-derive 0.11.9", "tokio", - "tokio-rustls 0.23.4", "tokio-stream", "tokio-util 0.7.3", "tower", @@ -13503,7 +13532,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost", + "prost 0.11.9", "rustls-pemfile 1.0.1", "tokio", "tokio-rustls 0.24.1", @@ -13516,17 +13545,47 @@ dependencies = [ ] [[package]] -name = "tonic-reflection" -version = "0.6.0" +name = "tonic" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67494bad4dda4c9bffae901dfe14e2b2c0f760adb4706dc10beeb81799f7f7b2" +checksum = "5469afaf78a11265c343a88969045c1568aa8ecc6c787dbf756e92e70f199861" dependencies = [ + "async-stream", + "async-trait", + "axum 0.6.18", + "base64 0.21.2", "bytes", - "prost", - "prost-types", + "flate2", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost 0.12.1", + "rustls-native-certs", + "rustls-pemfile 1.0.1", "tokio", + "tokio-rustls 0.24.1", "tokio-stream", - "tonic 0.8.3", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-reflection" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e61add39c1426d5f21eae2cc196e97e1f5a5ea7bcf491df3885797992a86eb" +dependencies = [ + "prost 0.12.1", + "prost-types 0.12.1", + "tokio", + "tokio-stream", + "tonic 0.10.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 709ac608ffbd0..3e1ba8d8eebd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,6 +74,7 @@ members = [ "crates/aptos-openapi", "crates/aptos-profiler", "crates/aptos-proptest-helpers", + "crates/aptos-protos", "crates/aptos-push-metrics", "crates/aptos-rate-limiter", "crates/aptos-rest-client", @@ -230,8 +231,6 @@ members = [ "vm-validator", ] -exclude = ["crates/aptos-protos"] - # NOTE: default-members is the complete list of binaries that form the "production Aptos codebase". These members should # never include crates that require fuzzing features or test features. These are the crates we want built with no extra # test-only code included. @@ -550,6 +549,7 @@ ouroboros = "0.15.6" owo-colors = "3.5.0" parking_lot = "0.12.0" paste = "1.0.7" +pbjson = "0.5.1" percent-encoding = "2.1.0" pin-project = "1.0.10" poem = { version = "=1.3.55", features = ["anyhow", "rustls"] } @@ -565,8 +565,8 @@ prometheus-http-query = "0.5.2" prometheus-parse = "0.2.4" proptest = "1.0.0" proptest-derive = "0.3.0" -prost = "0.11.3" -prost-types = "0.11.3" +prost = "0.12.1" +prost-types = "0.12.1" quanta = "0.10.1" quote = "1.0.18" rand = "0.7.3" @@ -630,14 +630,14 @@ tokio-stream = "0.1.8" tokio-test = "0.4.1" tokio-util = { version = "0.7.2", features = ["compat", "codec"] } toml = "0.7.4" -tonic = { version = "0.8.3", features = [ +tonic = { version = "0.10.0", features = [ "tls-roots", "transport", "prost", "gzip", "codegen", ] } -tonic-reflection = "0.6.0" +tonic-reflection = "0.10.0" ureq = { version = "1.5.4", features = [ "json", "native-tls", diff --git a/crates/aptos-protos/Cargo.toml b/crates/aptos-protos/Cargo.toml index b8123b2dbc01a..e0a8c0876f904 100644 --- a/crates/aptos-protos/Cargo.toml +++ b/crates/aptos-protos/Cargo.toml @@ -1,16 +1,19 @@ [package] name = "aptos-protos" -version = "1.0.0" -authors = ["Aptos Labs "] -description = "Aptos Protobuf Definitions" -repository = "https://github.com/aptos-labs/aptos-core" -homepage = "https://aptoslabs.com" -license = "Apache-2.0" -publish = false -edition = "2021" +version = "1.0.1" + +# Workspace inherited keys +authors = { workspace = true } +edition = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +publish = { workspace = true } +repository = { workspace = true } +rust-version = { workspace = true } [dependencies] -pbjson = "0.4.0" -prost = "0.11.3" -serde = { version = "1.0.137", features = ["derive"], default-features = false } -tonic = { version = "0.8.3", features = ["tls-roots", "transport", "prost", "gzip", "codegen"] } \ No newline at end of file +futures-core = { workspace = true } +pbjson = { workspace = true } +prost = { workspace = true } +serde = { workspace = true } +tonic = { workspace = true } diff --git a/crates/aptos-protos/src/lib.rs b/crates/aptos-protos/src/lib.rs index 28911035e6675..783e15c0b544e 100644 --- a/crates/aptos-protos/src/lib.rs +++ b/crates/aptos-protos/src/lib.rs @@ -1,5 +1,6 @@ // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 +#![allow(clippy::needless_borrow)] mod pb; pub use pb::aptos::*; diff --git a/crates/aptos-protos/src/pb/aptos.indexer.v1.tonic.rs b/crates/aptos-protos/src/pb/aptos.indexer.v1.tonic.rs index 47aa76ee5d227..41ad03c2a7a84 100644 --- a/crates/aptos-protos/src/pb/aptos.indexer.v1.tonic.rs +++ b/crates/aptos-protos/src/pb/aptos.indexer.v1.tonic.rs @@ -15,7 +15,7 @@ pub mod raw_data_client { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; @@ -71,12 +71,28 @@ pub mod raw_data_client { self.inner = self.inner.accept_compressed(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } /** Get transactions batch without any filtering from starting version and end if transaction count is present. */ pub async fn get_transactions( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -93,7 +109,10 @@ pub mod raw_data_client { let path = http::uri::PathAndQuery::from_static( "/aptos.indexer.v1.RawData/GetTransactions", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("aptos.indexer.v1.RawData", "GetTransactions")); + self.inner.server_streaming(req, path, codec).await } } } @@ -106,7 +125,7 @@ pub mod raw_data_server { pub trait RawData: Send + Sync + 'static { /// Server streaming response type for the GetTransactions method. type GetTransactionsStream: futures_core::Stream< - Item = Result, + Item = std::result::Result, > + Send + 'static; @@ -115,7 +134,10 @@ pub mod raw_data_server { async fn get_transactions( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } /// #[derive(Debug)] @@ -123,6 +145,8 @@ pub mod raw_data_server { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl RawDataServer { @@ -135,6 +159,8 @@ pub mod raw_data_server { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, } } pub fn with_interceptor( @@ -158,6 +184,22 @@ pub mod raw_data_server { self.send_compression_encodings.enable(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } } impl tonic::codegen::Service> for RawDataServer where @@ -171,7 +213,7 @@ pub mod raw_data_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -195,7 +237,7 @@ pub mod raw_data_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).get_transactions(request).await }; @@ -204,6 +246,8 @@ pub mod raw_data_server { } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -213,6 +257,10 @@ pub mod raw_data_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) @@ -241,12 +289,14 @@ pub mod raw_data_server { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/crates/aptos-protos/src/pb/aptos.internal.fullnode.v1.tonic.rs b/crates/aptos-protos/src/pb/aptos.internal.fullnode.v1.tonic.rs index 5a17208684ae7..2e03da7f88bcc 100644 --- a/crates/aptos-protos/src/pb/aptos.internal.fullnode.v1.tonic.rs +++ b/crates/aptos-protos/src/pb/aptos.internal.fullnode.v1.tonic.rs @@ -15,7 +15,7 @@ pub mod fullnode_data_client { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; @@ -71,11 +71,27 @@ pub mod fullnode_data_client { self.inner = self.inner.accept_compressed(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } /// pub async fn get_transactions_from_node( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response< tonic::codec::Streaming, >, @@ -94,7 +110,15 @@ pub mod fullnode_data_client { let path = http::uri::PathAndQuery::from_static( "/aptos.internal.fullnode.v1.FullnodeData/GetTransactionsFromNode", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "aptos.internal.fullnode.v1.FullnodeData", + "GetTransactionsFromNode", + ), + ); + self.inner.server_streaming(req, path, codec).await } } } @@ -107,7 +131,10 @@ pub mod fullnode_data_server { pub trait FullnodeData: Send + Sync + 'static { /// Server streaming response type for the GetTransactionsFromNode method. type GetTransactionsFromNodeStream: futures_core::Stream< - Item = Result, + Item = std::result::Result< + super::TransactionsFromNodeResponse, + tonic::Status, + >, > + Send + 'static; @@ -115,7 +142,10 @@ pub mod fullnode_data_server { async fn get_transactions_from_node( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } /// #[derive(Debug)] @@ -123,6 +153,8 @@ pub mod fullnode_data_server { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl FullnodeDataServer { @@ -135,6 +167,8 @@ pub mod fullnode_data_server { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, } } pub fn with_interceptor( @@ -158,6 +192,22 @@ pub mod fullnode_data_server { self.send_compression_encodings.enable(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } } impl tonic::codegen::Service> for FullnodeDataServer where @@ -171,7 +221,7 @@ pub mod fullnode_data_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -197,7 +247,7 @@ pub mod fullnode_data_server { super::GetTransactionsFromNodeRequest, >, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).get_transactions_from_node(request).await }; @@ -206,6 +256,8 @@ pub mod fullnode_data_server { } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -215,6 +267,10 @@ pub mod fullnode_data_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) @@ -243,12 +299,14 @@ pub mod fullnode_data_server { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs b/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs index dcdaec4be2911..e905456de0082 100644 --- a/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs +++ b/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs @@ -135,7 +135,7 @@ async fn process_transactions_from_node_response( ) -> anyhow::Result { match response.response.unwrap() { Response::Status(status) => { - match StatusType::from_i32(status.r#type).expect("[Indexer Cache] Invalid status type.") + match StatusType::try_from(status.r#type).expect("[Indexer Cache] Invalid status type.") { StatusType::Init => Ok(GrpcDataStatus::StreamInit(status.start_version)), StatusType::BatchEnd => { @@ -207,7 +207,7 @@ async fn setup_cache_with_init_signal( let (fullnode_chain_id, starting_version) = match init_signal.response.expect("Response type not exists.") { Response::Status(status_frame) => { - match StatusType::from_i32(status_frame.r#type).expect("Invalid status type.") { + match StatusType::try_from(status_frame.r#type).expect("Invalid status type.") { StatusType::Init => (init_signal.chain_id, status_frame.start_version), _ => { panic!("[Indexer Cache] Streaming error: first frame is not INIT signal.");