Deprecate `transaction::components::amount::DEFAULT_FEE` and

`zcash_primitives::transaction::fees::fixed::FeeRule::standard()`.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Emma Hopwood 2023-05-09 16:33:27 +01:00
parent 736d11b45b
commit 3903935234
5 changed files with 28 additions and 4 deletions

View File

@ -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<DbT, ParamsT>(
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,

View File

@ -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

View File

@ -533,6 +533,7 @@ mod testing {
}
pub fn mock_build(self) -> Result<(Transaction, SaplingMetadata), Error<Infallible>> {
#[allow(deprecated)]
self.build(&MockTxProver, &fixed::FeeRule::standard())
}
}

View File

@ -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.

View File

@ -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,