Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RUST MSRV and address clippy issues. #25

Closed
wants to merge 5 commits into from
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
308 changes: 154 additions & 154 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ categories = [
include = [ "Cargo.toml", "vm", "README.md", "LICENSE.md" ]
license = "Apache-2.0"
edition = "2021"
rust-version = "1.76.0"
rust-version = "1.81.0" # Attention - Change the MSRV in rust-toolchain and in .circleci/config.yml as well

[workspace]
members = [
Expand Down
31 changes: 10 additions & 21 deletions algorithms/cuda/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ use std::{env, path::PathBuf};
fn main() {
let curve = "FEATURE_BLS12_377";

// account for cross-compilation [by examining environment variable]
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();

// Set CC environment variable to choose an alternative C compiler.
// Optimization level depends on whether or not --release is passed
// or implied.
Expand All @@ -30,28 +27,22 @@ fn main() {
let files = vec![c_src_dir.join("lib.c")];
let mut cc_opt = None;

match (cfg!(feature = "portable"), cfg!(feature = "force-adx")) {
(true, false) => {
match cfg!(feature = "portable") {
true => {
println!("Compiling in portable mode without ISA extensions");
cc_opt = Some("__BLST_PORTABLE__");
}
(false, true) => {
if target_arch.eq("x86_64") {
println!("Enabling ADX support via `force-adx` feature");
cc_opt = Some("__ADX__");
} else {
println!("`force-adx` is ignored for non-x86_64 targets");
}
}
(false, false) =>
{
false => {
#[cfg(target_arch = "x86_64")]
if target_arch.eq("x86_64") && std::is_x86_feature_detected!("adx") {
println!("Enabling ADX because it was detected on the host");
cc_opt = Some("__ADX__");
{
// account for cross-compilation [by examining environment variable]
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
if target_arch.eq("x86_64") && std::is_x86_feature_detected!("adx") {
println!("Enabling ADX because it was detected on the host");
cc_opt = Some("__ADX__");
}
}
}
(true, true) => panic!("Cannot compile with both `portable` and `force-adx` features"),
}

cc.flag_if_supported("-mno-avx") // avoid costly transitions
Expand Down Expand Up @@ -86,8 +77,6 @@ fn main() {
nvcc.flag("-Xcompiler").flag("-Wno-unused-function");
nvcc.flag("-Xcompiler").flag("-Wno-subobject-linkage");
nvcc.define("TAKE_RESPONSIBILITY_FOR_ERROR_MESSAGE", None);
#[cfg(feature = "cuda-mobile")]
nvcc.define("NTHREADS", "128");
nvcc.define(curve, None);
if let Some(def) = cc_opt {
nvcc.define(def, None);
Expand Down
1 change: 1 addition & 0 deletions algorithms/src/r1cs/test_constraint_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use itertools::Itertools;
/// This field is the scalar field (Fr) of BLS12-377.
pub type Fr = snarkvm_curves::bls12_377::Fr;

#[allow(dead_code)]
#[derive(Debug, Clone)]
enum NamedObject {
Constraint(usize),
Expand Down
1 change: 0 additions & 1 deletion algorithms/src/snark/varuna/ahp/indexer/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use std::collections::BTreeMap;

#[cfg(not(feature = "serial"))]
use rayon::prelude::*;
#[cfg(not(feature = "std"))]
use snarkvm_utilities::println;

use super::Matrix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ use rand::Rng;
use rand_core::CryptoRng;
use std::collections::BTreeMap;

use snarkvm_utilities::cfg_iter;
#[cfg(not(feature = "std"))]
use snarkvm_utilities::println;
use snarkvm_utilities::{cfg_iter, println};

#[cfg(not(feature = "serial"))]
use rayon::prelude::*;
Expand Down
1 change: 0 additions & 1 deletion algorithms/src/snark/varuna/varuna.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ use rand::{CryptoRng, Rng};
use std::{borrow::Borrow, collections::BTreeMap, ops::Deref, sync::Arc};

use crate::srs::UniversalProver;
#[cfg(not(feature = "std"))]
use snarkvm_utilities::println;

/// The Varuna proof system.
Expand Down
12 changes: 6 additions & 6 deletions circuit/account/src/compute_key/equal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use super::*;

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> Equal<Self> for ComputeKey<A> {
type Output = Boolean<A>;

Expand Down Expand Up @@ -67,7 +67,7 @@ impl<A: Aleo> OutputMode<dyn Equal<ComputeKey<A>, Output = Boolean<A>>> for Comp
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::Circuit;
Expand Down Expand Up @@ -98,12 +98,12 @@ mod tests {
console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(),
);

CurrentAleo::scope(&format!("{mode_a} {mode_a} {i}"), || {
CurrentAleo::scope(format!("{mode_a} {mode_a} {i}"), || {
let equals = a.is_equal(&a);
assert!(equals.eject_value());
});

CurrentAleo::scope(&format!("{mode_a} {mode_b} {i}"), || {
CurrentAleo::scope(format!("{mode_a} {mode_b} {i}"), || {
let equals = a.is_equal(&b);
assert!(!equals.eject_value());
assert_scope!(num_constants, num_public, num_private, num_constraints);
Expand Down Expand Up @@ -131,12 +131,12 @@ mod tests {
console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap(),
);

CurrentAleo::scope(&format!("{mode_a} {mode_a} {i}"), || {
CurrentAleo::scope(format!("{mode_a} {mode_a} {i}"), || {
let equals = a.is_not_equal(&a);
assert!(!equals.eject_value());
});

CurrentAleo::scope(&format!("{mode_a} {mode_b} {i}"), || {
CurrentAleo::scope(format!("{mode_a} {mode_b} {i}"), || {
let equals = a.is_not_equal(&b);
assert!(equals.eject_value());
assert_scope!(num_constants, num_public, num_private, num_constraints);
Expand Down
4 changes: 2 additions & 2 deletions circuit/account/src/compute_key/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<A: Aleo> From<(Group<A>, Group<A>)> for ComputeKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::{Circuit, helpers::generate_account};
Expand All @@ -50,7 +50,7 @@ mod tests {
let pk_sig = Group::new(mode, compute_key.pk_sig());
let pr_sig = Group::new(mode, compute_key.pr_sig());

Circuit::scope(&format!("{mode} {i}"), || {
Circuit::scope(format!("{mode} {i}"), || {
let candidate = ComputeKey::<AleoV0>::from((pk_sig, pr_sig));
assert_eq!(compute_key, candidate.eject_value());
if i > 0 {
Expand Down
4 changes: 2 additions & 2 deletions circuit/account/src/compute_key/from_private_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<A: Aleo> ComputeKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::{Circuit, helpers::generate_account};
Expand All @@ -56,7 +56,7 @@ mod tests {
// Initialize the private key.
let private_key = PrivateKey::<Circuit>::new(mode, private_key);

Circuit::scope(&format!("{mode} {i}"), || {
Circuit::scope(format!("{mode} {i}"), || {
let candidate = ComputeKey::from_private_key(&private_key);
assert_eq!(compute_key, candidate.eject_value());
// TODO (howardwu): Resolve skipping the cost count checks for the burn-in round.
Expand Down
8 changes: 4 additions & 4 deletions circuit/account/src/compute_key/helpers/from_bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use super::*;

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> FromBits for ComputeKey<A> {
type Boolean = Boolean<A>;

Expand Down Expand Up @@ -54,7 +54,7 @@ impl<A: Aleo> FromBits for ComputeKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::Circuit;
Expand All @@ -73,7 +73,7 @@ mod tests {
let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap();
let candidate = ComputeKey::<CurrentAleo>::new(mode, expected).to_bits_le();

CurrentAleo::scope(&format!("{mode} {i}"), || {
CurrentAleo::scope(format!("{mode} {i}"), || {
let candidate = ComputeKey::<CurrentAleo>::from_bits_le(&candidate);
assert_eq!(expected, candidate.eject_value());
assert_scope!(num_constants, num_public, num_private, num_constraints);
Expand All @@ -90,7 +90,7 @@ mod tests {
let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap();
let candidate = ComputeKey::<CurrentAleo>::new(mode, expected).to_bits_be();

CurrentAleo::scope(&format!("{mode} {i}"), || {
CurrentAleo::scope(format!("{mode} {i}"), || {
let candidate = ComputeKey::<CurrentAleo>::from_bits_be(&candidate);
assert_eq!(expected, candidate.eject_value());
assert_scope!(num_constants, num_public, num_private, num_constraints);
Expand Down
10 changes: 5 additions & 5 deletions circuit/account/src/compute_key/helpers/to_bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use super::*;

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> ToBits for ComputeKey<A> {
type Boolean = Boolean<A>;

Expand All @@ -30,7 +30,7 @@ impl<A: Aleo> ToBits for ComputeKey<A> {
}
}

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> ToBits for &ComputeKey<A> {
type Boolean = Boolean<A>;

Expand All @@ -51,7 +51,7 @@ impl<A: Aleo> ToBits for &ComputeKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::Circuit;
Expand All @@ -72,7 +72,7 @@ mod tests {
let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap();
let candidate = ComputeKey::<CurrentAleo>::new(mode, expected);

CurrentAleo::scope(&format!("{mode} {i}"), || {
CurrentAleo::scope(format!("{mode} {i}"), || {
let candidate = candidate.to_bits_le();
assert_eq!(expected_number_of_bits, candidate.len());

Expand All @@ -99,7 +99,7 @@ mod tests {
let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap();
let candidate = ComputeKey::<CurrentAleo>::new(mode, expected);

CurrentAleo::scope(&format!("{mode} {i}"), || {
CurrentAleo::scope(format!("{mode} {i}"), || {
let candidate = candidate.to_bits_be();
assert_eq!(expected_number_of_bits, candidate.len());

Expand Down
4 changes: 2 additions & 2 deletions circuit/account/src/compute_key/helpers/to_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<A: Aleo> ToFields for ComputeKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::Circuit;
Expand All @@ -45,7 +45,7 @@ mod tests {
let expected = console::ComputeKey::try_from(console::PrivateKey::new(rng).unwrap()).unwrap();
let candidate = ComputeKey::<CurrentAleo>::new(mode, expected);

CurrentAleo::scope(&format!("{mode} {i}"), || {
CurrentAleo::scope(format!("{mode} {i}"), || {
let candidate = candidate.to_fields();
assert_eq!(candidate.len(), 2);

Expand Down
6 changes: 3 additions & 3 deletions circuit/account/src/compute_key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct ComputeKey<A: Aleo> {
sk_prf: Scalar<A>,
}

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> Inject for ComputeKey<A> {
type Primitive = console::ComputeKey<A::Network>;

Expand Down Expand Up @@ -69,7 +69,7 @@ impl<A: Aleo> ComputeKey<A> {
}
}

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> Eject for ComputeKey<A> {
type Primitive = console::ComputeKey<A::Network>;

Expand All @@ -87,7 +87,7 @@ impl<A: Aleo> Eject for ComputeKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
pub(crate) mod tests {
use super::*;
use crate::{Circuit, helpers::generate_account};
Expand Down
2 changes: 1 addition & 1 deletion circuit/account/src/compute_key/ternary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<A: Aleo> OutputMode<dyn Ternary<Boolean = Boolean<A>, Output = Self>> for C
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::Circuit;
Expand Down
4 changes: 2 additions & 2 deletions circuit/account/src/compute_key/to_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<A: Aleo> ComputeKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
mod tests {
use super::*;
use crate::{Circuit, helpers::generate_account};
Expand All @@ -48,7 +48,7 @@ mod tests {
// Initialize the compute key.
let candidate = ComputeKey::<Circuit>::new(mode, compute_key);

Circuit::scope(&format!("{mode} {i}"), || {
Circuit::scope(format!("{mode} {i}"), || {
let candidate = candidate.to_address();
assert_eq!(*address, candidate.to_group().eject_value());
// TODO (howardwu): Resolve skipping the cost count checks for the burn-in round.
Expand Down
6 changes: 3 additions & 3 deletions circuit/account/src/graph_key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct GraphKey<A: Aleo> {
sk_tag: Field<A>,
}

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> Inject for GraphKey<A> {
type Primitive = console::GraphKey<A::Network>;

Expand All @@ -44,7 +44,7 @@ impl<A: Aleo> GraphKey<A> {
}
}

#[cfg(console)]
#[cfg(feature = "console")]
impl<A: Aleo> Eject for GraphKey<A> {
type Primitive = console::GraphKey<A::Network>;

Expand All @@ -62,7 +62,7 @@ impl<A: Aleo> Eject for GraphKey<A> {
}
}

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
pub(crate) mod tests {
use super::*;
use crate::{Circuit, helpers::generate_account};
Expand Down
2 changes: 1 addition & 1 deletion circuit/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub use signature::*;
pub mod view_key;
pub use view_key::*;

#[cfg(all(test, console))]
#[cfg(all(test, feature = "console"))]
pub(crate) mod helpers {
use snarkvm_circuit_network::AleoV0;
use snarkvm_circuit_types::environment::Environment;
Expand Down
Loading