diff --git a/zcash_client_backend/src/data_api/wallet.rs b/zcash_client_backend/src/data_api/wallet.rs index 83c5f82cf..870c5cf84 100644 --- a/zcash_client_backend/src/data_api/wallet.rs +++ b/zcash_client_backend/src/data_api/wallet.rs @@ -184,7 +184,9 @@ where /// [`sapling::TxProver`]: zcash_primitives::sapling::prover::TxProver #[allow(clippy::too_many_arguments)] #[allow(clippy::type_complexity)] -#[deprecated(note = "Use `spend` instead.")] +#[deprecated( + note = "Use `spend` instead. Note that this uses a fixed fee of 10000 zatoshis, which is not compliant with ZIP 317." +)] pub fn create_spend_to_address( wallet_db: &mut DbT, params: &ParamsT, @@ -221,7 +223,9 @@ where "It should not be possible for this to violate ZIP 321 request construction invariants.", ); - let change_strategy = fees::fixed::SingleOutputChangeStrategy::new(fixed::FeeRule::standard()); + #[allow(deprecated)] + let fee_rule = fixed::FeeRule::standard(); + let change_strategy = fees::fixed::SingleOutputChangeStrategy::new(fee_rule); spend( wallet_db, params, diff --git a/zcash_primitives/CHANGELOG.md b/zcash_primitives/CHANGELOG.md index 1a0c0c57b..746de6a4d 100644 --- a/zcash_primitives/CHANGELOG.md +++ b/zcash_primitives/CHANGELOG.md @@ -82,6 +82,14 @@ and this library adheres to Rust's notion of (10000 zatoshis rather than 1000 zatoshis) as the fixed fee. To be compliant with ZIP 317, use `transaction::fees::zip317::FeeRule::standard()` instead. +### Deprecated +- `transaction::components::amount::DEFAULT_FEE` has been deprecated. Depending on + context, you may want to use `transaction::fees::zip317::MINIMUM_FEE`, or calculate + the ZIP 317 conventional fee using `transaction::fees::zip317::FeeRule` instead. +- `transaction::fees::fixed::FeeRule::standard()` has been deprecated. + Use either `transaction::fees::zip317::FeeRule::standard()` or + `transaction::fees::fixed::FeeRule::non_standard`. + ## [0.11.0] - 2023-04-15 ### Added - `zcash_primitives::zip32::fingerprint` module, containing types for deriving diff --git a/zcash_primitives/src/transaction/builder.rs b/zcash_primitives/src/transaction/builder.rs index ecb11d2e2..eb61cdfdc 100644 --- a/zcash_primitives/src/transaction/builder.rs +++ b/zcash_primitives/src/transaction/builder.rs @@ -533,6 +533,7 @@ mod testing { } pub fn mock_build(self) -> Result<(Transaction, SaplingMetadata), Error> { + #[allow(deprecated)] self.build(&MockTxProver, &fixed::FeeRule::standard()) } } diff --git a/zcash_primitives/src/transaction/components/amount.rs b/zcash_primitives/src/transaction/components/amount.rs index fbb77a30a..83b57c38d 100644 --- a/zcash_primitives/src/transaction/components/amount.rs +++ b/zcash_primitives/src/transaction/components/amount.rs @@ -8,6 +8,12 @@ use orchard::value as orchard; pub const COIN: i64 = 1_0000_0000; pub const MAX_MONEY: i64 = 21_000_000 * COIN; +#[deprecated( + since = "0.12.0", + note = "To calculate the ZIP 317 fee, use `transaction::fees::zip317::FeeRule`. +For a constant representing the minimum ZIP 317 fee, use `transaction::fees::zip317::MINIMUM_FEE`. +For the constant amount 1000 zatoshis, use `Amount::const_from_i64(1000)`." +)] pub const DEFAULT_FEE: Amount = Amount(1000); /// A type-safe representation of some quantity of Zcash. diff --git a/zcash_primitives/src/transaction/fees/fixed.rs b/zcash_primitives/src/transaction/fees/fixed.rs index 38e365d17..c3028dcac 100644 --- a/zcash_primitives/src/transaction/fees/fixed.rs +++ b/zcash_primitives/src/transaction/fees/fixed.rs @@ -24,10 +24,15 @@ impl FeeRule { /// i.e. 10000 zatoshis. /// /// Note that using a fixed fee is not compliant with [ZIP 317]; consider - /// using [`zcash_primitives::transaction::fees::zip317::FeeRule`] instead. + /// using [`zcash_primitives::transaction::fees::zip317::FeeRule::standard()`] + /// instead. /// - /// [`zcash_primitives::transaction::fees::zip317::FeeRule`]: crate::transaction::fees::zip317::FeeRule + /// [`zcash_primitives::transaction::fees::zip317::FeeRule::standard()`]: crate::transaction::fees::zip317::FeeRule::standard /// [ZIP 317]: https://zips.z.cash/zip-0317 + #[deprecated( + since = "0.12.0", + note = "To calculate the ZIP 317 fee, use `transaction::fees::zip317::FeeRule::standard()`. For a fixed fee, use the `non_standard` constructor." + )] pub fn standard() -> Self { Self { fixed_fee: zip317::MINIMUM_FEE,