Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: cimg/rust:1.61.0
- image: cimg/rust:1.65.0
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.61.0
toolchain: 1.65.0
override: true
- name: Run benchmark
run: cargo bench -- --output-format bencher | tee output.txt
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.61.0
toolchain: 1.65.0
override: true
- name: Run tests
uses: actions-rs/cargo@v1
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.61.0
toolchain: 1.65.0
override: true
# Build benchmarks to prevent bitrot
- name: Build benchmarks
Expand All @@ -62,7 +62,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.61.0
toolchain: 1.65.0
override: true
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.61.0
toolchain: 1.65.0
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
Expand All @@ -129,7 +129,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.61.0
toolchain: 1.65.0
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lints-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ on: pull_request

jobs:
clippy:
name: Clippy (1.61.0)
name: Clippy (1.65.0)
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.61.0
toolchain: 1.65.0
components: clippy
override: true
- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
name: Clippy (1.61.0)
name: Clippy (1.65.0)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = [
"Kris Nuttycombe <kris@electriccoin.co>",
]
edition = "2021"
rust-version = "1.61.0"
rust-version = "1.65.0"
description = "The Orchard shielded transaction protocol"
license-file = "LICENSE-BOSL"
repository = "https://github.com/zcash/orchard"
Expand All @@ -25,7 +25,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
[dependencies]
aes = "0.8"
bitvec = "1"
blake2b_simd = "1"
blake2b_simd = "=1.0.1" # Last version required rust 1.66
ff = "0.13"
fpe = "0.6"
group = { version = "0.13", features = ["wnaf-memuse"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# orchard [![Crates.io](https://img.shields.io/crates/v/orchard.svg)](https://crates.io/crates/orchard) [![CI checks](https://github.com/QED-it/orchard/actions/workflows/ci.yml/badge.svg?branch=zsa1)](https://github.com/QED-it/orchard/actions/workflows/ci.yml)
#

Requires Rust 1.61+.
Requires Rust 1.65+.

## Documentation

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.61.0"
channel = "1.65.0"
components = [ "clippy", "rustfmt" ]
8 changes: 5 additions & 3 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,11 @@ impl Builder {
.max()
.cloned()
.unwrap();
(num_actions < MIN_ACTIONS)
.then(|| MIN_ACTIONS - num_actions)
.unwrap_or(0)
if num_actions < MIN_ACTIONS {
MIN_ACTIONS - num_actions
} else {
0
}
}

/// Builds a bundle containing the given spent notes and recipients.
Expand Down
6 changes: 3 additions & 3 deletions src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,9 +1333,9 @@ mod tests {
w.write_all(&<[u8; 32]>::from(instance.rk.clone()))?;
w.write_all(&instance.cmx.to_bytes())?;
w.write_all(&[
if instance.enable_spend { 1 } else { 0 },
if instance.enable_output { 1 } else { 0 },
if instance.enable_zsa { 1 } else { 0 },
u8::from(instance.enable_spend),
u8::from(instance.enable_output),
u8::from(instance.enable_zsa),
])?;

w.write_all(proof.as_ref())?;
Expand Down
4 changes: 2 additions & 2 deletions src/issuance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl IssueAction {
// All assets should be derived correctly
note.asset()
.eq(&issue_asset)
.then(|| ())
.then_some(())
.ok_or(IssueBundleIkMismatchAssetBase)?;

// The total amount should not overflow
Expand All @@ -158,7 +158,7 @@ impl IssueAction {

/// Serialize `finalize` flag to a byte
pub fn flags(&self) -> u8 {
self.finalize.then(|| 0b0000_0001).unwrap_or(0b0000_0000)
u8::from(self.finalize)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will work, but the semantics are incorrect, we should specify the bit strings to clarify the intention.

}
}

Expand Down
2 changes: 1 addition & 1 deletion src/note/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ mod tests {

#[test]
fn test_commit_in_several_steps() {
let mut os_rng = OsRng::default();
let mut os_rng = OsRng;
let msg: Vec<bool> = (0..36).map(|_| os_rng.gen::<bool>()).collect();

let rcm = NoteCommitTrapdoor(pallas::Scalar::random(&mut os_rng));
Expand Down
2 changes: 1 addition & 1 deletion src/note_encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ impl BatchDomain for OrchardDomainV2 {
let (shared_secrets, ephemeral_keys): (Vec<_>, Vec<_>) = items.unzip();

SharedSecret::batch_to_affine(shared_secrets)
.zip(ephemeral_keys.into_iter())
.zip(ephemeral_keys)
.map(|(secret, ephemeral_key)| {
secret.map(|dhsecret| SharedSecret::kdf_orchard_inner(dhsecret, ephemeral_key))
})
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/redpallas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<T: SigType> Eq for VerificationKey<T> {}

impl<T: SigType> PartialOrd for VerificationKey<T> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
<[u8; 32]>::from(self).partial_cmp(&<[u8; 32]>::from(other))
Some(self.cmp(other))
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/supply_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{issuance::Error, note::AssetBase, value::ValueSum};

/// Represents the amount of an asset and its finalization status.
#[derive(Debug, Clone, Copy)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct AssetSupply {
/// The amount of the asset.
pub amount: ValueSum,
Expand Down Expand Up @@ -64,7 +64,7 @@ impl SupplyInfo {
finalization_set.extend(
self.assets
.iter()
.filter_map(|(asset, supply)| supply.is_finalized.then(|| asset)),
.filter_map(|(asset, supply)| supply.is_finalized.then_some(asset)),
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ impl Neg for ValueSum {
}

impl<'a> Sum<&'a ValueSum> for Result<ValueSum, OverflowError> {
fn sum<I: Iterator<Item = &'a ValueSum>>(iter: I) -> Self {
iter.fold(Ok(ValueSum(0)), |acc, v| (acc? + *v).ok_or(OverflowError))
fn sum<I: Iterator<Item = &'a ValueSum>>(mut iter: I) -> Self {
iter.try_fold(ValueSum(0), |acc, v| (acc + *v).ok_or(OverflowError))
}
}

impl Sum<ValueSum> for Result<ValueSum, OverflowError> {
fn sum<I: Iterator<Item = ValueSum>>(iter: I) -> Self {
iter.fold(Ok(ValueSum(0)), |acc, v| (acc? + v).ok_or(OverflowError))
fn sum<I: Iterator<Item = ValueSum>>(mut iter: I) -> Self {
iter.try_fold(ValueSum(0), |acc, v| (acc + v).ok_or(OverflowError))
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/zsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ fn prepare_keys() -> Keychain {

fn sign_issue_bundle(
unauthorized: IssueBundle<Unauthorized>,
mut rng: OsRng,
rng: OsRng,
isk: &IssuanceAuthorizingKey,
) -> IssueBundle<Signed> {
let sighash = unauthorized.commitment().into();
let proven = unauthorized.prepare(sighash);
proven.sign(&mut rng, isk).unwrap()
proven.sign(rng, isk).unwrap()
}

fn build_and_sign_bundle(
Expand All @@ -95,7 +95,7 @@ fn build_and_sign_bundle(
let sighash = unauthorized.commitment().into();
let proven = unauthorized.create_proof(pk, &mut rng).unwrap();
proven
.apply_signatures(&mut rng, sighash, &[SpendAuthorizingKey::from(sk)])
.apply_signatures(rng, sighash, &[SpendAuthorizingKey::from(sk)])
.unwrap()
}

Expand Down Expand Up @@ -203,7 +203,7 @@ fn create_native_note(keys: &Keychain) -> Note {
let unauthorized = builder.build(&mut rng).unwrap();
let sighash = unauthorized.commitment().into();
let proven = unauthorized.create_proof(keys.pk(), &mut rng).unwrap();
proven.apply_signatures(&mut rng, sighash, &[]).unwrap()
proven.apply_signatures(rng, sighash, &[]).unwrap()
};
let ivk = keys.fvk().to_ivk(Scope::External);
let (native_note, _, _) = shielding_bundle
Expand Down