Skip to content

Commit

Permalink
Merge zcash#1524
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Sep 12, 2024
2 parents b9df96e + 04478c7 commit cd3225d
Show file tree
Hide file tree
Showing 27 changed files with 392 additions and 106 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ categories = ["cryptography::cryptocurrencies"]
[workspace.dependencies]
# Intra-workspace dependencies
equihash = { version = "0.2", path = "components/equihash" }
zcash_address = { version = "0.4", path = "components/zcash_address" }
zcash_address = { version = "0.5", path = "components/zcash_address" }
zcash_client_backend = { version = "0.13", path = "zcash_client_backend" }
zcash_encoding = { version = "0.2.1", path = "components/zcash_encoding" }
zcash_keys = { version = "0.3", path = "zcash_keys" }
zcash_protocol = { version = "0.2", path = "components/zcash_protocol" }
zcash_protocol = { version = "0.3", path = "components/zcash_protocol" }
zip321 = { version = "0.1", path = "components/zip321" }

zcash_note_encryption = "0.4"
zcash_primitives = { version = "0.16", path = "zcash_primitives", default-features = false }
zcash_proofs = { version = "0.16", path = "zcash_proofs", default-features = false }
zcash_primitives = { version = "0.17", path = "zcash_primitives", default-features = false }
zcash_proofs = { version = "0.17", path = "zcash_proofs", default-features = false }

# Shielded protocols
bellman = { version = "0.14", default-features = false, features = ["groth16"] }
Expand Down
4 changes: 4 additions & 0 deletions components/zcash_address/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this library adheres to Rust's notion of

## [Unreleased]

## [0.5.0] - 2024-08-26
### Changed
- Updated `zcash_protocol` dependency to version `0.3`

## [0.4.0] - 2024-08-19
### Added
- `zcash_address::ZcashAddress::{can_receive_memo, can_receive_as, matches_receiver}`
Expand Down
2 changes: 1 addition & 1 deletion components/zcash_address/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zcash_address"
description = "Zcash address parsing and serialization"
version = "0.4.0"
version = "0.5.0"
authors = [
"Jack Grigg <jack@electriccoin.co>",
]
Expand Down
18 changes: 18 additions & 0 deletions components/zcash_protocol/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ and this library adheres to Rust's notion of

## [Unreleased]

### Added
- `impl Sub<BlockHeight> for BlockHeight` unlike the implementation that was
removed in version `0.3.0`, a saturating subtraction for block heights having
a return type of `u32` makes sense for `BlockHeight`. Subtracting one block
height from another yields the delta between them.

### Changed
- Adding a delta to a `BlockHeight` now uses saturating addition.
- Subtracting a delta to a `BlockHeight` now uses saturating subtraction.

## [0.3.0] - 2024-08-26
### Changed
- Testnet activation height has been set for `consensus::BranchId::Nu6`.

### Removed
- `impl {Add, Sub} for BlockHeight` - these operations were unused, and it
does not make sense to add block heights (it is not a monoid.)

## [0.2.0] - 2024-08-19
### Added
- `zcash_protocol::PoolType::{TRANSPARENT, SAPLING, ORCHARD}`
Expand Down
2 changes: 1 addition & 1 deletion components/zcash_protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zcash_protocol"
description = "Zcash protocol network constants and value types."
version = "0.2.0"
version = "0.3.0"
authors = [
"Jack Grigg <jack@electriccoin.co>",
"Kris Nuttycombe <kris@nutty.land>",
Expand Down
26 changes: 7 additions & 19 deletions components/zcash_protocol/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,35 +103,23 @@ impl Add<u32> for BlockHeight {
type Output = Self;

fn add(self, other: u32) -> Self {
BlockHeight(self.0 + other)
}
}

impl Add for BlockHeight {
type Output = Self;

fn add(self, other: Self) -> Self {
self + other.0
BlockHeight(self.0.saturating_add(other))
}
}

impl Sub<u32> for BlockHeight {
type Output = Self;

fn sub(self, other: u32) -> Self {
if other > self.0 {
panic!("Subtraction resulted in negative block height.");
}

BlockHeight(self.0 - other)
BlockHeight(self.0.saturating_sub(other))
}
}

impl Sub for BlockHeight {
type Output = Self;
impl Sub<BlockHeight> for BlockHeight {
type Output = u32;

fn sub(self, other: Self) -> Self {
self - other.0
fn sub(self, other: BlockHeight) -> u32 {
self.0.saturating_sub(other.0)
}
}

Expand Down Expand Up @@ -383,7 +371,7 @@ impl Parameters for TestNetwork {
NetworkUpgrade::Heartwood => Some(BlockHeight(903_800)),
NetworkUpgrade::Canopy => Some(BlockHeight(1_028_500)),
NetworkUpgrade::Nu5 => Some(BlockHeight(1_842_420)),
NetworkUpgrade::Nu6 => None,
NetworkUpgrade::Nu6 => Some(BlockHeight(2_976_000)),
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => None,
}
Expand Down
18 changes: 18 additions & 0 deletions supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,12 @@ user-id = 6289 # Jack Grigg (str4d)
start = "2021-03-07"
end = "2025-04-22"

[[trusted.zcash_address]]
criteria = "safe-to-deploy"
user-id = 169181 # Kris Nuttycombe (nuttycom)
start = "2024-08-20"
end = "2025-08-26"

[[trusted.zcash_client_backend]]
criteria = "safe-to-deploy"
user-id = 169181 # Kris Nuttycombe (nuttycom)
Expand Down Expand Up @@ -843,12 +849,24 @@ user-id = 1244 # ebfull
start = "2019-10-08"
end = "2025-04-22"

[[trusted.zcash_primitives]]
criteria = "safe-to-deploy"
user-id = 169181 # Kris Nuttycombe (nuttycom)
start = "2024-08-20"
end = "2025-08-26"

[[trusted.zcash_proofs]]
criteria = ["safe-to-deploy", "crypto-reviewed", "license-reviewed"]
user-id = 6289 # Jack Grigg (str4d)
start = "2021-03-26"
end = "2025-04-22"

[[trusted.zcash_proofs]]
criteria = "safe-to-deploy"
user-id = 169181 # Kris Nuttycombe (nuttycom)
start = "2024-08-20"
end = "2025-08-26"

[[trusted.zcash_protocol]]
criteria = "safe-to-deploy"
user-id = 169181 # Kris Nuttycombe (nuttycom)
Expand Down
38 changes: 19 additions & 19 deletions supply-chain/imports.lock
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ user-login = "str4d"
user-name = "Jack Grigg"

[[publisher.zcash_address]]
version = "0.3.2"
when = "2024-03-06"
user-id = 6289
user-login = "str4d"
user-name = "Jack Grigg"
version = "0.5.0"
when = "2024-08-26"
user-id = 169181
user-login = "nuttycom"
user-name = "Kris Nuttycombe"

[[publisher.zcash_client_backend]]
version = "0.13.0"
Expand All @@ -238,8 +238,8 @@ user-login = "nuttycom"
user-name = "Kris Nuttycombe"

[[publisher.zcash_client_sqlite]]
version = "0.11.0"
when = "2024-08-20"
version = "0.11.2"
when = "2024-09-03"
user-id = 169181
user-login = "nuttycom"
user-name = "Kris Nuttycombe"
Expand Down Expand Up @@ -279,22 +279,22 @@ user-login = "nuttycom"
user-name = "Kris Nuttycombe"

[[publisher.zcash_primitives]]
version = "0.15.1"
when = "2024-05-24"
user-id = 6289
user-login = "str4d"
user-name = "Jack Grigg"
version = "0.17.0"
when = "2024-08-26"
user-id = 169181
user-login = "nuttycom"
user-name = "Kris Nuttycombe"

[[publisher.zcash_proofs]]
version = "0.15.0"
when = "2024-03-25"
user-id = 6289
user-login = "str4d"
user-name = "Jack Grigg"
version = "0.17.0"
when = "2024-08-26"
user-id = 169181
user-login = "nuttycom"
user-name = "Kris Nuttycombe"

[[publisher.zcash_protocol]]
version = "0.2.0"
when = "2024-08-19"
version = "0.3.0"
when = "2024-08-26"
user-id = 169181
user-login = "nuttycom"
user-name = "Kris Nuttycombe"
Expand Down
6 changes: 4 additions & 2 deletions zcash_client_backend/src/fees/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ use super::{
#[cfg(feature = "orchard")]
use super::orchard as orchard_fees;

/// A change strategy that proposes change as a single output to the most current supported
/// shielded pool and delegates fee calculation to the provided fee rule.
/// A change strategy that proposes change as a single output. The output pool is chosen
/// as the most current pool that avoids unnecessary pool-crossing (with a specified
/// fallback when the transaction has no shielded inputs). Fee calculation is delegated
/// to the provided fee rule.
pub struct SingleOutputChangeStrategy {
fee_rule: FixedFeeRule,
change_memo: Option<MemoBytes>,
Expand Down
6 changes: 4 additions & 2 deletions zcash_client_backend/src/fees/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ use super::{
#[cfg(feature = "orchard")]
use super::orchard as orchard_fees;

/// A change strategy that proposes change as a single output to the most current supported
/// shielded pool and delegates fee calculation to the provided fee rule.
/// A change strategy that proposes change as a single output. The output pool is chosen
/// as the most current pool that avoids unnecessary pool-crossing (with a specified
/// fallback when the transaction has no shielded inputs). Fee calculation is delegated
/// to the provided fee rule.
pub struct SingleOutputChangeStrategy {
fee_rule: StandardFeeRule,
change_memo: Option<MemoBytes>,
Expand Down
6 changes: 4 additions & 2 deletions zcash_client_backend/src/fees/zip317.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ use super::{
#[cfg(feature = "orchard")]
use super::orchard as orchard_fees;

/// A change strategy that proposes change as a single output to the most current supported
/// shielded pool and delegates fee calculation to the provided fee rule.
/// A change strategy that proposes change as a single output. The output pool is chosen
/// as the most current pool that avoids unnecessary pool-crossing (with a specified
/// fallback when the transaction has no shielded inputs). Fee calculation is delegated
/// to the provided fee rule.
pub struct SingleOutputChangeStrategy {
fee_rule: Zip317FeeRule,
change_memo: Option<MemoBytes>,
Expand Down
21 changes: 17 additions & 4 deletions zcash_client_sqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this library adheres to Rust's notion of

## [Unreleased]

## [0.11.2] - 2024-08-21

### Changed
- The `v_tx_outputs` view was modified slightly to support older versions of
`sqlite`. Queries to the exposed `v_tx_outputs` and `v_transactions` views
are supported for SQLite versions back to `3.19.x`.
- `zcash_client_sqlite::wallet::init::WalletMigrationError` has an additional
variant, `DatabaseNotSupported`. The `init_wallet_db` function now checks
that the sqlite version in use is compatible with the features required by
the wallet and returns this error if not. SQLite version `3.35` or higher
is required for use with `zcash_client_sqlite`.


## [0.11.1] - 2024-08-21

### Fixed
Expand All @@ -18,7 +31,7 @@ and this library adheres to Rust's notion of
`zcash_client_sqlite` now provides capabilities for the management of ephemeral
transparent addresses in support of the creation of ZIP 320 transaction pairs.

In addition, `zcash_client_sqlite` now provides improved tracking of transparent
In addition, `zcash_client_sqlite` now provides improved tracking of transparent
wallet history in support of the API changes in `zcash_client_backend 0.13`,
and the `v_transactions` view has been modified to provide additional metadata
about the relationship of each transaction to the wallet, in particular whether
Expand Down Expand Up @@ -65,11 +78,11 @@ or not the transaction represents a wallet-internal shielding operation.
## [0.10.1] - 2024-03-25

### Fixed
- The `sent_notes` table's `received_note` constraint was excessively restrictive
after zcash/librustzcash#1306. Any databases that have migrations from
- The `sent_notes` table's `received_note` constraint was excessively restrictive
after zcash/librustzcash#1306. Any databases that have migrations from
zcash_client_sqlite 0.10.0 applied should be wiped and restored from seed.
In order to ensure that the incorrect migration is not used, the migration
id for the `full_account_ids` migration has been changed from
id for the `full_account_ids` migration has been changed from
`0x1b104345_f27e_42da_a9e3_1de22694da43` to `0x6d02ec76_8720_4cc6_b646_c4e2ce69221c`

## [0.10.0] - 2024-03-25
Expand Down
4 changes: 2 additions & 2 deletions zcash_client_sqlite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zcash_client_sqlite"
description = "An SQLite-based Zcash light client"
version = "0.11.1"
version = "0.11.2"
authors = [
"Jack Grigg <jack@z.cash>",
"Kris Nuttycombe <kris@electriccoin.co>"
Expand Down Expand Up @@ -72,6 +72,7 @@ schemer.workspace = true
schemer-rusqlite.workspace = true
time.workspace = true
uuid.workspace = true
regex = "1.4"

# Dependencies used internally:
# (Breaking upgrades to these are usually backwards-compatible, but check MSRVs.)
Expand All @@ -88,7 +89,6 @@ orchard = { workspace = true, features = ["test-dependencies"] }
proptest.workspace = true
rand_chacha.workspace = true
rand_core.workspace = true
regex = "1.4"
tempfile = "3.5.0"
zcash_keys = { workspace = true, features = ["test-dependencies"] }
zcash_note_encryption.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_sqlite/src/wallet/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ SELECT transactions.txid AS txid,
NULL AS to_account_id,
sent_notes.to_address AS to_address,
sent_notes.value AS value,
FALSE AS is_change,
0 AS is_change,
sent_notes.memo AS memo
FROM sent_notes
JOIN transactions
Expand Down
Loading

0 comments on commit cd3225d

Please sign in to comment.