From 9c082dca3e163e41eb7c296e4a48dcd8c3f28a57 Mon Sep 17 00:00:00 2001 From: Daira-Emma Hopwood Date: Fri, 28 Jun 2024 17:55:15 +0100 Subject: [PATCH] `zcash_primitives::transaction::fees::zip317::FeeRule::non_standard` has been deprecated, because in general it can calculate fees that violate ZIP 317, which might cause transactions built with it to fail. Maintaining the generality of the current implementation imposes ongoing maintenance costs, and so it is likely to be removed in the near future. Use `transaction::fees::zip317::FeeRule::standard()` instead to comply with ZIP 317. Signed-off-by: Daira-Emma Hopwood --- zcash_primitives/CHANGELOG.md | 8 ++++++++ zcash_primitives/src/transaction/fees/zip317.rs | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/zcash_primitives/CHANGELOG.md b/zcash_primitives/CHANGELOG.md index 259d50552..6773d516e 100644 --- a/zcash_primitives/CHANGELOG.md +++ b/zcash_primitives/CHANGELOG.md @@ -44,6 +44,14 @@ and this library adheres to Rust's notion of (expressed as iterators of `InputSize` for inputs and `usize` for outputs) rather than a slice of `InputView` or `OutputView`. +### Deprecated +- `zcash_primitives::transaction::fees::zip317::FeeRule::non_standard` has been + deprecated, because in general it can calculate fees that violate ZIP 317, which + might cause transactions built with it to fail. Maintaining the generality of the + current implementation imposes ongoing maintenance costs, and so it is likely to + be removed in the near future. Use `transaction::fees::zip317::FeeRule::standard()` + instead to comply with ZIP 317. + ### Removed - The `zcash_primitives::zip339` module, which reexported parts of the API of the `bip0039` crate, has been removed. Use the `bip0039` crate directly diff --git a/zcash_primitives/src/transaction/fees/zip317.rs b/zcash_primitives/src/transaction/fees/zip317.rs index 1d5d7513a..48457b800 100644 --- a/zcash_primitives/src/transaction/fees/zip317.rs +++ b/zcash_primitives/src/transaction/fees/zip317.rs @@ -78,6 +78,13 @@ impl FeeRule { /// /// Returns `None` if either `p2pkh_standard_input_size` or `p2pkh_standard_output_size` are /// zero. + #[deprecated( + note = "Using this fee rule with `marginal_fee < 5000 || grace_actions < 2 \ + || p2pkh_standard_input_size > P2PKH_STANDARD_INPUT_SIZE \ + || p2pkh_standard_output_size > P2PKH_STANDARD_OUTPUT_SIZE` \ + violates ZIP 317, and might cause transactions built with it to fail. \ + This API is likely to be removed. Use `[FeeRule::standard]` instead." + )] pub fn non_standard( marginal_fee: NonNegativeAmount, grace_actions: usize,