Skip to content

Commit 4b712f7

Browse files
committed
Reintroduce public reexports as deprecated replacement modules & types.
Due to limitations described in rust-lang/rust#30827, we can't just deprecate the `pub use` stanzas; instead, we have to replace reexports with new (deprecated) modules and public types which then internally reexport the module internals or alias the reexported types, respectively.
1 parent f6c0534 commit 4b712f7

File tree

8 files changed

+149
-45
lines changed

8 files changed

+149
-45
lines changed

components/zcash_address/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this library adheres to Rust's notion of
77

88
## [Unreleased]
99

10+
### Deprecated
11+
- `zcash_address::Network` (use `zcash_protocol::consensus::NetworkType` instead).
12+
1013
## [0.6.2] - 2024-12-13
1114
### Fixed
1215
- Migrated to `f4jumble 0.1.1` to fix `no-std` support.

components/zcash_address/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ extern crate alloc;
137137
#[cfg(feature = "std")]
138138
extern crate std;
139139

140-
use alloc::string::String;
141-
142140
mod convert;
143141
mod encoding;
144142
mod kind;
@@ -151,8 +149,14 @@ pub use convert::{
151149
};
152150
pub use encoding::ParseError;
153151
pub use kind::unified;
152+
153+
use alloc::string::String;
154+
154155
use kind::unified::Receiver;
155-
//pub use zcash_protocol::consensus::NetworkType as Network;
156+
157+
#[deprecated(note = "use ::zcash_protocol::consensus::NetworkType instead")]
158+
pub type Network = zcash_protocol::consensus::NetworkType;
159+
156160
use zcash_protocol::{consensus::NetworkType, PoolType};
157161

158162
/// A Zcash address.

zcash_client_backend/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ and this library adheres to Rust's notion of
1010
### Changed
1111
- Migrated to `nonempty 0.11`
1212

13+
### Deprecated
14+
- `zcash_client_backend::address` (use `zcash_keys::address` instead)
15+
- `zcash_client_backend::encoding` (use `zcash_keys::encoding` instead)
16+
- `zcash_client_backend::keys` (use `zcash_keys::keys` instead)
17+
- `zcash_client_backend::zip321` (use the `zip321` crate instead)
18+
- `zcash_client_backend::PoolType` (use `zcash_protocol::PoolType` instead)
19+
- `zcash_client_backend::ShieldedProtocol` (use `zcash_protocol::ShieldedProtocol` instead)
20+
1321
## [0.16.0] - 2024-12-16
1422

1523
### Added

zcash_client_backend/src/lib.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,14 @@
6161
// Temporary until we have addressed all Result<T, ()> cases.
6262
#![allow(clippy::result_unit_err)]
6363

64-
//pub use zcash_keys::address;
6564
pub mod data_api;
6665
mod decrypt;
67-
//pub use zcash_keys::encoding;
6866
pub mod fees;
69-
//pub use zcash_keys::keys;
7067
pub mod proposal;
7168
pub mod proto;
7269
pub mod scan;
7370
pub mod scanning;
7471
pub mod wallet;
75-
//pub use zip321;
7672

7773
#[cfg(feature = "sync")]
7874
pub mod sync;
@@ -84,7 +80,27 @@ pub mod serialization;
8480
pub mod tor;
8581

8682
pub use decrypt::{decrypt_transaction, DecryptedOutput, TransferType};
87-
//pub use zcash_protocol::{PoolType, ShieldedProtocol};
83+
84+
#[deprecated(note = "This module is deprecated; use `::zcash_keys::address` instead.")]
85+
pub mod address {
86+
pub use zcash_keys::address::*;
87+
}
88+
#[deprecated(note = "This module is deprecated; use `::zcash_keys::encoding` instead.")]
89+
pub mod encoding {
90+
pub use zcash_keys::encoding::*;
91+
}
92+
#[deprecated(note = "This module is deprecated; use `::zcash_keys::keys` instead.")]
93+
pub mod keys {
94+
pub use zcash_keys::keys::*;
95+
}
96+
#[deprecated(note = "use ::zcash_protocol::PoolType instead")]
97+
pub type PoolType = zcash_protocol::PoolType;
98+
#[deprecated(note = "use ::zcash_protocol::ShieldedProtocol instead")]
99+
pub type ShieldedProtocol = zcash_protocol::ShieldedProtocol;
100+
#[deprecated(note = "This module is deprecated; use the `zip321` crate instead.")]
101+
pub mod zip321 {
102+
pub use zip321::*;
103+
}
88104

89105
#[cfg(test)]
90106
#[macro_use]

zcash_primitives/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ and this library adheres to Rust's notion of
1010
### Changed
1111
- Migrated to `nonempty 0.11`
1212

13+
### Deprecated
14+
- `zcash_primitives::consensus` (use `zcash_protocol::consensus` instead)
15+
- `zcash_primitives::constants` (use `zcash_protocol::constants` instead)
16+
- `zcash_primitives::memo` (use `zcash_protocol::memo` instead)
17+
- `zcash_primitives::zip32` (use the `zip32` crate instead)
18+
- `zcash_primitives::legacy` (use the `zcash_transparent` crate instead)
19+
- `zcash_primitives::transaction::components::Amount` (use `zcash_protocol::value::ZatBalance` instead)
20+
- `zcash_primitives::transaction::components::amount`:
21+
- `BalanceError` (use `zcash_protocol::value::BalanceError` instead)
22+
- `Amount` (use `zcash_protocol::value::ZatBalance` instead)
23+
- `NonNegativeAmount` (use `zcash_protocol::value::Zatoshis` instead)
24+
- `COIN` (use `zcash_protocol::value::COIN` instead)
25+
- module `testing` (use `zcash_protocol::value::testing` instead)
26+
- `arb_positive_amount` (use `zcash_protocol::value::testing::arb_positive_zat_balance` instead.)
27+
- `arb_amount` (use `zcash_protocol::value::testing::arb_zat_balance` instead.)
28+
- `arb_nonnegative_amount` (use `::zcash_protocol::value::testing::arb_zatoshis` instead.)
29+
30+
### Removed
31+
- `zcash_primitives::transaction::sighash::TransparentAuthorizingContext` was
32+
removed as there is no way to deprecate a previously-reexported trait name.
33+
Use `zcash_transparent::sighash::TransparentAuthorizingContext` instead.
34+
1335
## [0.21.0] - 2024-12-16
1436

1537
### Added

zcash_primitives/src/lib.rs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,33 @@
1818
#![allow(clippy::single_component_path_imports)]
1919

2020
pub mod block;
21-
//pub use zcash_protocol::consensus;
22-
//pub use zcash_protocol::constants;
23-
//pub use zcash_protocol::memo;
24-
pub mod merkle_tree;
25-
pub mod transaction;
26-
//pub use zip32;
2721
#[cfg(zcash_unstable = "zfuture")]
2822
pub mod extensions;
23+
pub mod merkle_tree;
24+
pub mod transaction;
2925

30-
//pub mod legacy {
31-
// pub use transparent::address::*;
32-
// #[cfg(feature = "transparent-inputs")]
33-
// pub use transparent::keys;
34-
//}
26+
#[deprecated(note = "This module is deprecated; use `::zcash_protocol::consensus` instead.")]
27+
pub mod consensus {
28+
pub use zcash_protocol::consensus::*;
29+
}
30+
#[deprecated(note = "This module is deprecated; use `::zcash_protocol::constants` instead.")]
31+
pub mod constants {
32+
pub use zcash_protocol::constants::*;
33+
}
34+
#[deprecated(note = "This module is deprecated; use `::zcash_protocol::memo` instead.")]
35+
pub mod memo {
36+
pub use zcash_protocol::memo::*;
37+
}
38+
#[deprecated(note = "This module is deprecated; use the `zip32` crate instead.")]
39+
pub mod zip32 {
40+
pub use zip32::*;
41+
}
42+
#[deprecated(note = "This module is deprecated; use the `zcash_transparent` crate instead.")]
43+
pub mod legacy {
44+
pub use transparent::address::*;
45+
#[cfg(feature = "transparent-inputs")]
46+
#[deprecated(note = "This module is deprecated; use `::zcash_transparent::keys` instead.")]
47+
pub mod keys {
48+
pub use transparent::keys::*;
49+
}
50+
}

zcash_primitives/src/transaction/components.rs

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,58 @@
11
//! Structs representing the components within Zcash transactions.
2-
//pub mod amount {
3-
// pub use zcash_protocol::value::{
4-
// BalanceError, ZatBalance as Amount, Zatoshis as NonNegativeAmount, COIN,
5-
// };
6-
//
7-
// #[cfg(any(test, feature = "test-dependencies"))]
8-
// pub mod testing {
9-
// pub use zcash_protocol::value::testing::{
10-
// arb_positive_zat_balance as arb_positive_amount, arb_zat_balance as arb_amount,
11-
// arb_zatoshis as arb_nonnegative_amount,
12-
// };
13-
// }
14-
//}
152
pub mod orchard;
163
pub mod sapling;
174
pub mod sprout;
185
#[cfg(zcash_unstable = "zfuture")]
196
pub mod tze;
207

21-
//pub mod transparent {
22-
// pub use transparent::builder;
23-
// pub use transparent::bundle::*;
24-
// pub use transparent::pczt;
25-
//}
26-
27-
pub use self::{
28-
// amount::Amount,
29-
sprout::JsDescription,
30-
// transparent::{OutPoint, TxIn, TxOut},
31-
};
32-
//pub use crate::sapling::bundle::{OutputDescription, SpendDescription};
8+
pub use self::sprout::JsDescription;
9+
10+
#[deprecated(note = "This module is deprecated; use `::zcash_protocol::value` instead.")]
11+
pub mod amount {
12+
#[deprecated(note = "Use `::zcash_protocol::value::BalanceError` instead.")]
13+
pub type BalanceError = zcash_protocol::value::BalanceError;
14+
#[deprecated(note = "Use `::zcash_protocol::value::ZatBalance` instead.")]
15+
pub type Amount = zcash_protocol::value::ZatBalance;
16+
#[deprecated(note = "Use `::zcash_protocol::value::Zatoshis` instead.")]
17+
pub type NonNegativeAmount = zcash_protocol::value::Zatoshis;
18+
#[deprecated(note = "Use `::zcash_protocol::value::COIN` instead.")]
19+
pub const COIN: u64 = zcash_protocol::value::COIN;
20+
21+
#[cfg(any(test, feature = "test-dependencies"))]
22+
#[deprecated(note = "Use `::zcash_protocol::value::testing` instead.")]
23+
pub mod testing {
24+
pub use zcash_protocol::value::testing::arb_positive_zat_balance as arb_positive_amount;
25+
pub use zcash_protocol::value::testing::arb_zat_balance as arb_amount;
26+
pub use zcash_protocol::value::testing::arb_zatoshis as arb_nonnegative_amount;
27+
}
28+
}
29+
30+
#[deprecated(note = "This module is deprecated; use the `zcash_transparent` crate instead.")]
31+
pub mod transparent {
32+
#[deprecated(note = "This module is deprecated; use `::zcash_transparent::builder` instead.")]
33+
pub mod builder {
34+
pub use ::transparent::builder::*;
35+
}
36+
pub use ::transparent::bundle::*;
37+
#[deprecated(note = "This module is deprecated; use `::zcash_transparent::pczt` instead.")]
38+
pub mod pczt {
39+
pub use ::transparent::pczt::*;
40+
}
41+
}
42+
43+
#[deprecated(note = "use `::zcash_transparent::bundle::OutPoint` instead.")]
44+
pub type OutPoint = ::transparent::bundle::OutPoint;
45+
#[deprecated(note = "use `::zcash_transparent::bundle::TxIn` instead.")]
46+
pub type TxIn<A> = ::transparent::bundle::TxIn<A>;
47+
#[deprecated(note = "use `::zcash_transparent::bundle::TxIn` instead.")]
48+
pub type TxOut = ::transparent::bundle::TxOut;
49+
#[deprecated(note = "use `::zcash_protocol::value::ZatBalance` instead.")]
50+
pub type Amount = zcash_protocol::value::ZatBalance;
51+
52+
#[deprecated(note = "Use `::sapling_crypto::bundle::OutputDescription` instead.")]
53+
pub type OutputDescription<A> = ::sapling::bundle::OutputDescription<A>;
54+
#[deprecated(note = "Use `::sapling_crypto::bundle::SpendDescription` instead.")]
55+
pub type SpendDescription<A> = ::sapling::bundle::SpendDescription<A>;
3356

3457
#[cfg(zcash_unstable = "zfuture")]
3558
pub use self::tze::{TzeIn, TzeOut};

zcash_primitives/src/transaction/sighash.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ use ::sapling::{self, bundle::GrothProofBytes};
99
#[cfg(zcash_unstable = "zfuture")]
1010
use {crate::extensions::transparent::Precondition, zcash_protocol::value::Zatoshis};
1111

12-
//pub use transparent::sighash::*;
12+
#[deprecated(note = "use `::zcash_transparent::sighash::SIGHASH_ALL` instead.")]
13+
pub const SIGHASH_ALL: u8 = ::transparent::sighash::SIGHASH_ALL;
14+
#[deprecated(note = "use `::zcash_transparent::sighash::SIGHASH_NONE` instead.")]
15+
pub const SIGHASH_NONE: u8 = ::transparent::sighash::SIGHASH_NONE;
16+
#[deprecated(note = "use `::zcash_transparent::sighash::SIGHASH_SINGLE` instead.")]
17+
pub const SIGHASH_SINGLE: u8 = ::transparent::sighash::SIGHASH_SINGLE;
18+
#[deprecated(note = "use `::zcash_transparent::sighash::SIGHASH_MASK` instead.")]
19+
pub const SIGHASH_MASK: u8 = ::transparent::sighash::SIGHASH_MASK;
20+
#[deprecated(note = "use `::zcash_transparent::sighash::SIGHASH_ANYONECANPAY` instead.")]
21+
pub const SIGHASH_ANYONECANPAY: u8 = ::transparent::sighash::SIGHASH_ANYONECANPAY;
22+
23+
#[deprecated(note = "use `::zcash_transparent::sighash::SighashType` instead.")]
24+
pub type SighashType = ::transparent::sighash::SighashType;
1325

1426
pub enum SignableInput<'a> {
1527
Shielded,

0 commit comments

Comments
 (0)