From f456044a7bd9a0da21572fa68e644317208eebee Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 18:44:16 -0800 Subject: [PATCH 01/14] add basic podman config for zainod --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 592f8877e..108dfaaae 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ container-target/ .local/ .failed-tests **/proptest-regressions/** +zainod_config/ From f0d8016d5c5648d8a35297ceb0f40fa400fde491 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 19:32:50 -0800 Subject: [PATCH 02/14] almost the same as the Dockerfile --- Containerfile | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Containerfile diff --git a/Containerfile b/Containerfile new file mode 100644 index 000000000..9d31bc276 --- /dev/null +++ b/Containerfile @@ -0,0 +1,62 @@ +# syntax=docker/dockerfile:1 + +############################ +# Builder +############################ +ARG RUST_VERSION=1.86.0 + +FROM rust:${RUST_VERSION}-bookworm AS builder +SHELL ["/bin/bash", "-euo", "pipefail", "-c"] +WORKDIR /app + +# Toggle to build without TLS feature if needed +ARG NO_TLS=false + +# Build deps incl. protoc for prost-build +RUN apt-get update && apt-get install -y --no-install-recommends \ + pkg-config clang cmake make libssl-dev ca-certificates \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +# Copy entire workspace (prevents missing members) +COPY . . + +# Efficient caches + install to a known prefix (/out) +# This avoids relying on target/release/ paths. +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/local/cargo/git \ + --mount=type=cache,target=/app/target \ + if [ "${NO_TLS}" = "true" ]; then \ + cargo install --locked --path zainod --bin zainod --root /out --features no_tls_use_unencrypted_traffic; \ + else \ + cargo install --locked --path zainod --bin zainod --root /out; \ + fi + +############################ +# Runtime +############################ +FROM debian:bookworm-slim AS runtime + +# Runtime deps +RUN apt-get -qq update && \ + apt-get -qq install -y --no-install-recommends \ + ca-certificates libssl3 libgcc-s1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /out/bin/zainod /usr/local/bin/zainod + +# Writable home for XDG defaults (config, cache, etc.) +# The actual UID is mapped at runtime via --userns=keep-id or --user. +RUN mkdir -p /home/zaino && chmod 777 /home/zaino +ENV HOME=/home/zaino + +EXPOSE 8137 8237 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ + CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 + +# Run as non-root. The caller MUST map their host user: +# podman: podman run --userns=keep-id zaino +# docker: docker run --user "$(id -u):$(id -g)" zaino +ENTRYPOINT ["zainod"] +CMD ["start"] From 74c49c6dbd70622c6a6ec5a96c8d9d379f0e0b16 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 20:24:14 -0800 Subject: [PATCH 03/14] apply formatting changes --- zaino-proto/src/proto/service.rs | 906 +++++++++++++++++++++---------- 1 file changed, 617 insertions(+), 289 deletions(-) diff --git a/zaino-proto/src/proto/service.rs b/zaino-proto/src/proto/service.rs index cbe8a5d0f..2441bc93f 100644 --- a/zaino-proto/src/proto/service.rs +++ b/zaino-proto/src/proto/service.rs @@ -380,10 +380,10 @@ pub mod compact_tx_streamer_client { dead_code, missing_docs, clippy::wildcard_imports, - clippy::let_unit_value + clippy::let_unit_value, )] - use tonic::codegen::http::Uri; use tonic::codegen::*; + use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct CompactTxStreamerClient { inner: tonic::client::Grpc, @@ -427,8 +427,9 @@ pub mod compact_tx_streamer_client { >::ResponseBody, >, >, - >>::Error: - Into + std::marker::Send + std::marker::Sync, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, { CompactTxStreamerClient::new(InterceptedService::new(inner, interceptor)) } @@ -468,18 +469,26 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetLatestBlock", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetLatestBlock", + ), + ); self.inner.unary(req, path, codec).await } /// Return the compact block corresponding to the given block identifier @@ -490,18 +499,26 @@ pub mod compact_tx_streamer_client { tonic::Response, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlock", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlock", + ), + ); self.inner.unary(req, path, codec).await } /// Same as GetBlock except the returned CompactBlock value contains only @@ -516,18 +533,26 @@ pub mod compact_tx_streamer_client { tonic::Response, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockNullifiers", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlockNullifiers", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlockNullifiers", + ), + ); self.inner.unary(req, path, codec).await } /// Return a list of consecutive compact blocks in the specified range, @@ -539,21 +564,31 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response>, + tonic::Response< + tonic::codec::Streaming, + >, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlockRange", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlockRange", + ), + ); self.inner.server_streaming(req, path, codec).await } /// Same as GetBlockRange except the returned CompactBlock values contain @@ -565,21 +600,31 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response>, + tonic::Response< + tonic::codec::Streaming, + >, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRangeNullifiers", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlockRangeNullifiers", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlockRangeNullifiers", + ), + ); self.inner.server_streaming(req, path, codec).await } /// Return the requested full (not compact) transaction (as from zcashd) @@ -587,18 +632,26 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTransaction", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTransaction", + ), + ); self.inner.unary(req, path, codec).await } /// Submit the given transaction to the Zcash network @@ -606,18 +659,26 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "SendTransaction", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "SendTransaction", + ), + ); self.inner.unary(req, path, codec).await } /// Return RawTransactions that match the given transparent address filter. @@ -631,18 +692,26 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressTxids", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressTxids", + ), + ); self.inner.server_streaming(req, path, codec).await } /// Return the transactions corresponding to the given t-address within the given block range. @@ -654,54 +723,78 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTransactions", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressTransactions", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressTransactions", + ), + ); self.inner.server_streaming(req, path, codec).await } pub async fn get_taddress_balance( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressBalance", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressBalance", + ), + ); self.inner.unary(req, path, codec).await } pub async fn get_taddress_balance_stream( &mut self, request: impl tonic::IntoStreamingRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream", ); let mut req = request.into_streaming_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressBalanceStream", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressBalanceStream", + ), + ); self.inner.client_streaming(req, path, codec).await } /// Returns a stream of the compact transaction representation for transactions @@ -720,21 +813,31 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response>, + tonic::Response< + tonic::codec::Streaming, + >, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetMempoolTx", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetMempoolTx", + ), + ); self.inner.server_streaming(req, path, codec).await } /// Return a stream of current Mempool transactions. This will keep the output stream open while @@ -746,18 +849,26 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetMempoolStream", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetMempoolStream", + ), + ); self.inner.server_streaming(req, path, codec).await } /// GetTreeState returns the note commitment tree state corresponding to the given block. @@ -768,36 +879,52 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTreeState", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTreeState", + ), + ); self.inner.unary(req, path, codec).await } pub async fn get_latest_tree_state( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestTreeState", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetLatestTreeState", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetLatestTreeState", + ), + ); self.inner.unary(req, path, codec).await } /// Returns a stream of information about roots of subtrees of the note commitment tree @@ -809,37 +936,55 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetSubtreeRoots", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetSubtreeRoots", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetSubtreeRoots", + ), + ); self.inner.server_streaming(req, path, codec).await } pub async fn get_address_utxos( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetAddressUtxos", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetAddressUtxos", + ), + ); self.inner.unary(req, path, codec).await } pub async fn get_address_utxos_stream( @@ -849,18 +994,26 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetAddressUtxosStream", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetAddressUtxosStream", + ), + ); self.inner.server_streaming(req, path, codec).await } /// Return information about this lightwalletd instance and the blockchain @@ -868,18 +1021,26 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetLightdInfo", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetLightdInfo", + ), + ); self.inner.unary(req, path, codec).await } /// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production) @@ -887,18 +1048,23 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::unknown(format!("Service was not ready: {}", e.into())) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "Ping", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("cash.z.wallet.sdk.rpc.CompactTxStreamer", "Ping"), + ); self.inner.unary(req, path, codec).await } } @@ -910,7 +1076,7 @@ pub mod compact_tx_streamer_server { dead_code, missing_docs, clippy::wildcard_imports, - clippy::let_unit_value + clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with CompactTxStreamerServer. @@ -947,7 +1113,8 @@ pub mod compact_tx_streamer_server { crate::proto::compact_formats::CompactBlock, tonic::Status, >, - > + std::marker::Send + > + + std::marker::Send + 'static; /// Return a list of consecutive compact blocks in the specified range, /// which is inclusive of `range.end`. @@ -957,14 +1124,18 @@ pub mod compact_tx_streamer_server { async fn get_block_range( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the GetBlockRangeNullifiers method. type GetBlockRangeNullifiersStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result< crate::proto::compact_formats::CompactBlock, tonic::Status, >, - > + std::marker::Send + > + + std::marker::Send + 'static; /// Same as GetBlockRange except the returned CompactBlock values contain /// only nullifiers. @@ -974,7 +1145,10 @@ pub mod compact_tx_streamer_server { async fn get_block_range_nullifiers( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Return the requested full (not compact) transaction (as from zcashd) async fn get_transaction( &self, @@ -988,7 +1162,8 @@ pub mod compact_tx_streamer_server { /// Server streaming response type for the GetTaddressTxids method. type GetTaddressTxidsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > + std::marker::Send + > + + std::marker::Send + 'static; /// Return RawTransactions that match the given transparent address filter. /// @@ -997,18 +1172,25 @@ pub mod compact_tx_streamer_server { async fn get_taddress_txids( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the GetTaddressTransactions method. type GetTaddressTransactionsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > + std::marker::Send + > + + std::marker::Send + 'static; /// Return the transactions corresponding to the given t-address within the given block range. /// Mempool transactions are not included in the results. async fn get_taddress_transactions( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_taddress_balance( &self, request: tonic::Request, @@ -1019,8 +1201,12 @@ pub mod compact_tx_streamer_server { ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetMempoolTx method. type GetMempoolTxStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > + std::marker::Send + Item = std::result::Result< + crate::proto::compact_formats::CompactTx, + tonic::Status, + >, + > + + std::marker::Send + 'static; /// Returns a stream of the compact transaction representation for transactions /// currently in the mempool. The results of this operation may be a few @@ -1037,18 +1223,25 @@ pub mod compact_tx_streamer_server { async fn get_mempool_tx( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the GetMempoolStream method. type GetMempoolStreamStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > + std::marker::Send + > + + std::marker::Send + 'static; /// Return a stream of current Mempool transactions. This will keep the output stream open while /// there are mempool transactions. It will close the returned stream when a new block is mined. async fn get_mempool_stream( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// GetTreeState returns the note commitment tree state corresponding to the given block. /// See section 3.7 of the Zcash protocol specification. It returns several other useful /// values also (even though they can be obtained using GetBlock). @@ -1064,27 +1257,38 @@ pub mod compact_tx_streamer_server { /// Server streaming response type for the GetSubtreeRoots method. type GetSubtreeRootsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > + std::marker::Send + > + + std::marker::Send + 'static; /// Returns a stream of information about roots of subtrees of the note commitment tree /// for the specified shielded protocol (Sapling or Orchard). async fn get_subtree_roots( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_address_utxos( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the GetAddressUtxosStream method. type GetAddressUtxosStreamStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > + std::marker::Send + > + + std::marker::Send + 'static; async fn get_address_utxos_stream( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Return information about this lightwalletd instance and the blockchain async fn get_lightd_info( &self, @@ -1117,7 +1321,10 @@ pub mod compact_tx_streamer_server { max_encoding_message_size: None, } } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService where F: tonic::service::Interceptor, { @@ -1172,16 +1379,23 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock" => { #[allow(non_camel_case_types)] struct GetLatestBlockSvc(pub Arc); - impl tonic::server::UnaryService for GetLatestBlockSvc { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService + for GetLatestBlockSvc { type Response = super::BlockId; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_latest_block(&inner, request).await + ::get_latest_block(&inner, request) + .await }; Box::pin(fut) } @@ -1211,9 +1425,14 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock" => { #[allow(non_camel_case_types)] struct GetBlockSvc(pub Arc); - impl tonic::server::UnaryService for GetBlockSvc { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService for GetBlockSvc { type Response = crate::proto::compact_formats::CompactBlock; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, @@ -1250,18 +1469,25 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockNullifiers" => { #[allow(non_camel_case_types)] struct GetBlockNullifiersSvc(pub Arc); - impl tonic::server::UnaryService - for GetBlockNullifiersSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService + for GetBlockNullifiersSvc { type Response = crate::proto::compact_formats::CompactBlock; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_block_nullifiers(&inner, request) + ::get_block_nullifiers( + &inner, + request, + ) .await }; Box::pin(fut) @@ -1292,21 +1518,24 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange" => { #[allow(non_camel_case_types)] struct GetBlockRangeSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for GetBlockRangeSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService + for GetBlockRangeSvc { type Response = crate::proto::compact_formats::CompactBlock; type ResponseStream = T::GetBlockRangeStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_block_range(&inner, request).await + ::get_block_range(&inner, request) + .await }; Box::pin(fut) } @@ -1336,14 +1565,16 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRangeNullifiers" => { #[allow(non_camel_case_types)] struct GetBlockRangeNullifiersSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for GetBlockRangeNullifiersSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService + for GetBlockRangeNullifiersSvc { type Response = crate::proto::compact_formats::CompactBlock; type ResponseStream = T::GetBlockRangeNullifiersStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, @@ -1351,9 +1582,10 @@ pub mod compact_tx_streamer_server { let inner = Arc::clone(&self.0); let fut = async move { ::get_block_range_nullifiers( - &inner, request, - ) - .await + &inner, + request, + ) + .await }; Box::pin(fut) } @@ -1383,16 +1615,23 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction" => { #[allow(non_camel_case_types)] struct GetTransactionSvc(pub Arc); - impl tonic::server::UnaryService for GetTransactionSvc { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService + for GetTransactionSvc { type Response = super::RawTransaction; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_transaction(&inner, request).await + ::get_transaction(&inner, request) + .await }; Box::pin(fut) } @@ -1422,18 +1661,23 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction" => { #[allow(non_camel_case_types)] struct SendTransactionSvc(pub Arc); - impl tonic::server::UnaryService - for SendTransactionSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService + for SendTransactionSvc { type Response = super::SendResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::send_transaction(&inner, request).await + ::send_transaction(&inner, request) + .await }; Box::pin(fut) } @@ -1463,21 +1707,28 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids" => { #[allow(non_camel_case_types)] struct GetTaddressTxidsSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for GetTaddressTxidsSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService< + super::TransparentAddressBlockFilter, + > for GetTaddressTxidsSvc { type Response = super::RawTransaction; type ResponseStream = T::GetTaddressTxidsStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_taddress_txids(&inner, request).await + ::get_taddress_txids( + &inner, + request, + ) + .await }; Box::pin(fut) } @@ -1507,21 +1758,27 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTransactions" => { #[allow(non_camel_case_types)] struct GetTaddressTransactionsSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for GetTaddressTransactionsSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService< + super::TransparentAddressBlockFilter, + > for GetTaddressTransactionsSvc { type Response = super::RawTransaction; type ResponseStream = T::GetTaddressTransactionsStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_taddress_transactions(&inner, request) + ::get_taddress_transactions( + &inner, + request, + ) .await }; Box::pin(fut) @@ -1552,18 +1809,25 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance" => { #[allow(non_camel_case_types)] struct GetTaddressBalanceSvc(pub Arc); - impl tonic::server::UnaryService - for GetTaddressBalanceSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService + for GetTaddressBalanceSvc { type Response = super::Balance; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_taddress_balance(&inner, request) + ::get_taddress_balance( + &inner, + request, + ) .await }; Box::pin(fut) @@ -1594,11 +1858,15 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream" => { #[allow(non_camel_case_types)] struct GetTaddressBalanceStreamSvc(pub Arc); - impl tonic::server::ClientStreamingService - for GetTaddressBalanceStreamSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ClientStreamingService + for GetTaddressBalanceStreamSvc { type Response = super::Balance; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request>, @@ -1606,9 +1874,10 @@ pub mod compact_tx_streamer_server { let inner = Arc::clone(&self.0); let fut = async move { ::get_taddress_balance_stream( - &inner, request, - ) - .await + &inner, + request, + ) + .await }; Box::pin(fut) } @@ -1638,21 +1907,24 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx" => { #[allow(non_camel_case_types)] struct GetMempoolTxSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for GetMempoolTxSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService + for GetMempoolTxSvc { type Response = crate::proto::compact_formats::CompactTx; type ResponseStream = T::GetMempoolTxStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_mempool_tx(&inner, request).await + ::get_mempool_tx(&inner, request) + .await }; Box::pin(fut) } @@ -1682,17 +1954,27 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream" => { #[allow(non_camel_case_types)] struct GetMempoolStreamSvc(pub Arc); - impl tonic::server::ServerStreamingService - for GetMempoolStreamSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService + for GetMempoolStreamSvc { type Response = super::RawTransaction; type ResponseStream = T::GetMempoolStreamStream; - type Future = - BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_mempool_stream(&inner, request).await + ::get_mempool_stream( + &inner, + request, + ) + .await }; Box::pin(fut) } @@ -1722,16 +2004,23 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState" => { #[allow(non_camel_case_types)] struct GetTreeStateSvc(pub Arc); - impl tonic::server::UnaryService for GetTreeStateSvc { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService + for GetTreeStateSvc { type Response = super::TreeState; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_tree_state(&inner, request).await + ::get_tree_state(&inner, request) + .await }; Box::pin(fut) } @@ -1761,13 +2050,23 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestTreeState" => { #[allow(non_camel_case_types)] struct GetLatestTreeStateSvc(pub Arc); - impl tonic::server::UnaryService for GetLatestTreeStateSvc { + impl tonic::server::UnaryService + for GetLatestTreeStateSvc { type Response = super::TreeState; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_latest_tree_state(&inner, request) + ::get_latest_tree_state( + &inner, + request, + ) .await }; Box::pin(fut) @@ -1798,21 +2097,24 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetSubtreeRoots" => { #[allow(non_camel_case_types)] struct GetSubtreeRootsSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for GetSubtreeRootsSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService + for GetSubtreeRootsSvc { type Response = super::SubtreeRoot; type ResponseStream = T::GetSubtreeRootsStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_subtree_roots(&inner, request).await + ::get_subtree_roots(&inner, request) + .await }; Box::pin(fut) } @@ -1842,19 +2144,23 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos" => { #[allow(non_camel_case_types)] struct GetAddressUtxosSvc(pub Arc); - impl - tonic::server::UnaryService - for GetAddressUtxosSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService + for GetAddressUtxosSvc { type Response = super::GetAddressUtxosReplyList; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_address_utxos(&inner, request).await + ::get_address_utxos(&inner, request) + .await }; Box::pin(fut) } @@ -1884,21 +2190,26 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream" => { #[allow(non_camel_case_types)] struct GetAddressUtxosStreamSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for GetAddressUtxosStreamSvc - { + impl< + T: CompactTxStreamer, + > tonic::server::ServerStreamingService + for GetAddressUtxosStreamSvc { type Response = super::GetAddressUtxosReply; type ResponseStream = T::GetAddressUtxosStreamStream; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_address_utxos_stream(&inner, request) + ::get_address_utxos_stream( + &inner, + request, + ) .await }; Box::pin(fut) @@ -1929,13 +2240,21 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo" => { #[allow(non_camel_case_types)] struct GetLightdInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetLightdInfoSvc { + impl tonic::server::UnaryService + for GetLightdInfoSvc { type Response = super::LightdInfo; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_lightd_info(&inner, request).await + ::get_lightd_info(&inner, request) + .await }; Box::pin(fut) } @@ -1965,9 +2284,14 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); - impl tonic::server::UnaryService for PingSvc { + impl< + T: CompactTxStreamer, + > tonic::server::UnaryService for PingSvc { type Response = super::PingResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, @@ -2001,19 +2325,23 @@ pub mod compact_tx_streamer_server { }; Box::pin(fut) } - _ => Box::pin(async move { - let mut response = http::Response::new(empty_body()); - let headers = response.headers_mut(); - headers.insert( - tonic::Status::GRPC_STATUS, - (tonic::Code::Unimplemented as i32).into(), - ); - headers.insert( - http::header::CONTENT_TYPE, - tonic::metadata::GRPC_CONTENT_TYPE, - ); - Ok(response) - }), + _ => { + Box::pin(async move { + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } } } } From 2d6cc4e4d759c84afb5bd1369bed6c48705e446d Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 20:29:35 -0800 Subject: [PATCH 04/14] reorder Dockerfile to match Containerfile --- Dockerfile | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index c54b2a50f..0a560d38d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,10 @@ # syntax=docker/dockerfile:1 ############################ -# Global build args +# Builder ############################ ARG RUST_VERSION=1.86.0 -ARG UID=1000 -ARG GID=1000 -ARG USER=container_user -ARG HOME=/home/container_user -############################ -# Builder -############################ FROM rust:${RUST_VERSION}-bookworm AS builder SHELL ["/bin/bash", "-euo", "pipefail", "-c"] WORKDIR /app @@ -45,10 +38,10 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ FROM debian:bookworm-slim AS runtime SHELL ["/bin/bash", "-euo", "pipefail", "-c"] -ARG UID -ARG GID -ARG USER -ARG HOME +ARG UID=1000 +ARG GID=1000 +ARG USER=container_user +ARG HOME=/home/container_user # Only the dynamic libs needed by a Rust/OpenSSL binary RUN apt-get -qq update && \ From 1ff711880608bbafb7c9873c3e84201033e55488 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 21:08:48 -0800 Subject: [PATCH 05/14] setup podman and docker to follow one build manifest, where possible --- Containerfile => Containerfile.builder | 31 +---------- Containerfile.runtime | 33 ++++++++++++ Dockerfile | 75 -------------------------- Dockerfile.runtime | 39 ++++++++++++++ Makefile.toml | 55 +++++++++++++++++++ rust-toolchain.toml | 2 +- 6 files changed, 129 insertions(+), 106 deletions(-) rename Containerfile => Containerfile.builder (53%) create mode 100644 Containerfile.runtime delete mode 100644 Dockerfile create mode 100644 Dockerfile.runtime diff --git a/Containerfile b/Containerfile.builder similarity index 53% rename from Containerfile rename to Containerfile.builder index 9d31bc276..70a7cf204 100644 --- a/Containerfile +++ b/Containerfile.builder @@ -3,7 +3,7 @@ ############################ # Builder ############################ -ARG RUST_VERSION=1.86.0 +ARG RUST_VERSION FROM rust:${RUST_VERSION}-bookworm AS builder SHELL ["/bin/bash", "-euo", "pipefail", "-c"] @@ -31,32 +31,3 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ else \ cargo install --locked --path zainod --bin zainod --root /out; \ fi - -############################ -# Runtime -############################ -FROM debian:bookworm-slim AS runtime - -# Runtime deps -RUN apt-get -qq update && \ - apt-get -qq install -y --no-install-recommends \ - ca-certificates libssl3 libgcc-s1 \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=builder /out/bin/zainod /usr/local/bin/zainod - -# Writable home for XDG defaults (config, cache, etc.) -# The actual UID is mapped at runtime via --userns=keep-id or --user. -RUN mkdir -p /home/zaino && chmod 777 /home/zaino -ENV HOME=/home/zaino - -EXPOSE 8137 8237 - -HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ - CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 - -# Run as non-root. The caller MUST map their host user: -# podman: podman run --userns=keep-id zaino -# docker: docker run --user "$(id -u):$(id -g)" zaino -ENTRYPOINT ["zainod"] -CMD ["start"] diff --git a/Containerfile.runtime b/Containerfile.runtime new file mode 100644 index 000000000..0d3c46347 --- /dev/null +++ b/Containerfile.runtime @@ -0,0 +1,33 @@ +# syntax=docker/dockerfile:1 + +ARG BUILDER_IMAGE +FROM ${BUILDER_IMAGE} AS builder + +############################ +# Runtime +############################ +FROM debian:bookworm-slim AS runtime + +# Runtime deps +RUN apt-get -qq update && \ + apt-get -qq install -y --no-install-recommends \ + ca-certificates libssl3 libgcc-s1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /out/bin/zainod /usr/local/bin/zainod + +# Writable home for XDG defaults (config, cache, etc.) +# The actual UID is mapped at runtime via --userns=keep-id or --user. +RUN mkdir -p /home/zaino && chmod 777 /home/zaino +ENV HOME=/home/zaino + +EXPOSE 8137 8237 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ + CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 + +# Run as non-root. The caller MUST map their host user: +# podman: podman run --userns=keep-id zaino +# docker: docker run --user "$(id -u):$(id -g)" zaino +ENTRYPOINT ["zainod"] +CMD ["start"] diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 0a560d38d..000000000 --- a/Dockerfile +++ /dev/null @@ -1,75 +0,0 @@ -# syntax=docker/dockerfile:1 - -############################ -# Builder -############################ -ARG RUST_VERSION=1.86.0 - -FROM rust:${RUST_VERSION}-bookworm AS builder -SHELL ["/bin/bash", "-euo", "pipefail", "-c"] -WORKDIR /app - -# Toggle to build without TLS feature if needed -ARG NO_TLS=false - -# Build deps incl. protoc for prost-build -RUN apt-get update && apt-get install -y --no-install-recommends \ - pkg-config clang cmake make libssl-dev ca-certificates \ - protobuf-compiler \ - && rm -rf /var/lib/apt/lists/* - -# Copy entire workspace (prevents missing members) -COPY . . - -# Efficient caches + install to a known prefix (/out) -# This avoids relying on target/release/ paths. -RUN --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=/usr/local/cargo/git \ - --mount=type=cache,target=/app/target \ - if [ "${NO_TLS}" = "true" ]; then \ - cargo install --locked --path zainod --bin zainod --root /out --features no_tls_use_unencrypted_traffic; \ - else \ - cargo install --locked --path zainod --bin zainod --root /out; \ - fi - -############################ -# Runtime (slim, non-root) -############################ -FROM debian:bookworm-slim AS runtime -SHELL ["/bin/bash", "-euo", "pipefail", "-c"] - -ARG UID=1000 -ARG GID=1000 -ARG USER=container_user -ARG HOME=/home/container_user - -# Only the dynamic libs needed by a Rust/OpenSSL binary -RUN apt-get -qq update && \ - apt-get -qq install -y --no-install-recommends \ - ca-certificates libssl3 libgcc-s1 \ - && rm -rf /var/lib/apt/lists/* - -# Create non-root user -RUN addgroup --gid "${GID}" "${USER}" && \ - adduser --uid "${UID}" --gid "${GID}" --home "${HOME}" \ - --disabled-password --gecos "" "${USER}" - -WORKDIR ${HOME} - -# Copy the installed binary from builder -COPY --from=builder /out/bin/zainod /usr/local/bin/zainod - -RUN mkdir -p .cache/zaino -RUN chown -R "${UID}:${GID}" "${HOME}" -USER ${USER} - -# Default ports (adjust if your app uses different ones) -ARG ZAINO_GRPC_PORT=8137 -ARG ZAINO_JSON_RPC_PORT=8237 -EXPOSE ${ZAINO_GRPC_PORT} ${ZAINO_JSON_RPC_PORT} - -# Healthcheck that doesn't assume specific HTTP/gRPC endpoints -HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ - CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 - -CMD ["zainod"] diff --git a/Dockerfile.runtime b/Dockerfile.runtime new file mode 100644 index 000000000..91ee293ce --- /dev/null +++ b/Dockerfile.runtime @@ -0,0 +1,39 @@ +# syntax=docker/dockerfile:1 + +ARG BUILDER_IMAGE +FROM ${BUILDER_IMAGE} AS builder + +############################ +# Runtime +############################ +FROM debian:bookworm-slim AS runtime + +# Runtime deps +RUN apt-get -qq update && \ + apt-get -qq install -y --no-install-recommends \ + ca-certificates libssl3 libgcc-s1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /out/bin/zainod /usr/local/bin/zainod + +EXPOSE 8137 8237 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ + CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 + +# Docker-specific: baked-in non-root user +ARG UID=1000 +ARG GID=1000 +ARG USER=container_user +ARG HOME=/home/container_user + +RUN addgroup --gid "${GID}" "${USER}" && \ + adduser --uid "${UID}" --gid "${GID}" --home "${HOME}" \ + --disabled-password --gecos "" "${USER}" + +WORKDIR ${HOME} +RUN mkdir -p .cache/zaino +RUN chown -R "${UID}:${GID}" "${HOME}" +USER ${USER} + +CMD ["zainod"] diff --git a/Makefile.toml b/Makefile.toml index e76055a94..b2c2fb087 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -603,3 +603,58 @@ info "Filter: $FILTER" makers container-test -E "$FILTER" "${@}" ''' script.post = "makers notify" + +# ------------------------------------------------------------------- + +[tasks.build-zainod] +description = "Build zainod container image (usage: makers build-zainod )" +script_runner = "bash" +script = ''' +set -euo pipefail +source "./utils/helpers.sh" + +ENGINE="${1:?Usage: makers build-zainod }" + +if [ -n "$(git status --porcelain)" ]; then + if [ "${FORCE:-}" = "true" ]; then + warn "Working directory is dirty — proceeding because FORCE=true" + else + err "Working directory is dirty. Commit your changes or run with: makers --env FORCE=true build-zainod $ENGINE" + exit 1 + fi +fi + +RUST_VERSION=$(rustc --version | awk '{print $2}') +COMMIT=$(git rev-parse --short HEAD) +BUILDER_TAG="zaino-builder:${RUST_VERSION}-${COMMIT}" + +if [ "$ENGINE" = "podman" ]; then + RUNTIME_FILE="Containerfile.runtime" +elif [ "$ENGINE" = "docker" ]; then + RUNTIME_FILE="Dockerfile.runtime" +else + err "Unknown engine: $ENGINE (use podman or docker)" + exit 1 +fi + +info "Building zainod builder image" +info "Engine: $ENGINE" +info "Rust: $RUST_VERSION" +info "Commit: $COMMIT" +info "Tag: $BUILDER_TAG" + +$ENGINE build -f Containerfile.builder \ + --build-arg RUST_VERSION="$RUST_VERSION" \ + -t "$BUILDER_TAG" \ + . + +info "Building zainod runtime image" +info "Runtime file: $RUNTIME_FILE" + +$ENGINE build -f "$RUNTIME_FILE" \ + --build-arg BUILDER_IMAGE="$BUILDER_TAG" \ + -t zainod \ + . + +info "Done. Run with: $ENGINE run --rm zainod" +''' diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 05dded7f8..73cb934de 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.92" +channel = "stable" components = ["rustfmt", "clippy"] From 90fcd6b98b30adfebcdc36f47a10ca29b07db04f Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 21:13:21 -0800 Subject: [PATCH 06/14] set up local hidden convenience stash for zainod config --- .gitignore | 2 +- .zainod_config/gitinclude | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .zainod_config/gitinclude diff --git a/.gitignore b/.gitignore index 108dfaaae..ac6401e53 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ container-target/ .local/ .failed-tests **/proptest-regressions/** -zainod_config/ +.zainod_config/ diff --git a/.zainod_config/gitinclude b/.zainod_config/gitinclude new file mode 100644 index 000000000..e69de29bb From 6bbb42d1548ff72e916c36c0688817392d78d921 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 21:19:27 -0800 Subject: [PATCH 07/14] add tag to zainod to run --- Makefile.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index b2c2fb087..894bbfd7e 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -651,10 +651,12 @@ $ENGINE build -f Containerfile.builder \ info "Building zainod runtime image" info "Runtime file: $RUNTIME_FILE" +ZAINOD_TAG="zainod:${RUST_VERSION}-${COMMIT}" + $ENGINE build -f "$RUNTIME_FILE" \ --build-arg BUILDER_IMAGE="$BUILDER_TAG" \ - -t zainod \ + -t "$ZAINOD_TAG" \ . -info "Done. Run with: $ENGINE run --rm zainod" +info "Done. Run with: $ENGINE run --rm $ZAINOD_TAG" ''' From 92ecb10660adf2f8f99d4388ca40b073d3aa8528 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 21:26:50 -0800 Subject: [PATCH 08/14] the only divergence in build-specs should now be in the tail files --- Containerfile.runtime | 11 ----------- Containerfile.tail | 12 ++++++++++++ Dockerfile.runtime | 39 --------------------------------------- Dockerfile.tail | 21 +++++++++++++++++++++ Makefile.toml | 31 +++++++++++++++++++++---------- 5 files changed, 54 insertions(+), 60 deletions(-) create mode 100644 Containerfile.tail delete mode 100644 Dockerfile.runtime create mode 100644 Dockerfile.tail diff --git a/Containerfile.runtime b/Containerfile.runtime index 0d3c46347..5af0e3725 100644 --- a/Containerfile.runtime +++ b/Containerfile.runtime @@ -16,18 +16,7 @@ RUN apt-get -qq update && \ COPY --from=builder /out/bin/zainod /usr/local/bin/zainod -# Writable home for XDG defaults (config, cache, etc.) -# The actual UID is mapped at runtime via --userns=keep-id or --user. -RUN mkdir -p /home/zaino && chmod 777 /home/zaino -ENV HOME=/home/zaino - EXPOSE 8137 8237 HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 - -# Run as non-root. The caller MUST map their host user: -# podman: podman run --userns=keep-id zaino -# docker: docker run --user "$(id -u):$(id -g)" zaino -ENTRYPOINT ["zainod"] -CMD ["start"] diff --git a/Containerfile.tail b/Containerfile.tail new file mode 100644 index 000000000..13eebbc3d --- /dev/null +++ b/Containerfile.tail @@ -0,0 +1,12 @@ +# syntax=docker/dockerfile:1 + +ARG RUNTIME_IMAGE +FROM ${RUNTIME_IMAGE} + +# Writable home for XDG defaults (config, cache, etc.) +# The actual UID is mapped at runtime via --userns=keep-id or --user. +RUN mkdir -p /home/zaino && chmod 777 /home/zaino +ENV HOME=/home/zaino + +ENTRYPOINT ["zainod"] +CMD ["start"] diff --git a/Dockerfile.runtime b/Dockerfile.runtime deleted file mode 100644 index 91ee293ce..000000000 --- a/Dockerfile.runtime +++ /dev/null @@ -1,39 +0,0 @@ -# syntax=docker/dockerfile:1 - -ARG BUILDER_IMAGE -FROM ${BUILDER_IMAGE} AS builder - -############################ -# Runtime -############################ -FROM debian:bookworm-slim AS runtime - -# Runtime deps -RUN apt-get -qq update && \ - apt-get -qq install -y --no-install-recommends \ - ca-certificates libssl3 libgcc-s1 \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=builder /out/bin/zainod /usr/local/bin/zainod - -EXPOSE 8137 8237 - -HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ - CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 - -# Docker-specific: baked-in non-root user -ARG UID=1000 -ARG GID=1000 -ARG USER=container_user -ARG HOME=/home/container_user - -RUN addgroup --gid "${GID}" "${USER}" && \ - adduser --uid "${UID}" --gid "${GID}" --home "${HOME}" \ - --disabled-password --gecos "" "${USER}" - -WORKDIR ${HOME} -RUN mkdir -p .cache/zaino -RUN chown -R "${UID}:${GID}" "${HOME}" -USER ${USER} - -CMD ["zainod"] diff --git a/Dockerfile.tail b/Dockerfile.tail new file mode 100644 index 000000000..4cb043757 --- /dev/null +++ b/Dockerfile.tail @@ -0,0 +1,21 @@ +# syntax=docker/dockerfile:1 + +ARG RUNTIME_IMAGE +FROM ${RUNTIME_IMAGE} + +# Docker-specific: baked-in non-root user +ARG UID=1000 +ARG GID=1000 +ARG USER=container_user +ARG HOME=/home/container_user + +RUN addgroup --gid "${GID}" "${USER}" && \ + adduser --uid "${UID}" --gid "${GID}" --home "${HOME}" \ + --disabled-password --gecos "" "${USER}" + +WORKDIR ${HOME} +RUN mkdir -p .cache/zaino +RUN chown -R "${UID}:${GID}" "${HOME}" +USER ${USER} + +CMD ["zainod"] diff --git a/Makefile.toml b/Makefile.toml index 894bbfd7e..c77bcaf29 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -624,17 +624,21 @@ if [ -n "$(git status --porcelain)" ]; then fi fi +if [ "$ENGINE" != "podman" ] && [ "$ENGINE" != "docker" ]; then + err "Unknown engine: $ENGINE (use podman or docker)" + exit 1 +fi + RUST_VERSION=$(rustc --version | awk '{print $2}') COMMIT=$(git rev-parse --short HEAD) BUILDER_TAG="zaino-builder:${RUST_VERSION}-${COMMIT}" +RUNTIME_TAG="zaino-runtime:${RUST_VERSION}-${COMMIT}" +ZAINOD_TAG="zainod:${RUST_VERSION}-${COMMIT}" if [ "$ENGINE" = "podman" ]; then - RUNTIME_FILE="Containerfile.runtime" -elif [ "$ENGINE" = "docker" ]; then - RUNTIME_FILE="Dockerfile.runtime" + TAIL_FILE="Containerfile.tail" else - err "Unknown engine: $ENGINE (use podman or docker)" - exit 1 + TAIL_FILE="Dockerfile.tail" fi info "Building zainod builder image" @@ -648,13 +652,20 @@ $ENGINE build -f Containerfile.builder \ -t "$BUILDER_TAG" \ . -info "Building zainod runtime image" -info "Runtime file: $RUNTIME_FILE" - -ZAINOD_TAG="zainod:${RUST_VERSION}-${COMMIT}" +info "Building zainod runtime base image" +info "Tag: $RUNTIME_TAG" -$ENGINE build -f "$RUNTIME_FILE" \ +$ENGINE build -f Containerfile.runtime \ --build-arg BUILDER_IMAGE="$BUILDER_TAG" \ + -t "$RUNTIME_TAG" \ + . + +info "Building final zainod image" +info "Tail file: $TAIL_FILE" +info "Tag: $ZAINOD_TAG" + +$ENGINE build -f "$TAIL_FILE" \ + --build-arg RUNTIME_IMAGE="$RUNTIME_TAG" \ -t "$ZAINOD_TAG" \ . From 027d845d5a3280c45f20c2e255944cef651f9b53 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 22:06:48 -0800 Subject: [PATCH 09/14] add help and helperize repetitive logic --- Makefile.toml | 93 +++++++++++++++++++++++++++++++++--------------- utils/helpers.sh | 55 ++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 29 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index c77bcaf29..181cea5ff 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -35,6 +35,8 @@ echo " container-test Run integration tests using the local image" echo " container-test-save-failures Run tests, save failures to .failed-tests" echo " container-test-retry-failures Rerun only the previously failed tests" echo " build-image Build the Docker image with current artifact versions" +echo " build-zainod Build zainod container image (makers build-zainod )" +echo " run-zainod Build, configure, and run zainod (makers run-zainod )" echo " push-image Push the image (used in CI, can be used manually)" echo " compute-image-tag Compute the tag for the Docker image based on versions" echo " get-docker-hash Get DOCKER_DIR_HASH value (hash for the image defining files)" @@ -606,41 +608,28 @@ script.post = "makers notify" # ------------------------------------------------------------------- -[tasks.build-zainod] -description = "Build zainod container image (usage: makers build-zainod )" +[tasks.base-zainod] +private = true script_runner = "bash" -script = ''' +script.pre = ''' set -euo pipefail source "./utils/helpers.sh" -ENGINE="${1:?Usage: makers build-zainod }" +validate_engine "${1:-}" +require_clean_worktree +compute_zainod_tags -if [ -n "$(git status --porcelain)" ]; then - if [ "${FORCE:-}" = "true" ]; then - warn "Working directory is dirty — proceeding because FORCE=true" - else - err "Working directory is dirty. Commit your changes or run with: makers --env FORCE=true build-zainod $ENGINE" - exit 1 - fi -fi - -if [ "$ENGINE" != "podman" ] && [ "$ENGINE" != "docker" ]; then - err "Unknown engine: $ENGINE (use podman or docker)" - exit 1 -fi - -RUST_VERSION=$(rustc --version | awk '{print $2}') -COMMIT=$(git rev-parse --short HEAD) -BUILDER_TAG="zaino-builder:${RUST_VERSION}-${COMMIT}" -RUNTIME_TAG="zaino-runtime:${RUST_VERSION}-${COMMIT}" -ZAINOD_TAG="zainod:${RUST_VERSION}-${COMMIT}" +TAIL_FILE=$(tail_file_for_engine) +CMD_PREFIX=$(cmd_prefix_for_engine) +''' +script.main = "err 'base-zainod: override script.main in the extending task'" -if [ "$ENGINE" = "podman" ]; then - TAIL_FILE="Containerfile.tail" -else - TAIL_FILE="Dockerfile.tail" -fi +# ------------------------------------------------------------------- +[tasks.build-zainod] +description = "Build zainod container image (usage: makers build-zainod )" +extend = "base-zainod" +script.main = ''' info "Building zainod builder image" info "Engine: $ENGINE" info "Rust: $RUST_VERSION" @@ -669,5 +658,51 @@ $ENGINE build -f "$TAIL_FILE" \ -t "$ZAINOD_TAG" \ . -info "Done. Run with: $ENGINE run --rm $ZAINOD_TAG" +info "Done. Run with: makers run-zainod $ENGINE" +''' + +# ------------------------------------------------------------------- + +[tasks.run-zainod] +description = "Build, configure, and run zainod (usage: makers run-zainod )" +extend = "base-zainod" +script.main = ''' +# Skip build if image already exists +if $ENGINE image inspect "$ZAINOD_TAG" > /dev/null 2>&1; then + info "Image $ZAINOD_TAG already exists — skipping build" +else + info "Image $ZAINOD_TAG not found — building..." + makers build-zainod "$ENGINE" +fi + +CONFIG_DIR=".zainod_config" +CONFIG_FILE="${CONFIG_DIR}/zainod.toml" + +# Generate config if it doesn't exist +if [ ! -f "$CONFIG_FILE" ]; then + info "Generating default config at $CONFIG_FILE" + mkdir -p "$CONFIG_DIR" + $ENGINE run --rm \ + --user "$(id -u):$(id -g)" \ + -v "$PWD/$CONFIG_DIR:/config" \ + "$ZAINOD_TAG" \ + $CMD_PREFIX generate-config -o /config/zainod.toml + + # Patch gRPC listen address for container networking + sed -i 's/listen_address = "127\.0\.0\.1:8137"/listen_address = "0.0.0.0:8137"/' "$CONFIG_FILE" + info "Patched gRPC listen_address to 0.0.0.0:8137 for container networking" + warn "Review $CONFIG_FILE and set validator_settings for your setup" +fi + +info "Starting zainod" +info "Engine: $ENGINE" +info "Image: $ZAINOD_TAG" +info "Config: $CONFIG_FILE" + +$ENGINE run --rm \ + -p 8137:8137 \ + -p 8237:8237 \ + -v "$PWD/$CONFIG_DIR:/config" \ + "$ZAINOD_TAG" \ + $CMD_PREFIX start -c /config/zainod.toml ''' diff --git a/utils/helpers.sh b/utils/helpers.sh index b705c5422..92695f72a 100755 --- a/utils/helpers.sh +++ b/utils/helpers.sh @@ -33,3 +33,58 @@ resolve_build_target() { fi } +# ------- ZAINOD CONTAINER HELPERS ------------ + +# Validate the container engine argument. +# Sets ENGINE as a side-effect. +validate_engine() { + ENGINE="${1:?Usage: makers }" + if [ "$ENGINE" != "podman" ] && [ "$ENGINE" != "docker" ]; then + err "Unknown engine: $ENGINE (use podman or docker)" + exit 1 + fi +} + +# Abort unless the working tree is clean. +# Respects FORCE=true to override. +require_clean_worktree() { + if [ -n "$(git status --porcelain)" ]; then + if [ "${FORCE:-}" = "true" ]; then + warn "Working directory is dirty — proceeding because FORCE=true" + else + err "Working directory is dirty. Commit your changes or set FORCE=true" + exit 1 + fi + fi +} + +# Compute image tags from the current rust toolchain and HEAD commit. +# Exports: RUST_VERSION, COMMIT, BUILDER_TAG, RUNTIME_TAG, ZAINOD_TAG +compute_zainod_tags() { + RUST_VERSION=$(rustc --version | awk '{print $2}') + COMMIT=$(git rev-parse --short HEAD) + BUILDER_TAG="zaino-builder:${RUST_VERSION}-${COMMIT}" + RUNTIME_TAG="zaino-runtime:${RUST_VERSION}-${COMMIT}" + ZAINOD_TAG="zainod:${RUST_VERSION}-${COMMIT}" +} + +# Return the engine-specific tail file for the final build stage. +tail_file_for_engine() { + if [ "$ENGINE" = "podman" ]; then + echo "Containerfile.tail" + else + echo "Dockerfile.tail" + fi +} + +# Return the command prefix needed to invoke zainod in the container. +# Podman images have ENTRYPOINT ["zainod"], so no prefix is needed. +# Docker images have no entrypoint, so the binary name must be given. +cmd_prefix_for_engine() { + if [ "$ENGINE" = "podman" ]; then + echo "" + else + echo "zainod" + fi +} + From 247bc46e15853db04f9c3e2368ee3e6e7ac0a525 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 22:09:26 -0800 Subject: [PATCH 10/14] publish zainod tasks --- Makefile.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.toml b/Makefile.toml index 181cea5ff..aca9e8e0f 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -629,6 +629,7 @@ script.main = "err 'base-zainod: override script.main in the extending task'" [tasks.build-zainod] description = "Build zainod container image (usage: makers build-zainod )" extend = "base-zainod" +private = false script.main = ''' info "Building zainod builder image" info "Engine: $ENGINE" @@ -666,6 +667,7 @@ info "Done. Run with: makers run-zainod $ENGINE" [tasks.run-zainod] description = "Build, configure, and run zainod (usage: makers run-zainod )" extend = "base-zainod" +private = false script.main = ''' # Skip build if image already exists if $ENGINE image inspect "$ZAINOD_TAG" > /dev/null 2>&1; then From a54c149d323efeeb4984a7e60f4c5b999491d4d2 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 22:14:12 -0800 Subject: [PATCH 11/14] make engine specific run flags --- Makefile.toml | 4 +++- utils/helpers.sh | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile.toml b/Makefile.toml index aca9e8e0f..e7c34e086 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -621,6 +621,7 @@ compute_zainod_tags TAIL_FILE=$(tail_file_for_engine) CMD_PREFIX=$(cmd_prefix_for_engine) +RUN_FLAGS=$(run_flags_for_engine) ''' script.main = "err 'base-zainod: override script.main in the extending task'" @@ -685,7 +686,7 @@ if [ ! -f "$CONFIG_FILE" ]; then info "Generating default config at $CONFIG_FILE" mkdir -p "$CONFIG_DIR" $ENGINE run --rm \ - --user "$(id -u):$(id -g)" \ + $RUN_FLAGS \ -v "$PWD/$CONFIG_DIR:/config" \ "$ZAINOD_TAG" \ $CMD_PREFIX generate-config -o /config/zainod.toml @@ -702,6 +703,7 @@ info "Image: $ZAINOD_TAG" info "Config: $CONFIG_FILE" $ENGINE run --rm \ + $RUN_FLAGS \ -p 8137:8137 \ -p 8237:8237 \ -v "$PWD/$CONFIG_DIR:/config" \ diff --git a/utils/helpers.sh b/utils/helpers.sh index 92695f72a..c30cc9785 100755 --- a/utils/helpers.sh +++ b/utils/helpers.sh @@ -88,3 +88,14 @@ cmd_prefix_for_engine() { fi } +# Return extra flags for "$ENGINE run" that differ between engines. +# Podman: --userns=keep-id maps the host UID into the container. +# Docker: --user flag to run as the host user. +run_flags_for_engine() { + if [ "$ENGINE" = "podman" ]; then + echo "--userns=keep-id" + else + echo "--user $(id -u):$(id -g)" + fi +} + From 52210f9b4351fedd3c2d905acc900886eca6f711 Mon Sep 17 00:00:00 2001 From: zancas Date: Wed, 25 Feb 2026 23:07:58 -0800 Subject: [PATCH 12/14] simplify into one common Containerfile.build --- Containerfile.builder | 33 --------------------------------- Containerfile.runtime | 22 ---------------------- Makefile.toml | 14 +++----------- utils/helpers.sh | 3 +-- 4 files changed, 4 insertions(+), 68 deletions(-) delete mode 100644 Containerfile.builder delete mode 100644 Containerfile.runtime diff --git a/Containerfile.builder b/Containerfile.builder deleted file mode 100644 index 70a7cf204..000000000 --- a/Containerfile.builder +++ /dev/null @@ -1,33 +0,0 @@ -# syntax=docker/dockerfile:1 - -############################ -# Builder -############################ -ARG RUST_VERSION - -FROM rust:${RUST_VERSION}-bookworm AS builder -SHELL ["/bin/bash", "-euo", "pipefail", "-c"] -WORKDIR /app - -# Toggle to build without TLS feature if needed -ARG NO_TLS=false - -# Build deps incl. protoc for prost-build -RUN apt-get update && apt-get install -y --no-install-recommends \ - pkg-config clang cmake make libssl-dev ca-certificates \ - protobuf-compiler \ - && rm -rf /var/lib/apt/lists/* - -# Copy entire workspace (prevents missing members) -COPY . . - -# Efficient caches + install to a known prefix (/out) -# This avoids relying on target/release/ paths. -RUN --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=/usr/local/cargo/git \ - --mount=type=cache,target=/app/target \ - if [ "${NO_TLS}" = "true" ]; then \ - cargo install --locked --path zainod --bin zainod --root /out --features no_tls_use_unencrypted_traffic; \ - else \ - cargo install --locked --path zainod --bin zainod --root /out; \ - fi diff --git a/Containerfile.runtime b/Containerfile.runtime deleted file mode 100644 index 5af0e3725..000000000 --- a/Containerfile.runtime +++ /dev/null @@ -1,22 +0,0 @@ -# syntax=docker/dockerfile:1 - -ARG BUILDER_IMAGE -FROM ${BUILDER_IMAGE} AS builder - -############################ -# Runtime -############################ -FROM debian:bookworm-slim AS runtime - -# Runtime deps -RUN apt-get -qq update && \ - apt-get -qq install -y --no-install-recommends \ - ca-certificates libssl3 libgcc-s1 \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=builder /out/bin/zainod /usr/local/bin/zainod - -EXPOSE 8137 8237 - -HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ - CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 diff --git a/Makefile.toml b/Makefile.toml index e7c34e086..4c511795f 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -632,22 +632,14 @@ description = "Build zainod container image (usage: makers build-zainod Date: Wed, 25 Feb 2026 23:08:17 -0800 Subject: [PATCH 13/14] and add it --- Containerfile.build | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Containerfile.build diff --git a/Containerfile.build b/Containerfile.build new file mode 100644 index 000000000..32537f59a --- /dev/null +++ b/Containerfile.build @@ -0,0 +1,51 @@ +# syntax=docker/dockerfile:1 + +############################ +# Builder +############################ +ARG RUST_VERSION + +FROM rust:${RUST_VERSION}-bookworm AS builder +SHELL ["/bin/bash", "-euo", "pipefail", "-c"] +WORKDIR /app + +# Toggle to build without TLS feature if needed +ARG NO_TLS=false + +# Build deps incl. protoc for prost-build +RUN apt-get update && apt-get install -y --no-install-recommends \ + pkg-config clang cmake make libssl-dev ca-certificates \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +# Copy entire workspace (prevents missing members) +COPY . . + +# Efficient caches + install to a known prefix (/out) +# This avoids relying on target/release/ paths. +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/local/cargo/git \ + --mount=type=cache,target=/app/target \ + if [ "${NO_TLS}" = "true" ]; then \ + cargo install --locked --path zainod --bin zainod --root /out --features no_tls_use_unencrypted_traffic; \ + else \ + cargo install --locked --path zainod --bin zainod --root /out; \ + fi + +############################ +# Runtime +############################ +FROM debian:bookworm-slim AS runtime + +# Runtime deps +RUN apt-get -qq update && \ + apt-get -qq install -y --no-install-recommends \ + ca-certificates libssl3 libgcc-s1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /out/bin/zainod /usr/local/bin/zainod + +EXPOSE 8137 8237 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ + CMD /usr/local/bin/zainod --version >/dev/null 2>&1 || exit 1 From ead0439f2ced432266d31e1bb3704e570aa3260b Mon Sep 17 00:00:00 2001 From: zancas Date: Thu, 26 Feb 2026 14:55:51 -0800 Subject: [PATCH 14/14] reset to dev state --- zaino-proto/src/proto/service.rs | 906 ++++++++++--------------------- 1 file changed, 289 insertions(+), 617 deletions(-) diff --git a/zaino-proto/src/proto/service.rs b/zaino-proto/src/proto/service.rs index 2441bc93f..cbe8a5d0f 100644 --- a/zaino-proto/src/proto/service.rs +++ b/zaino-proto/src/proto/service.rs @@ -380,10 +380,10 @@ pub mod compact_tx_streamer_client { dead_code, missing_docs, clippy::wildcard_imports, - clippy::let_unit_value, + clippy::let_unit_value )] - use tonic::codegen::*; use tonic::codegen::http::Uri; + use tonic::codegen::*; #[derive(Debug, Clone)] pub struct CompactTxStreamerClient { inner: tonic::client::Grpc, @@ -427,9 +427,8 @@ pub mod compact_tx_streamer_client { >::ResponseBody, >, >, - , - >>::Error: Into + std::marker::Send + std::marker::Sync, + >>::Error: + Into + std::marker::Send + std::marker::Sync, { CompactTxStreamerClient::new(InterceptedService::new(inner, interceptor)) } @@ -469,26 +468,18 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetLatestBlock", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetLatestBlock", + )); self.inner.unary(req, path, codec).await } /// Return the compact block corresponding to the given block identifier @@ -499,26 +490,18 @@ pub mod compact_tx_streamer_client { tonic::Response, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlock", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlock", + )); self.inner.unary(req, path, codec).await } /// Same as GetBlock except the returned CompactBlock value contains only @@ -533,26 +516,18 @@ pub mod compact_tx_streamer_client { tonic::Response, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockNullifiers", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlockNullifiers", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlockNullifiers", + )); self.inner.unary(req, path, codec).await } /// Return a list of consecutive compact blocks in the specified range, @@ -564,31 +539,21 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, + tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlockRange", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlockRange", + )); self.inner.server_streaming(req, path, codec).await } /// Same as GetBlockRange except the returned CompactBlock values contain @@ -600,31 +565,21 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, + tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRangeNullifiers", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetBlockRangeNullifiers", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetBlockRangeNullifiers", + )); self.inner.server_streaming(req, path, codec).await } /// Return the requested full (not compact) transaction (as from zcashd) @@ -632,26 +587,18 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTransaction", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTransaction", + )); self.inner.unary(req, path, codec).await } /// Submit the given transaction to the Zcash network @@ -659,26 +606,18 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "SendTransaction", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "SendTransaction", + )); self.inner.unary(req, path, codec).await } /// Return RawTransactions that match the given transparent address filter. @@ -692,26 +631,18 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressTxids", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressTxids", + )); self.inner.server_streaming(req, path, codec).await } /// Return the transactions corresponding to the given t-address within the given block range. @@ -723,78 +654,54 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTransactions", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressTransactions", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressTransactions", + )); self.inner.server_streaming(req, path, codec).await } pub async fn get_taddress_balance( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressBalance", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressBalance", + )); self.inner.unary(req, path, codec).await } pub async fn get_taddress_balance_stream( &mut self, request: impl tonic::IntoStreamingRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream", ); let mut req = request.into_streaming_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTaddressBalanceStream", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTaddressBalanceStream", + )); self.inner.client_streaming(req, path, codec).await } /// Returns a stream of the compact transaction representation for transactions @@ -813,31 +720,21 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, + tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetMempoolTx", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetMempoolTx", + )); self.inner.server_streaming(req, path, codec).await } /// Return a stream of current Mempool transactions. This will keep the output stream open while @@ -849,26 +746,18 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetMempoolStream", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetMempoolStream", + )); self.inner.server_streaming(req, path, codec).await } /// GetTreeState returns the note commitment tree state corresponding to the given block. @@ -879,52 +768,36 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetTreeState", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetTreeState", + )); self.inner.unary(req, path, codec).await } pub async fn get_latest_tree_state( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestTreeState", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetLatestTreeState", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetLatestTreeState", + )); self.inner.unary(req, path, codec).await } /// Returns a stream of information about roots of subtrees of the note commitment tree @@ -936,55 +809,37 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetSubtreeRoots", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetSubtreeRoots", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetSubtreeRoots", + )); self.inner.server_streaming(req, path, codec).await } pub async fn get_address_utxos( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetAddressUtxos", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetAddressUtxos", + )); self.inner.unary(req, path, codec).await } pub async fn get_address_utxos_stream( @@ -994,26 +849,18 @@ pub mod compact_tx_streamer_client { tonic::Response>, tonic::Status, > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetAddressUtxosStream", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetAddressUtxosStream", + )); self.inner.server_streaming(req, path, codec).await } /// Return information about this lightwalletd instance and the blockchain @@ -1021,26 +868,18 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "cash.z.wallet.sdk.rpc.CompactTxStreamer", - "GetLightdInfo", - ), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "GetLightdInfo", + )); self.inner.unary(req, path, codec).await } /// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production) @@ -1048,23 +887,18 @@ pub mod compact_tx_streamer_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner.ready().await.map_err(|e| { + tonic::Status::unknown(format!("Service was not ready: {}", e.into())) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping", ); let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("cash.z.wallet.sdk.rpc.CompactTxStreamer", "Ping"), - ); + req.extensions_mut().insert(GrpcMethod::new( + "cash.z.wallet.sdk.rpc.CompactTxStreamer", + "Ping", + )); self.inner.unary(req, path, codec).await } } @@ -1076,7 +910,7 @@ pub mod compact_tx_streamer_server { dead_code, missing_docs, clippy::wildcard_imports, - clippy::let_unit_value, + clippy::let_unit_value )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with CompactTxStreamerServer. @@ -1113,8 +947,7 @@ pub mod compact_tx_streamer_server { crate::proto::compact_formats::CompactBlock, tonic::Status, >, - > - + std::marker::Send + > + std::marker::Send + 'static; /// Return a list of consecutive compact blocks in the specified range, /// which is inclusive of `range.end`. @@ -1124,18 +957,14 @@ pub mod compact_tx_streamer_server { async fn get_block_range( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetBlockRangeNullifiers method. type GetBlockRangeNullifiersStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result< crate::proto::compact_formats::CompactBlock, tonic::Status, >, - > - + std::marker::Send + > + std::marker::Send + 'static; /// Same as GetBlockRange except the returned CompactBlock values contain /// only nullifiers. @@ -1145,10 +974,7 @@ pub mod compact_tx_streamer_server { async fn get_block_range_nullifiers( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Return the requested full (not compact) transaction (as from zcashd) async fn get_transaction( &self, @@ -1162,8 +988,7 @@ pub mod compact_tx_streamer_server { /// Server streaming response type for the GetTaddressTxids method. type GetTaddressTxidsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > - + std::marker::Send + > + std::marker::Send + 'static; /// Return RawTransactions that match the given transparent address filter. /// @@ -1172,25 +997,18 @@ pub mod compact_tx_streamer_server { async fn get_taddress_txids( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetTaddressTransactions method. type GetTaddressTransactionsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > - + std::marker::Send + > + std::marker::Send + 'static; /// Return the transactions corresponding to the given t-address within the given block range. /// Mempool transactions are not included in the results. async fn get_taddress_transactions( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_taddress_balance( &self, request: tonic::Request, @@ -1201,12 +1019,8 @@ pub mod compact_tx_streamer_server { ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetMempoolTx method. type GetMempoolTxStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result< - crate::proto::compact_formats::CompactTx, - tonic::Status, - >, - > - + std::marker::Send + Item = std::result::Result, + > + std::marker::Send + 'static; /// Returns a stream of the compact transaction representation for transactions /// currently in the mempool. The results of this operation may be a few @@ -1223,25 +1037,18 @@ pub mod compact_tx_streamer_server { async fn get_mempool_tx( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetMempoolStream method. type GetMempoolStreamStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > - + std::marker::Send + > + std::marker::Send + 'static; /// Return a stream of current Mempool transactions. This will keep the output stream open while /// there are mempool transactions. It will close the returned stream when a new block is mined. async fn get_mempool_stream( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// GetTreeState returns the note commitment tree state corresponding to the given block. /// See section 3.7 of the Zcash protocol specification. It returns several other useful /// values also (even though they can be obtained using GetBlock). @@ -1257,38 +1064,27 @@ pub mod compact_tx_streamer_server { /// Server streaming response type for the GetSubtreeRoots method. type GetSubtreeRootsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > - + std::marker::Send + > + std::marker::Send + 'static; /// Returns a stream of information about roots of subtrees of the note commitment tree /// for the specified shielded protocol (Sapling or Orchard). async fn get_subtree_roots( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_address_utxos( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetAddressUtxosStream method. type GetAddressUtxosStreamStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, - > - + std::marker::Send + > + std::marker::Send + 'static; async fn get_address_utxos_stream( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Return information about this lightwalletd instance and the blockchain async fn get_lightd_info( &self, @@ -1321,10 +1117,7 @@ pub mod compact_tx_streamer_server { max_encoding_message_size: None, } } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService where F: tonic::service::Interceptor, { @@ -1379,23 +1172,16 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock" => { #[allow(non_camel_case_types)] struct GetLatestBlockSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService - for GetLatestBlockSvc { + impl tonic::server::UnaryService for GetLatestBlockSvc { type Response = super::BlockId; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_latest_block(&inner, request) - .await + ::get_latest_block(&inner, request).await }; Box::pin(fut) } @@ -1425,14 +1211,9 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock" => { #[allow(non_camel_case_types)] struct GetBlockSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService for GetBlockSvc { + impl tonic::server::UnaryService for GetBlockSvc { type Response = crate::proto::compact_formats::CompactBlock; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, @@ -1469,25 +1250,18 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockNullifiers" => { #[allow(non_camel_case_types)] struct GetBlockNullifiersSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService - for GetBlockNullifiersSvc { + impl tonic::server::UnaryService + for GetBlockNullifiersSvc + { type Response = crate::proto::compact_formats::CompactBlock; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_block_nullifiers( - &inner, - request, - ) + ::get_block_nullifiers(&inner, request) .await }; Box::pin(fut) @@ -1518,24 +1292,21 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange" => { #[allow(non_camel_case_types)] struct GetBlockRangeSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService - for GetBlockRangeSvc { + impl + tonic::server::ServerStreamingService + for GetBlockRangeSvc + { type Response = crate::proto::compact_formats::CompactBlock; type ResponseStream = T::GetBlockRangeStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_block_range(&inner, request) - .await + ::get_block_range(&inner, request).await }; Box::pin(fut) } @@ -1565,16 +1336,14 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRangeNullifiers" => { #[allow(non_camel_case_types)] struct GetBlockRangeNullifiersSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService - for GetBlockRangeNullifiersSvc { + impl + tonic::server::ServerStreamingService + for GetBlockRangeNullifiersSvc + { type Response = crate::proto::compact_formats::CompactBlock; type ResponseStream = T::GetBlockRangeNullifiersStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, @@ -1582,10 +1351,9 @@ pub mod compact_tx_streamer_server { let inner = Arc::clone(&self.0); let fut = async move { ::get_block_range_nullifiers( - &inner, - request, - ) - .await + &inner, request, + ) + .await }; Box::pin(fut) } @@ -1615,23 +1383,16 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction" => { #[allow(non_camel_case_types)] struct GetTransactionSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService - for GetTransactionSvc { + impl tonic::server::UnaryService for GetTransactionSvc { type Response = super::RawTransaction; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_transaction(&inner, request) - .await + ::get_transaction(&inner, request).await }; Box::pin(fut) } @@ -1661,23 +1422,18 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction" => { #[allow(non_camel_case_types)] struct SendTransactionSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService - for SendTransactionSvc { + impl tonic::server::UnaryService + for SendTransactionSvc + { type Response = super::SendResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::send_transaction(&inner, request) - .await + ::send_transaction(&inner, request).await }; Box::pin(fut) } @@ -1707,28 +1463,21 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids" => { #[allow(non_camel_case_types)] struct GetTaddressTxidsSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService< - super::TransparentAddressBlockFilter, - > for GetTaddressTxidsSvc { + impl + tonic::server::ServerStreamingService + for GetTaddressTxidsSvc + { type Response = super::RawTransaction; type ResponseStream = T::GetTaddressTxidsStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_taddress_txids( - &inner, - request, - ) - .await + ::get_taddress_txids(&inner, request).await }; Box::pin(fut) } @@ -1758,27 +1507,21 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTransactions" => { #[allow(non_camel_case_types)] struct GetTaddressTransactionsSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService< - super::TransparentAddressBlockFilter, - > for GetTaddressTransactionsSvc { + impl + tonic::server::ServerStreamingService + for GetTaddressTransactionsSvc + { type Response = super::RawTransaction; type ResponseStream = T::GetTaddressTransactionsStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_taddress_transactions( - &inner, - request, - ) + ::get_taddress_transactions(&inner, request) .await }; Box::pin(fut) @@ -1809,25 +1552,18 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance" => { #[allow(non_camel_case_types)] struct GetTaddressBalanceSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService - for GetTaddressBalanceSvc { + impl tonic::server::UnaryService + for GetTaddressBalanceSvc + { type Response = super::Balance; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_taddress_balance( - &inner, - request, - ) + ::get_taddress_balance(&inner, request) .await }; Box::pin(fut) @@ -1858,15 +1594,11 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream" => { #[allow(non_camel_case_types)] struct GetTaddressBalanceStreamSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ClientStreamingService - for GetTaddressBalanceStreamSvc { + impl tonic::server::ClientStreamingService + for GetTaddressBalanceStreamSvc + { type Response = super::Balance; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request>, @@ -1874,10 +1606,9 @@ pub mod compact_tx_streamer_server { let inner = Arc::clone(&self.0); let fut = async move { ::get_taddress_balance_stream( - &inner, - request, - ) - .await + &inner, request, + ) + .await }; Box::pin(fut) } @@ -1907,24 +1638,21 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx" => { #[allow(non_camel_case_types)] struct GetMempoolTxSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService - for GetMempoolTxSvc { + impl + tonic::server::ServerStreamingService + for GetMempoolTxSvc + { type Response = crate::proto::compact_formats::CompactTx; type ResponseStream = T::GetMempoolTxStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_mempool_tx(&inner, request) - .await + ::get_mempool_tx(&inner, request).await }; Box::pin(fut) } @@ -1954,27 +1682,17 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream" => { #[allow(non_camel_case_types)] struct GetMempoolStreamSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService - for GetMempoolStreamSvc { + impl tonic::server::ServerStreamingService + for GetMempoolStreamSvc + { type Response = super::RawTransaction; type ResponseStream = T::GetMempoolStreamStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = + BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_mempool_stream( - &inner, - request, - ) - .await + ::get_mempool_stream(&inner, request).await }; Box::pin(fut) } @@ -2004,23 +1722,16 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState" => { #[allow(non_camel_case_types)] struct GetTreeStateSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService - for GetTreeStateSvc { + impl tonic::server::UnaryService for GetTreeStateSvc { type Response = super::TreeState; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_tree_state(&inner, request) - .await + ::get_tree_state(&inner, request).await }; Box::pin(fut) } @@ -2050,23 +1761,13 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestTreeState" => { #[allow(non_camel_case_types)] struct GetLatestTreeStateSvc(pub Arc); - impl tonic::server::UnaryService - for GetLatestTreeStateSvc { + impl tonic::server::UnaryService for GetLatestTreeStateSvc { type Response = super::TreeState; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_latest_tree_state( - &inner, - request, - ) + ::get_latest_tree_state(&inner, request) .await }; Box::pin(fut) @@ -2097,24 +1798,21 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetSubtreeRoots" => { #[allow(non_camel_case_types)] struct GetSubtreeRootsSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService - for GetSubtreeRootsSvc { + impl + tonic::server::ServerStreamingService + for GetSubtreeRootsSvc + { type Response = super::SubtreeRoot; type ResponseStream = T::GetSubtreeRootsStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_subtree_roots(&inner, request) - .await + ::get_subtree_roots(&inner, request).await }; Box::pin(fut) } @@ -2144,23 +1842,19 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos" => { #[allow(non_camel_case_types)] struct GetAddressUtxosSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService - for GetAddressUtxosSvc { + impl + tonic::server::UnaryService + for GetAddressUtxosSvc + { type Response = super::GetAddressUtxosReplyList; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_address_utxos(&inner, request) - .await + ::get_address_utxos(&inner, request).await }; Box::pin(fut) } @@ -2190,26 +1884,21 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream" => { #[allow(non_camel_case_types)] struct GetAddressUtxosStreamSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::ServerStreamingService - for GetAddressUtxosStreamSvc { + impl + tonic::server::ServerStreamingService + for GetAddressUtxosStreamSvc + { type Response = super::GetAddressUtxosReply; type ResponseStream = T::GetAddressUtxosStreamStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_address_utxos_stream( - &inner, - request, - ) + ::get_address_utxos_stream(&inner, request) .await }; Box::pin(fut) @@ -2240,21 +1929,13 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo" => { #[allow(non_camel_case_types)] struct GetLightdInfoSvc(pub Arc); - impl tonic::server::UnaryService - for GetLightdInfoSvc { + impl tonic::server::UnaryService for GetLightdInfoSvc { type Response = super::LightdInfo; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_lightd_info(&inner, request) - .await + ::get_lightd_info(&inner, request).await }; Box::pin(fut) } @@ -2284,14 +1965,9 @@ pub mod compact_tx_streamer_server { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); - impl< - T: CompactTxStreamer, - > tonic::server::UnaryService for PingSvc { + impl tonic::server::UnaryService for PingSvc { type Response = super::PingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, @@ -2325,23 +2001,19 @@ pub mod compact_tx_streamer_server { }; Box::pin(fut) } - _ => { - Box::pin(async move { - let mut response = http::Response::new(empty_body()); - let headers = response.headers_mut(); - headers - .insert( - tonic::Status::GRPC_STATUS, - (tonic::Code::Unimplemented as i32).into(), - ); - headers - .insert( - http::header::CONTENT_TYPE, - tonic::metadata::GRPC_CONTENT_TYPE, - ); - Ok(response) - }) - } + _ => Box::pin(async move { + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers.insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers.insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }), } } }