Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable the default features of the tonic and tonic-build crates to allow downstream consumers to build in Wasm #1270

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
run: cargo add --no-default-features --path ../crates/zcash_proofs
- name: Add zcash_client_backend as a dependency of the synthetic crate
working-directory: ./ci-build
run: cargo add --no-default-features --path ../crates/zcash_client_backend
run: cargo add --features lightwalletd-tonic --path ../crates/zcash_client_backend
- name: Copy pinned dependencies into synthetic crate
run: cp crates/Cargo.lock ci-build/
- name: Add target
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ rayon = "1.5"

# Protobuf and gRPC
prost = "0.12"
tonic = "0.10"
tonic-build = "0.10"
tonic = { version = "0.10", default-features = false }
tonic-build = { version = "0.10", default-features = false }

# Secret management
secrecy = "0.8"
Expand Down
7 changes: 5 additions & 2 deletions zcash_client_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tracing.workspace = true
# - Protobuf interfaces and gRPC bindings
hex.workspace = true
prost.workspace = true
tonic = { workspace = true, optional = true }
tonic = { workspace = true, optional = true, features = ["prost", "codegen"]}

# - Secret management
secrecy.workspace = true
Expand Down Expand Up @@ -102,7 +102,7 @@ crossbeam-channel.workspace = true
rayon.workspace = true

[build-dependencies]
tonic-build.workspace = true
tonic-build = { workspace = true, features = ["prost"]}
which = "4"

[dev-dependencies]
Expand All @@ -123,6 +123,9 @@ time = ">=0.3.22, <0.3.24" # time 0.3.24 has MSRV 1.67
## Enables the `tonic` gRPC client bindings for connecting to a `lightwalletd` server.
lightwalletd-tonic = ["dep:tonic"]

## Enables the `transport` feature of `tonic` producing a fully-featured client and server implementation
lightwalletd-tonic-transport = ["lightwalletd-tonic", "tonic?/transport"]

## Enables receiving transparent funds and shielding them.
transparent-inputs = [
"dep:hdwallet",
Expand Down
13 changes: 13 additions & 0 deletions zcash_client_backend/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,3 +779,16 @@
}
}
}

#[cfg(feature = "lightwalletd-tonic-transport")]
impl service::compact_tx_streamer_client::CompactTxStreamerClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<tonic::codegen::StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))

Check warning on line 792 in zcash_client_backend/src/proto.rs

View check run for this annotation

Codecov / codecov/patch

zcash_client_backend/src/proto.rs#L791-L792

Added lines #L791 - L792 were not covered by tests
}
}
11 changes: 0 additions & 11 deletions zcash_client_backend/src/proto/service.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading