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

Document zcash_note_encryption non-local dependency rationale & doc work-around. #858

Closed
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
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ working with Zcash.

These libraries are currently under development and have not been fully-reviewed.

## Cross-Workspace Dependency Cycle

There is a complication in crate dependencies documented in
[`components/zcash_note_encryption/README.md`](./components/zcash_note_encryption/README.md)
and [issue #768](/~https://github.com/zcash/librustzcash/issues/768).

### `cargo doc` Warning

A consequence of the cross-workspace dependency above is that there's a name collision for the
two distinct `zcash_note_encryption` crates when running `cargo doc`:

```
warning: output filename collision.
The lib target `zcash_note_encryption` in package `zcash_note_encryption v0.4.0` has the same output filename as the lib target `zcash_note_encryption` in package `zcash_note_encryption v0.4.0 (/home/user/src/gi
thub.com/zcash/librustzcash/components/zcash_note_encryption)`.
Colliding filename is: /home/user/src/github.com/zcash/librustzcash/target/doc/zcash_note_encryption/index.html
```

**Workarounds:**

- To view rendered docs for the local crate run: `cargo doc -p zcash_note_encryption --open`
- To view docs for the released crate, see [docs.rs/zcash_note_encryption](https://docs.rs/zcash_note_encryption/).

## License

All code in this workspace is licensed under either of
Expand Down
9 changes: 9 additions & 0 deletions components/zcash_note_encryption/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ users with their own existing types can similarly implement the trait themselves
[`zcash_primitives`]: https://crates.io/crates/zcash_primitives
[`orchard`]: https://crates.io/crates/orchard

## Cross-Workspace Dependency Cycle

There is a cross-workspace cyclic dependency: `zcash_client_backend` (local)
depends on [`orchard`](/~https://github.com/zcash/orchard) which depends on this crate
`zcash_note_encryption`. For this reason `zcash_client_backend` does not depend on the local
`zcash_note_encryption` crate, but rather the published crate release.
Comment on lines +17 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't cyclic, right? The issue is that zcash_client_backend might depend on a different version of zcash_note_encryption to orchard; not that there is any cycle in the dependency graph (which Rust and cargo do not support).

Suggested change
There is a cross-workspace cyclic dependency: `zcash_client_backend` (local)
depends on [`orchard`](/~https://github.com/zcash/orchard) which depends on this crate
`zcash_note_encryption`. For this reason `zcash_client_backend` does not depend on the local
`zcash_note_encryption` crate, but rather the published crate release.
There is a cross-workspace dependency that requires care with versioning:
`zcash_client_backend` (local) depends on [`orchard`](/~https://github.com/zcash/orchard)
which depends on this crate `zcash_note_encryption`. For this reason `zcash_client_backend`
does not depend on the local `zcash_note_encryption` crate, but rather the published crate
release.


This issue is tracked in [#768](/~https://github.com/zcash/librustzcash/issues/768).

## License

Licensed under either of
Expand Down
1 change: 1 addition & 0 deletions zcash_client_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ development = ["zcash_proofs"]
incrementalmerkletree = { version = "0.4", features = ["legacy-api"] }
zcash_address = { version = "0.3", path = "../components/zcash_address" }
zcash_encoding = { version = "0.2", path = "../components/zcash_encoding" }
# Note: this is not the local workspace crate! See `components/zcash_note_encryption/README.md` for rationale:
zcash_note_encryption = "0.4"
zcash_primitives = { version = "0.12", path = "../zcash_primitives", default-features = false }

Expand Down
1 change: 1 addition & 0 deletions zcash_client_sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ proptest = "1.0.0"
rand_core = "0.6"
regex = "1.4"
tempfile = "3.5.0"
# Note: this is not the local workspace crate! See `components/zcash_note_encryption/README.md` for rationale:
zcash_note_encryption = "0.4"
zcash_proofs = { version = "0.12", path = "../zcash_proofs" }
zcash_primitives = { version = "0.12", path = "../zcash_primitives", features = ["test-dependencies"] }
Expand Down