From bed5bc6cf6c09b71cc51c6c2e1f9102d0cdd5d50 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 2 Nov 2023 20:54:43 +0000 Subject: [PATCH 1/3] Clean up unreleased changelog entries --- zcash_client_backend/CHANGELOG.md | 97 +++++++++++++++++-------------- zcash_client_sqlite/CHANGELOG.md | 16 ++--- zcash_primitives/CHANGELOG.md | 91 ++++++++++++++--------------- 3 files changed, 103 insertions(+), 101 deletions(-) diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index 147f529aa..55be59da2 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -8,35 +8,24 @@ and this library adheres to Rust's notion of ## [Unreleased] ### Added - -- `zcash_client_backend::data_api::ShieldedProtocol` has a new variant for `Orchard`, - allowing for better reporting to callers trying to perform actions using `Orchard` - before it is fully supported. -- `zcash_client_backend::data_api::error::Error` has new error variant: - - `Error::UnsupportedPoolType(zcash_client_backend::data_api::PoolType)` -- Added module `zcash_client_backend::fees::standard` -- Added `zcash_client_backend::wallet::input_selection::Proposal::min_confirmations` -- Added methods to `zcash_client_backend::wallet::ReceivedSaplingNote`: - `{from_parts, txid, output_index, diversifier, rseed, note_commitment_tree_position}`. +- `zcash_client_backend::fees::standard` +- `zcash_client_backend::wallet`: + - `input_selection::Proposal::min_confirmations` + - `ReceivedSaplingNote::from_parts` + - `ReceivedSaplingNote::{txid, output_index, diversifier, rseed, note_commitment_tree_position}` ### Changed -- `zcash_client_backend::data_api::chain::scan_cached_blocks` now returns - a `ScanSummary` containing metadata about the scanned blocks on success. -- The fields of `zcash_client_backend::wallet::ReceivedSaplingNote` are now - private. Use `ReceivedSaplingNote::from_parts` for construction instead. - Accessor methods are provided for each previously-public field. -- `zcash_client_backend::data_api` changes: - - The `NoteMismatch` variant of `data_api::error::Error` now wraps a - `data_api::NoteId` instead of a backend-specific note identifier. The - related `NoteRef` type parameter has been removed from `data_api::error::Error`. - - `SentTransactionOutput::value` is now represented as `NonNegativeAmount` instead of - `Amount`, and constructors and accessors have been updated accordingly. - - The `available` and `required` fields of `data_api::error::Error::InsufficientFunds` - are now represented as `NonNegativeAmount` instead of `Amount`. - - `data_api::wallet::create_spend_to_address` now takes its `amount` argument as - as `NonNegativeAmount` instead of `Amount`. - - All uses of `Amount` in `data_api::wallet::input_selection` have been replaced - with `NonNegativeAmount`. +- `zcash_client_backend::data_api`: + - `ShieldedProtocol` has a new variant for `Orchard`, allowing for better + reporting to callers trying to perform actions using `Orchard` before it is + fully supported. + - `chain::scan_cached_blocks` now returns a `ScanSummary` containing metadata + about the scanned blocks on success. + - `error::Error` enum changes: + - The `NoteMismatch` variant now wraps a `NoteId` instead of a + backend-specific note identifier. The related `NoteRef` type parameter has + been removed from `error::Error`. + - A new variant `UnsupportedPoolType` has been added. - `wallet::shield_transparent_funds` no longer takes a `memo` argument; instead, memos to be associated with the shielded outputs should be specified in the construction of the value of the @@ -52,22 +41,44 @@ and this library adheres to Rust's notion of argument. Instead, `min_confirmations` is stored in the `Proposal` - `wallet::create_spend_to_address` now takes an additional `change_memo` argument. -- `zcash_client_backend::fees::ChangeValue::Sapling` is now a structured variant. - In addition to the existing change value, it now also carries an optional memo - to be associated with the change output. -- `zcash_client_backend::fees::fixed::SingleOutputChangeStrategy::new` and - `zcash_client_backend::fees::zip317::SingleOutputChangeStrategy::new` each now - accept an additional `change_memo` argument. -- All uses of `Amount` in `zcash_client_backend::fees` have been replaced - with `NonNegativeAmount`. -- `zcash_client_backend::wallet::WalletTransparentOutput::value` is now represented - as `NonNegativeAmount` instead of `Amount`, and constructors and accessors have been - updated accordingly. -- `zcash_client_backend::wallet::ReceivedSaplingNote::value` is now represented - as `NonNegativeAmount` instead of `Amount`, and constructors and accessors have been - updated accordingly. -- Almost all uses of `Amount` in `zcash_client_backend::zip321` have been replaced - with `NonNegativeAmount`. +- `zcash_client_backend::fees`: + - `ChangeValue::Sapling` is now a structured variant. In addition to the + existing change value, it now also carries an optional memo to be associated + with the change output. + - `fixed::SingleOutputChangeStrategy::new` and + `zip317::SingleOutputChangeStrategy::new` each now accept an additional + `change_memo` argument. +- `zcash_client_backend::wallet`: + - The fields of `ReceivedSaplingNote` are now private. Use + `ReceivedSaplingNote::from_parts` for construction instead. Accessor methods + are provided for each previously public field. +- The following fields now have type `NonNegativeAmount` instead of `Amount`: + - `zcash_client_backend::data_api`: + - `error::Error::InsufficientFunds.{available, required}` + - `wallet::input_selection::InputSelectorError::InsufficientFunds.{available, required}` + - `zcash_client_backend::fees`: + - `ChangeValue::Sapling.value` + - `ChangeError::InsufficientFunds.{available, required}` + - `zcash_client_backend::zip321::Payment.amount` +- The following methods now take `NonNegativeAmount` instead of `Amount`: + - `zcash_client_backend::data_api`: + - `SentTransactionOutput::from_parts` + - `wallet::create_spend_to_address` + - `wallet::input_selection::InputSelector::propose_shielding` + - `zcash_client_backend::fees`: + - `ChangeValue::sapling` + - `DustOutputPolicy::new` + - `TransactionBalance::new` + - `zcash_client_backend::wallet::ReceivedSaplingNote::from_parts` +- The following methods now return `NonNegativeAmount` instead of `Amount`: + - `zcash_client_backend::data_api::SentTransactionOutput::value` + - `zcash_client_backend::fees`: + - `ChangeValue::value` + - `DustOutputPolicy::dust_threshold` + - `TransactionBalance::{fee_required, total}` + - `zcash_client_backend::wallet`: + - `ReceivedSaplingNote::value` + - `WalletTransparentOutput::value` ### Removed - `zcash_client_backend::data_api::WalletRead::is_valid_account_extfvk` has been diff --git a/zcash_client_sqlite/CHANGELOG.md b/zcash_client_sqlite/CHANGELOG.md index 80dafe87b..eb577b7c7 100644 --- a/zcash_client_sqlite/CHANGELOG.md +++ b/zcash_client_sqlite/CHANGELOG.md @@ -5,21 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this library adheres to Rust's notion of [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed +- `zcash_client_sqlite::error::SqliteClientError` has new error variant: + - `SqliteClientError::UnsupportedPoolType` + ## [0.8.1] - 2023-10-18 ### Fixed - Fixed a bug in `v_transactions` that was omitting value from identically-valued notes -## [Unreleased] - -### Added -- `zcash_client_sqlite::error::SqliteClientError` has new error variant: - - `SqliteClientError::UnsupportedPoolType(zcash_client_backend::data_api::PoolType)` - -## [0.8.1] - 2023-10-18 - -- Fixed a bug in `v_transactions` that was omitting value from identically-valued notes - ## [0.8.0] - 2023-09-25 ### Notable Changes diff --git a/zcash_primitives/CHANGELOG.md b/zcash_primitives/CHANGELOG.md index c13fd259c..708e2c5c1 100644 --- a/zcash_primitives/CHANGELOG.md +++ b/zcash_primitives/CHANGELOG.md @@ -13,22 +13,24 @@ and this library adheres to Rust's notion of - `constants` module. - `prover::{SpendProver, OutputProver}` - `impl Debug for keys::{ExpandedSpendingKey, ProofGenerationKey}` -- `zcash_primitives::transaction::components::sapling`: - - `Bundle::try_map_authorization` - - `TryMapAuth` - - `impl {MapAuth, TryMapAuth} for (FnMut, FnMut, FnMut, FnMut)` helpers to - enable calling `Bundle::{map_authorization, try_map_authorization}` with a - set of closures. +- `zcash_primitives::transaction`: + - `builder::get_fee` + - `components::sapling`: + - `Bundle::try_map_authorization` + - `TryMapAuth` + - `impl {MapAuth, TryMapAuth} for (FnMut, FnMut, FnMut, FnMut)` helpers to + enable calling `Bundle::{map_authorization, try_map_authorization}` with a + set of closures. + - `fees::StandardFeeRule` + - Constants in `fees::zip317`: + - `MARGINAL_FEE` + - `GRACE_ACTIONS` + - `P2PKH_STANDARD_INPUT_SIZE` + - `P2PKH_STANDARD_OUTPUT_SIZE` - Test helpers, behind the `test-dependencies` feature flag: - `zcash_primitives::prover::mock::{MockSpendProver, MockOutputProver}` -- Constants in `zcash_primitives::transaction::fees::zip317`: - - `MARGINAL_FEE` - - `GRACE_ACTIONS` - - `P2PKH_STANDARD_INPUT_SIZE` - - `P2PKH_STANDARD_OUTPUT_SIZE` -- `zcash_primitives::transaction::builder::get_fee` -- Additions related to `zcash_primitive::components::transaction::Amount` - and `zcash_primitive::components::transaction::NonNegativeAmount` +- Additions related to `zcash_primitive::components::amount::Amount` + and `zcash_primitive::components::amount::NonNegativeAmount`: - `impl TryFrom for u64` - `Amount::const_from_u64` - `NonNegativeAmount::const_from_u64` @@ -39,48 +41,41 @@ and this library adheres to Rust's notion of - `impl From for zcash_primitives::sapling::value::NoteValue` - `impl Sum for Option` - `impl<'a> Sum<&'a NonNegativeAmount> for Option` -- `zcash_primitives::sapling::circuit::ValueCommitmentOpening::value` is - now represented as a `NoteValue` instead of as a bare `u64`. -- `zcash_primitives::sapling::address::PaymentAddress::create_note` now - takes its `value` argument as a `NoteValue` instead of as a bare `u64`. ### Changed -- `zcash_primitives::transaction::fees`: - - `FeeRule::fee_required` now returns the required fee as a `NonNegativeAmount` instead - of as an `Amount`. - - When using the `zfuture` feature flag, `FutureFeeRule::fee_required_zfuture` now returns - the required fee as a `NonNegativeAmount` instead of as an `Amount`. - - `fees::fixed::FeeRule::fixed_fee` now wraps a `NonNegativeAmount` instead of an `Amount` - - `fees::zip317::FeeRule::marginal_fee` is now represented and exposed as a - `NonNegativeAmount` instead of an `Amount` -- `zcash_primitives::transaction::sighash::TransparentAuthorizingContext::input_amounts` now - returns the input values as `NonNegativeAmount` instead of as `Amount` -- `zcash_primitives::transaction::components::sapling`: - - `MapAuth` trait methods now take `&mut self` instead of `&self`. - - `sapling::fees::InputView::value` now returns a `NonNegativeAmount` instead of an `Amount` - - `sapling::fees::OutputView::value` now returns a `NonNegativeAmount` instead of an `Amount` -- `zcash_primitives::transaction::components::transparent`: - - `transparent::TxOut::value` now has type `NonNegativeAmount` instead of `Amount` - - `transparent::builder::TransparentBuilder::add_output` now takes its `value` - parameter as a `NonNegativeAmount` instead of as an `Amount`. - - `transparent::fees::InputView::value` now returns a `NonNegativeAmount` instead of an `Amount` - - `transparent::fees::OutputView::value` now returns a `NonNegativeAmount` instead of an `Amount` -- The following `zcash_primitives::transaction::builder::Builder` methods - have changed to take a `NonNegativeAmount` for their `value` arguments, - instead of an `Amount`. - - `Builder::add_sapling_output` - - `Builder::add_transparent_output` -- `zcash_primitives::transaction::components::amount::testing::arb_nonnegative_amount` - now returns a `NonNegativeAmount` instead of an `Amount` +- `zcash_primitives::sapling`: + - `address::PaymentAddress::create_note` now takes its `value` argument as a + `NoteValue` instead of as a bare `u64`. + - `circuit::ValueCommitmentOpening::value` is now represented as a `NoteValue` + instead of as a bare `u64`. +- `zcash_primitives::transaction`: + - `components::sapling::MapAuth` trait methods now take `&mut self` instead of + `&self`. + - `components::transparent::TxOut.value` now has type `NonNegativeAmount` + instead of `Amount`. + - The following methods now take `NonNegativeAmount` instead of `Amount`: + - `builder::Builder::{add_sapling_output, add_transparent_output}` + - `components::transparent::builder::TransparentBuilder::add_output` + - `fees::fixed::FeeRule::non_standard` + - `fees::zip317::FeeRule::non_standard` + - The following methods now return `NonNegativeAmount` instead of `Amount`: + - `components::amount::testing::arb_nonnegative_amount` + - `components::sapling`: + - `fees::InputView::value` + - `fees::OutputView::value` + - `components::transparent`: + - `fees::InputView::value` + - `fees::OutputView::value` + - `fees::FeeRule::{fee_required, fee_required_zfuture}` + - `fees::fixed::FeeRule::fixed_fee` + - `fees::zip317::FeeRule::marginal_fee` + - `sighash::TransparentAuthorizingContext::input_amounts` ### Removed - `zcash_primitives::constants`: - All `const` values (moved to `zcash_primitives::sapling::constants`). - `impl From for u64` -### Added -- `transaction::fees::StandardFeeRule` - ## [0.13.0] - 2023-09-25 ### Added - `zcash_primitives::consensus::BlockHeight::saturating_sub` From a77b6c631c35c3166f02bcbf69b72e48bae58019 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 3 Nov 2023 00:21:06 +0000 Subject: [PATCH 2/3] Add missing unreleased changelog entries --- zcash_client_backend/CHANGELOG.md | 10 +++++++++ zcash_primitives/CHANGELOG.md | 37 +++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index 55be59da2..d8932ab5d 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -8,6 +8,7 @@ and this library adheres to Rust's notion of ## [Unreleased] ### Added +- `zcash_client_backend::data_api::wallet::propose_standard_transfer_to_address` - `zcash_client_backend::fees::standard` - `zcash_client_backend::wallet`: - `input_selection::Proposal::min_confirmations` @@ -41,6 +42,15 @@ and this library adheres to Rust's notion of argument. Instead, `min_confirmations` is stored in the `Proposal` - `wallet::create_spend_to_address` now takes an additional `change_memo` argument. + - The error type of `wallet::create_spend_to_address` has been changed to use + `zcash_primitives::transaction::fees::zip317::FeeError` instead of + `zcash_primitives::transaction::components::amount::BalanceError`. + - The following methods now take `&impl SpendProver, &impl OutputProver` + instead of `impl TxProver`: + - `wallet::create_proposed_transaction` + - `wallet::create_spend_to_address` + - `wallet::shield_transparent_funds` + - `wallet::spend` - `zcash_client_backend::fees`: - `ChangeValue::Sapling` is now a structured variant. In addition to the existing change value, it now also carries an optional memo to be associated diff --git a/zcash_primitives/CHANGELOG.md b/zcash_primitives/CHANGELOG.md index 708e2c5c1..0b0cb00ab 100644 --- a/zcash_primitives/CHANGELOG.md +++ b/zcash_primitives/CHANGELOG.md @@ -12,10 +12,24 @@ and this library adheres to Rust's notion of - `circuit` module (moved from `zcash_proofs::circuit::sapling`). - `constants` module. - `prover::{SpendProver, OutputProver}` + - `value`: + - `ValueCommitTrapdoor::from_bytes` + - `impl Sub for TrapdoorSum` + - `impl Sub for CommitmentSum` - `impl Debug for keys::{ExpandedSpendingKey, ProofGenerationKey}` - `zcash_primitives::transaction`: - `builder::get_fee` - `components::sapling`: + - `builder::UnauthorizedBundle` + - `builder::InProgress` + - `builder::{InProgressProofs, Unproven, Proven}` + - `builder::{InProgressSignatures, Unsigned, PartiallyAuthorized}` + - `builder::{MaybeSigned, SigningParts}` + - `Bundle::>::create_proofs` + - `Bundle::>::prepare` + - `Bundle::>::{sign, append_signatures}` + - `Bundle::>::finalize` + - `Bundle::>::apply_signatures` - `Bundle::try_map_authorization` - `TryMapAuth` - `impl {MapAuth, TryMapAuth} for (FnMut, FnMut, FnMut, FnMut)` helpers to @@ -49,10 +63,23 @@ and this library adheres to Rust's notion of - `circuit::ValueCommitmentOpening::value` is now represented as a `NoteValue` instead of as a bare `u64`. - `zcash_primitives::transaction`: - - `components::sapling::MapAuth` trait methods now take `&mut self` instead of - `&self`. + - `builder::Builder::{build, build_zfuture}` now take + `&impl SpendProver, &impl OutputProver` instead of `&impl TxProver`. + - `components::sapling`: + - `MapAuth` trait methods now take `&mut self` instead of `&self`. + - `builder::SaplingBuilder::add_spend` now takes `extsk` by reference. + - `builder::SaplingBuilder::build` no longer takes a prover, proving context, + or progress notifier. Instead, it has `SpendProver, OutputProver` generic + parameters and returns `(UnauthorizedBundle, SaplingMetadata)`. The caller + can then use `Bundle::>::create_proofs` to create + spend and output proofs for the bundle. + - `builder::Error` has new error variants: + - `Error::DuplicateSignature` + - `Error::InvalidExternalSignature` + - `Error::MissingSignatures` - `components::transparent::TxOut.value` now has type `NonNegativeAmount` instead of `Amount`. + - `Unauthorized::SaplingAuth` now has type `InProgress`. - The following methods now take `NonNegativeAmount` instead of `Amount`: - `builder::Builder::{add_sapling_output, add_transparent_output}` - `components::transparent::builder::TransparentBuilder::add_output` @@ -74,6 +101,12 @@ and this library adheres to Rust's notion of ### Removed - `zcash_primitives::constants`: - All `const` values (moved to `zcash_primitives::sapling::constants`). +- `zcash_primitives::transaction::components::sapling`: + - `Unproven` + - `builder::Unauthorized` (use `builder::InProgress` instead). + - `SpendDescription::::apply_signature` + - `Bundle::::apply_signatures` (use + `Bundle::>::apply_signatures` instead). - `impl From for u64` ## [0.13.0] - 2023-09-25 From 8e0e77b0a0dbeb4ba77a1a457afbbe9211494f85 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 3 Nov 2023 00:25:27 +0000 Subject: [PATCH 3/3] zcash_client_backend: Remove `fees::ChangeError::map` from the public API It is undocumented, unused outside of this crate, and unreleased, so we make it crate-private for now. --- zcash_client_backend/src/fees.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zcash_client_backend/src/fees.rs b/zcash_client_backend/src/fees.rs index 2f72158d0..7a1568d15 100644 --- a/zcash_client_backend/src/fees.rs +++ b/zcash_client_backend/src/fees.rs @@ -120,7 +120,7 @@ pub enum ChangeError { } impl ChangeError { - pub fn map E0>(self, f: F) -> ChangeError { + pub(crate) fn map E0>(self, f: F) -> ChangeError { match self { ChangeError::InsufficientFunds { available,