Skip to content

Commit

Permalink
Merge pull request #1582 from zcash/msrv-1.77
Browse files Browse the repository at this point in the history
Bump MSRV to 1.77
  • Loading branch information
nuttycom authored Oct 23, 2024
2 parents bf8b39a + 9bf153d commit 791b371
Show file tree
Hide file tree
Showing 36 changed files with 479 additions and 454 deletions.
357 changes: 189 additions & 168 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ members = [

[workspace.package]
edition = "2021"
rust-version = "1.70"
rust-version = "1.77"
repository = "https://github.com/zcash/librustzcash"
license = "MIT OR Apache-2.0"
categories = ["cryptography::cryptocurrencies"]
Expand Down Expand Up @@ -123,9 +123,9 @@ subtle = "2.2.3"
# - Warning: One of the downstream consumers requires that SQLite be available through
# CocoaPods, due to being bound to React Native. We need to ensure that the SQLite
# version required for `rusqlite` is a version that is available through CocoaPods.
rusqlite = { version = "0.31", features = ["bundled"] }
rusqlite = { version = "0.32", features = ["bundled"] }
schemerz = "0.2"
schemerz-rusqlite = "0.310"
schemerz-rusqlite = "0.320"
time = "0.3.22"
uuid = "1.1"

Expand All @@ -145,9 +145,9 @@ incrementalmerkletree-testing = "0.2"
# Tor
# - `arti-client` depends on `rusqlite`, and a version mismatch there causes a compilation
# failure due to incompatible `libsqlite3-sys` versions.
arti-client = { version = "0.22", default-features = false, features = ["compression", "rustls", "tokio"] }
arti-client = { version = "0.23", default-features = false, features = ["compression", "rustls", "tokio"] }
tokio = "1"
tor-rtcompat = "0.22"
tor-rtcompat = "0.23"
tower = "0.4"

# ZIP 32
Expand Down
2 changes: 1 addition & 1 deletion components/zcash_address/src/kind/unified/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ mod tests {
#[test]
fn only_transparent() {
// Encoding of `Address(vec![Receiver::P2pkh([0; 20])])`.
let encoded = vec![
let encoded = [
0xf0, 0x9e, 0x9d, 0x6e, 0xf5, 0xa6, 0xac, 0x16, 0x50, 0xf0, 0xdb, 0xe1, 0x2c, 0xa5,
0x36, 0x22, 0xa2, 0x04, 0x89, 0x86, 0xe9, 0x6a, 0x9b, 0xf3, 0xff, 0x6d, 0x2f, 0xe6,
0xea, 0xdb, 0xc5, 0x20, 0x62, 0xf9, 0x6f, 0xa9, 0x86, 0xcc,
Expand Down
8 changes: 4 additions & 4 deletions components/zcash_address/src/kind/unified/fvk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ mod tests {
// The test cases below use `Ufvk(vec![Fvk::Orchard([1; 96])])` as base.

// Invalid padding ([0xff; 16] instead of [b'u', 0x00, 0x00, 0x00...])
let invalid_padding = vec![
let invalid_padding = [
0x6b, 0x32, 0x44, 0xf1, 0xb, 0x67, 0xe9, 0x8f, 0x6, 0x57, 0xe3, 0x5, 0x17, 0xa0, 0x7,
0x5c, 0xb0, 0xc9, 0x23, 0xcc, 0xb7, 0x54, 0xac, 0x55, 0x6a, 0x65, 0x99, 0x95, 0x32,
0x97, 0xd5, 0x34, 0xa7, 0xc8, 0x6f, 0xc, 0xd7, 0x3b, 0xe0, 0x88, 0x19, 0xf3, 0x3e,
Expand All @@ -252,7 +252,7 @@ mod tests {
);

// Short padding (padded to 15 bytes instead of 16)
let truncated_padding = vec![
let truncated_padding = [
0xdf, 0xea, 0x84, 0x55, 0xc3, 0x4a, 0x7c, 0x6e, 0x9f, 0x83, 0x3, 0x21, 0x14, 0xb0,
0xcf, 0xb0, 0x60, 0x84, 0x75, 0x3a, 0xdc, 0xb9, 0x93, 0x16, 0xc0, 0x8f, 0x28, 0x5f,
0x61, 0x5e, 0xf0, 0x8e, 0x44, 0xae, 0xa6, 0x74, 0xc5, 0x64, 0xad, 0xfa, 0xdc, 0x7d,
Expand Down Expand Up @@ -300,7 +300,7 @@ mod tests {
);

// - Truncated after the typecode of the Sapling fvk.
let truncated_after_sapling_typecode = vec![
let truncated_after_sapling_typecode = [
0xac, 0x26, 0x5b, 0x19, 0x8f, 0x88, 0xb0, 0x7, 0xb3, 0x0, 0x91, 0x19, 0x52, 0xe1, 0x73,
0x48, 0xff, 0x66, 0x7a, 0xef, 0xcf, 0x57, 0x9c, 0x65, 0xe4, 0x6a, 0x7a, 0x1d, 0x19,
0x75, 0x6b, 0x43, 0xdd, 0xcf, 0xb9, 0x9a, 0xf3, 0x7a, 0xf8, 0xb, 0x23, 0x96, 0x64,
Expand Down Expand Up @@ -330,7 +330,7 @@ mod tests {
#[test]
fn only_transparent() {
// Raw encoding of `Ufvk(vec![Fvk::P2pkh([0; 65])])`.
let encoded = vec![
let encoded = [
0xc4, 0x70, 0xc8, 0x7a, 0xcc, 0xe6, 0x6b, 0x1a, 0x62, 0xc7, 0xcd, 0x5f, 0x76, 0xd8,
0xcc, 0x9c, 0x50, 0xbd, 0xce, 0x85, 0x80, 0xd7, 0x78, 0x25, 0x3e, 0x47, 0x9, 0x57,
0x7d, 0x6a, 0xdb, 0x10, 0xb4, 0x11, 0x80, 0x13, 0x4c, 0x83, 0x76, 0xb4, 0x6b, 0xbd,
Expand Down
10 changes: 5 additions & 5 deletions components/zcash_address/src/kind/unified/ivk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ mod tests {
// The test cases below use `Uivk(vec![Ivk::Orchard([1; 64])])` as base.

// Invalid padding ([0xff; 16] instead of [b'u', 0x00, 0x00, 0x00...])
let invalid_padding = vec![
let invalid_padding = [
0xba, 0xbc, 0xc0, 0x71, 0xcd, 0x3b, 0xfd, 0x9a, 0x32, 0x19, 0x7e, 0xeb, 0x8a, 0xa7,
0x6e, 0xd4, 0xac, 0xcb, 0x59, 0xc2, 0x54, 0x26, 0xc6, 0xab, 0x71, 0xc7, 0xc3, 0x72,
0xc, 0xa9, 0xad, 0xa4, 0xad, 0x8c, 0x9e, 0x35, 0x7b, 0x4c, 0x5d, 0xc7, 0x66, 0x12,
Expand All @@ -243,7 +243,7 @@ mod tests {
);

// Short padding (padded to 15 bytes instead of 16)
let truncated_padding = vec![
let truncated_padding = [
0x96, 0x73, 0x6a, 0x56, 0xbc, 0x44, 0x38, 0xe2, 0x47, 0x41, 0x1c, 0x70, 0xe4, 0x6,
0x87, 0xbe, 0xb6, 0x90, 0xbd, 0xab, 0x1b, 0xd8, 0x27, 0x10, 0x0, 0x21, 0x30, 0x2, 0x77,
0x87, 0x0, 0x25, 0x96, 0x94, 0x8f, 0x1e, 0x39, 0xd2, 0xd8, 0x65, 0xb4, 0x3c, 0x72,
Expand All @@ -266,7 +266,7 @@ mod tests {
// with the ivk data truncated, but valid padding.

// - Missing the last data byte of the Sapling ivk.
let truncated_sapling_data = vec![
let truncated_sapling_data = [
0xce, 0xbc, 0xfe, 0xc5, 0xef, 0x2d, 0xe, 0x66, 0xc2, 0x8c, 0x34, 0xdc, 0x2e, 0x24,
0xd2, 0xc7, 0x4b, 0xac, 0x36, 0xe0, 0x43, 0x72, 0xa7, 0x33, 0xa4, 0xe, 0xe0, 0x52,
0x15, 0x64, 0x66, 0x92, 0x36, 0xa7, 0x60, 0x8e, 0x48, 0xe8, 0xb0, 0x30, 0x4d, 0xcb,
Expand All @@ -285,7 +285,7 @@ mod tests {
);

// - Truncated after the typecode of the Sapling ivk.
let truncated_after_sapling_typecode = vec![
let truncated_after_sapling_typecode = [
0xf7, 0x3, 0xd8, 0xbe, 0x6a, 0x27, 0xfa, 0xa1, 0xd3, 0x11, 0xea, 0x25, 0x94, 0xe2, 0xb,
0xde, 0xed, 0x6a, 0xaa, 0x8, 0x46, 0x7d, 0xe4, 0xb1, 0xe, 0xf1, 0xde, 0x61, 0xd7, 0x95,
0xf7, 0x82, 0x62, 0x32, 0x7a, 0x73, 0x8c, 0x55, 0x93, 0xa1, 0x63, 0x75, 0xe2, 0xca,
Expand All @@ -312,7 +312,7 @@ mod tests {
#[test]
fn only_transparent() {
// Raw Encoding of `Uivk(vec![Ivk::P2pkh([0; 65])])`.
let encoded = vec![
let encoded = [
0x12, 0x51, 0x37, 0xc7, 0xac, 0x8c, 0xd, 0x13, 0x3a, 0x5f, 0xc6, 0x84, 0x53, 0x90,
0xf8, 0xe7, 0x23, 0x34, 0xfb, 0xda, 0x49, 0x3c, 0x87, 0x1c, 0x8f, 0x1a, 0xe1, 0x63,
0xba, 0xdf, 0x77, 0x64, 0x43, 0xcf, 0xdc, 0x37, 0x1f, 0xd2, 0x89, 0x60, 0xe3, 0x77,
Expand Down
3 changes: 3 additions & 0 deletions components/zcash_protocol/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this library adheres to Rust's notion of

## [Unreleased]

### Changed
- MSRV is now 1.77.0.

## [0.4.0] - 2024-10-02
### Added
- `impl Sub<BlockHeight> for BlockHeight` unlike the implementation that was
Expand Down
16 changes: 8 additions & 8 deletions components/zcash_protocol/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ impl Sub<ZatBalance> for Option<ZatBalance> {
}

impl Sum<ZatBalance> for Option<ZatBalance> {
fn sum<I: Iterator<Item = ZatBalance>>(iter: I) -> Self {
iter.fold(Some(ZatBalance::zero()), |acc, a| acc? + a)
fn sum<I: Iterator<Item = ZatBalance>>(mut iter: I) -> Self {
iter.try_fold(ZatBalance::zero(), |acc, a| acc + a)
}
}

impl<'a> Sum<&'a ZatBalance> for Option<ZatBalance> {
fn sum<I: Iterator<Item = &'a ZatBalance>>(iter: I) -> Self {
iter.fold(Some(ZatBalance::zero()), |acc, a| acc? + *a)
fn sum<I: Iterator<Item = &'a ZatBalance>>(mut iter: I) -> Self {
iter.try_fold(ZatBalance::zero(), |acc, a| acc + *a)
}
}

Expand Down Expand Up @@ -375,14 +375,14 @@ impl Mul<usize> for Zatoshis {
}

impl Sum<Zatoshis> for Option<Zatoshis> {
fn sum<I: Iterator<Item = Zatoshis>>(iter: I) -> Self {
iter.fold(Some(Zatoshis::ZERO), |acc, a| acc? + a)
fn sum<I: Iterator<Item = Zatoshis>>(mut iter: I) -> Self {
iter.try_fold(Zatoshis::ZERO, |acc, a| acc + a)
}
}

impl<'a> Sum<&'a Zatoshis> for Option<Zatoshis> {
fn sum<I: Iterator<Item = &'a Zatoshis>>(iter: I) -> Self {
iter.fold(Some(Zatoshis::ZERO), |acc, a| acc? + *a)
fn sum<I: Iterator<Item = &'a Zatoshis>>(mut iter: I) -> Self {
iter.try_fold(Zatoshis::ZERO, |acc, a| acc + *a)
}
}

Expand Down
3 changes: 3 additions & 0 deletions components/zip321/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this library adheres to Rust's notion of

## [Unreleased]

### Changed
- MSRV is now 1.77.0.

## [0.2.0] 2024-10-04

### Changed
Expand Down
4 changes: 2 additions & 2 deletions components/zip321/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ impl TransactionRequest {
self.payments
.values()
.map(|p| p.amount)
.fold(Ok(Zatoshis::ZERO), |acc, a| {
(acc? + a).ok_or(BalanceError::Overflow)
.try_fold(Zatoshis::ZERO, |acc, a| {
(acc + a).ok_or(BalanceError::Overflow)
})
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.70.0"
channel = "1.77.0"
components = [ "clippy", "rustfmt" ]
15 changes: 15 additions & 0 deletions supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@ criteria = "safe-to-deploy"
delta = "0.14.2 -> 0.14.5"
notes = "I did not thoroughly check the safety argument for fold_impl, but it at least seems to be well documented."

[[audits.home]]
who = "Jack Grigg <[email protected]>"
criteria = "safe-to-deploy"
delta = "0.5.5 -> 0.5.9"
notes = """
`unsafe` changes are to switch Windows logic from `SHGetFolderPathW` to
`SHGetKnownFolderPath`. I checked that the parameters and return values were
being handled correctly per the Windows documentation.
"""

[[audits.http-body]]
who = "Jack Grigg <[email protected]>"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -572,6 +582,11 @@ criteria = "safe-to-deploy"
delta = "0.25.2 -> 0.25.4"
notes = "I have not checked consistency with the Mozilla IncludedCACertificateReportPEMCSV report."

[[audits.which]]
who = "Jack Grigg <[email protected]>"
criteria = "safe-to-deploy"
delta = "6.0.1 -> 6.0.3"

[[audits.winapi-util]]
who = "Daira-Emma Hopwood <[email protected]>"
criteria = "safe-to-run"
Expand Down
Loading

0 comments on commit 791b371

Please sign in to comment.