diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e74c5c042..e57db134b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: strategy: matrix: target: - - wasm32-wasi + - wasm32-wasip1 - thumbv7em-none-eabihf steps: - uses: actions/checkout@v4 @@ -70,9 +70,9 @@ jobs: - name: Add lazy_static with the spin_no_std feature working-directory: ./ci-build run: cargo add lazy_static --no-default-features --features "spin_no_std" - - name: Add typenum with the no_std feature + - name: Add typenum with no default features working-directory: ./ci-build - run: cargo add typenum --no-default-features --features "no_std" + run: cargo add typenum --no-default-features - name: Show Cargo.toml for the synthetic crate working-directory: ./ci-build run: cat Cargo.toml diff --git a/.github/workflows/lints-stable.yml b/.github/workflows/lints-stable.yml index 10ff2eb34..c159d8f59 100644 --- a/.github/workflows/lints-stable.yml +++ b/.github/workflows/lints-stable.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: target: - - wasm32-wasi + - wasm32-wasip1 steps: - uses: actions/checkout@v4 with: @@ -47,9 +47,9 @@ jobs: - name: Add lazy_static with the spin_no_std feature working-directory: ./ci-build run: cargo add lazy_static --no-default-features --features "spin_no_std" - - name: Add typenum with the no_std feature + - name: Add typenum with no default features working-directory: ./ci-build - run: cargo add typenum --no-default-features --features "no_std" + run: cargo add typenum --no-default-features - name: Show Cargo.toml for the synthetic crate working-directory: ./ci-build run: cat Cargo.toml diff --git a/CHANGELOG.md b/CHANGELOG.md index 96126a262..128dd63dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to Rust's notion of ## [Unreleased] ### Changed +- MSRV is now 1.85.1 +- Migrated from yanked `core2` library to `corez` - `orchard::pczt::Bundle::extract` now takes its `self` argument by reference instead of by value. diff --git a/Cargo.lock b/Cargo.lock index f63644de0..4a9a14680 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -422,13 +422,10 @@ dependencies = [ ] [[package]] -name = "core2" -version = "0.3.3" +name = "corez" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239fa3ae9b63c2dc74bd3fa852d4792b8b305ae64eeede946265b6af62f1fff3" -dependencies = [ - "memchr", -] +checksum = "4df6f98652d30167eaeea34d77b730e07c8caba6df17bd4551842b9b8da01deb" [[package]] name = "cpp_demangle" @@ -1443,7 +1440,7 @@ dependencies = [ "aes", "bitvec", "blake2b_simd", - "core2", + "corez", "criterion", "ff", "fpe", diff --git a/Cargo.toml b/Cargo.toml index 368e0c9a5..eed13e471 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ authors = [ "Kris Nuttycombe ", ] edition = "2021" -rust-version = "1.70" +rust-version = "1.85.1" description = "The Orchard shielded transaction protocol" license = "MIT OR Apache-2.0" repository = "https://github.com/zcash/orchard" @@ -60,7 +60,7 @@ getset = "0.1" tracing = { version = "0.1", default-features = false } # No-std support -core2 = { version = "0.3", default-features = false, features = ["alloc"] } +corez = { version = "0.1.1", default-features = false, features = ["alloc"] } # Developer tooling dependencies image = { version = "0.24", optional = true } @@ -84,7 +84,7 @@ bench = false [features] default = ["circuit", "multicore", "std"] -std = ["core2/std", "group/wnaf-memuse", "reddsa/std"] +std = ["corez/std", "group/wnaf-memuse", "reddsa/std"] circuit = ["dep:halo2_gadgets", "dep:halo2_proofs", "std"] unstable-frost = [] multicore = ["halo2_proofs?/multicore"] diff --git a/README.md b/README.md index 8fdcd2730..1e0aab030 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,9 @@ Requires Rust 1.70+. ## `no_std` compatibility In order to take advantage of `no_std` builds, downstream users of this crate -must enable: - -* the `spin_no_std` feature of the `lazy_static` crate; and -* the `no_std` feature of the `typenum` crate. - -This is needed because the `--no-default-features` builds of these crates still -rely on `std`. +must enable the `spin_no_std` feature of the `lazy_static` crate. This is +needed because the `--no-default-features` build of `lazy_static` still relies +on `std`. ## License diff --git a/benches/utils.rs b/benches/utils/mod.rs similarity index 100% rename from benches/utils.rs rename to benches/utils/mod.rs diff --git a/rust-toolchain.toml b/rust-toolchain.toml index cad9254a9..0542ef5eb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.70.0" +channel = "1.85.1" components = [ "clippy", "rustfmt" ] diff --git a/src/constants/fixed_bases.rs b/src/constants/fixed_bases.rs index 14b7913ad..de41e4a8f 100644 --- a/src/constants/fixed_bases.rs +++ b/src/constants/fixed_bases.rs @@ -53,12 +53,10 @@ pub const FIXED_BASE_WINDOW_SIZE: usize = 3; pub const H: usize = 1 << FIXED_BASE_WINDOW_SIZE; /// Number of windows for a full-width scalar -pub const NUM_WINDOWS: usize = - (L_ORCHARD_SCALAR + FIXED_BASE_WINDOW_SIZE - 1) / FIXED_BASE_WINDOW_SIZE; +pub const NUM_WINDOWS: usize = L_ORCHARD_SCALAR.div_ceil(FIXED_BASE_WINDOW_SIZE); /// Number of windows for a short signed scalar -pub const NUM_WINDOWS_SHORT: usize = - (L_VALUE + FIXED_BASE_WINDOW_SIZE - 1) / FIXED_BASE_WINDOW_SIZE; +pub const NUM_WINDOWS_SHORT: usize = L_VALUE.div_ceil(FIXED_BASE_WINDOW_SIZE); #[derive(Copy, Clone, Debug, Eq, PartialEq)] // A sum type for both full-width and short bases. This enables us to use the diff --git a/src/issuance.rs b/src/issuance.rs index a87a77836..f7983249b 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -1534,14 +1534,14 @@ mod tests { ); } - #[test] - fn issue_bundle_verify_fail_bad_signature() { - impl IssueBundle { - pub fn set_authorization(&mut self, authorization: Signed) { - self.authorization = authorization; - } + impl IssueBundle { + pub(crate) fn set_authorization(&mut self, authorization: Signed) { + self.authorization = authorization; } + } + #[test] + fn issue_bundle_verify_fail_bad_signature() { let params = setup_params(); let mut rng = OsRng; let (mut signed, _) = new_signed_bundle(¶ms, b"bad sig", 5); diff --git a/src/keys.rs b/src/keys.rs index 9a2f24c77..0236620c4 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -1,7 +1,7 @@ //! Key structures for Orchard. use alloc::vec::Vec; -use core2::io::{self, Read, Write}; +use corez::io::{self, Read, Write}; use ::zip32::ChildIndex; use aes::Aes256; diff --git a/src/note/asset_base.rs b/src/note/asset_base.rs index 0e41d2778..602cced94 100644 --- a/src/note/asset_base.rs +++ b/src/note/asset_base.rs @@ -177,7 +177,7 @@ impl AssetBase { impl Hash for AssetBase { fn hash(&self, h: &mut H) { h.write(&self.to_bytes()); - h.finish(); + let _ = h.finish(); } } diff --git a/tests/zsa.rs b/tests/zsa.rs index 57cccb786..c3da73ecb 100644 --- a/tests/zsa.rs +++ b/tests/zsa.rs @@ -353,7 +353,7 @@ fn zsa_issue_and_transfer() { let zsa_spend1_asset1 = TestSpendInfo { note: zsa_note1_asset1, - merkle_path: merkle_paths.get(0).unwrap().clone(), + merkle_path: merkle_paths.first().unwrap().clone(), }; let zsa_spend2_asset1 = TestSpendInfo { note: zsa_note2_asset1,