Skip to content

Commit

Permalink
Merge pull request #1882 from AleoHQ/update/ci-rust
Browse files Browse the repository at this point in the history
Update CI to 1.71.1
  • Loading branch information
howardwu authored Aug 13, 2023
2 parents 8a36895 + 29c1161 commit f315728
Show file tree
Hide file tree
Showing 42 changed files with 354 additions and 400 deletions.
124 changes: 62 additions & 62 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion circuit/algorithms/src/bhp/hasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<E: Environment, const NUM_WINDOWS: u8, const WINDOW_SIZE: u8> Inject for BH
#[cfg(all(test, console))]
mod tests {
use super::*;
use snarkvm_circuit_types::{environment::Circuit, Eject};
use snarkvm_circuit_types::environment::{Circuit, Eject};

use anyhow::Result;

Expand Down
2 changes: 1 addition & 1 deletion circuit/algorithms/src/bhp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<E: Environment, const NUM_WINDOWS: u8, const WINDOW_SIZE: u8> Inject for BH
#[cfg(all(test, console))]
mod tests {
use super::*;
use snarkvm_circuit_types::{environment::Circuit, Eject};
use snarkvm_circuit_types::environment::{Circuit, Eject};

use anyhow::Result;

Expand Down
5 changes: 1 addition & 4 deletions circuit/algorithms/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use snarkvm_circuit_types::{
environment::{Eject, Inject, ScalarTrait, Ternary, ToBits},
GroupTrait,
};
use snarkvm_circuit_types::environment::{Eject, GroupTrait, Inject, ScalarTrait, Ternary, ToBits};

/// A trait for a commitment scheme.
pub trait Commit {
Expand Down
5 changes: 4 additions & 1 deletion circuit/environment/benches/linear_combination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
#[macro_use]
extern crate criterion;

use snarkvm_circuit::prelude::*;
use snarkvm_circuit::{
environment::{prelude::num_traits::One as _, Circuit, Eject, Environment, Inject, LinearCombination, Mode, One},
types::Field,
};

use criterion::Criterion;

Expand Down
30 changes: 3 additions & 27 deletions circuit/environment/src/helpers/circuit_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,11 @@

use crate::{Eject, Mode};

/// Wrapper struct for circuits whose mode is constant.
#[derive(Debug, Clone)]
pub struct Constant<T: Eject>(T);

impl<T: Eject> Constant<T> {
/// Initializes a new `Constant`. Ensures that `Constant` cannot be initialized if the input circuit is not constant.
pub fn new(circuit: T) -> Self {
assert!(circuit.eject_mode().is_constant());
Self(circuit)
}
}

impl<T: Eject> Eject for Constant<T> {
type Primitive = T::Primitive;

fn eject_mode(&self) -> Mode {
self.0.eject_mode()
}

fn eject_value(&self) -> Self::Primitive {
self.0.eject_value()
}
}

/// Helper enum used in the case where a circuit's output mode or counts are determined by
/// its mode and the actual value of the circuit.
#[derive(Debug, Clone)]
pub enum CircuitType<T: Eject> {
Constant(Constant<T>),
Constant(T),
Public,
Private,
}
Expand All @@ -63,7 +39,7 @@ impl<T: Eject> CircuitType<T> {
impl<T: Eject + Clone> From<T> for CircuitType<T> {
fn from(circuit: T) -> Self {
match circuit.eject_mode() {
Mode::Constant => CircuitType::Constant(Constant(circuit)),
Mode::Constant => CircuitType::Constant(circuit),
Mode::Public => CircuitType::Public,
Mode::Private => CircuitType::Private,
}
Expand All @@ -76,7 +52,7 @@ impl<T: Eject + Clone> From<T> for CircuitType<T> {
impl<T: Eject + Clone> From<&T> for CircuitType<T> {
fn from(circuit: &T) -> Self {
match circuit.eject_mode() {
Mode::Constant => CircuitType::Constant(Constant(circuit.clone())),
Mode::Constant => CircuitType::Constant(circuit.clone()),
Mode::Public => CircuitType::Public,
Mode::Private => CircuitType::Private,
}
Expand Down
10 changes: 6 additions & 4 deletions circuit/environment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ pub mod prelude {
Zero as _,
},
traits::{
integers::{CheckedPow, IntegerProperties, IntegerType, Magnitude, WrappingDiv, WrappingPow, WrappingRem},
string_parser,
types::{
integer_magnitude::Magnitude,
integer_type::{CheckedPow, IntegerProperties, IntegerType, WrappingDiv, WrappingPow, WrappingRem},
},
Double as _,
FromBits as _,
Inverse as _,
Expand All @@ -79,8 +82,7 @@ pub mod prelude {
ParserResult,
TypeName,
};
pub use snarkvm_fields::{Field as _, PrimeField, Zero as _};
pub use snarkvm_utilities::ToBits as _;
pub use snarkvm_fields::{self, Field as _, PrimeField, Zero as _};

#[cfg(debug_assertions)]
pub use snarkvm_curves::AffineCurve as _;
Expand Down Expand Up @@ -120,6 +122,6 @@ pub mod prelude {
multi::{many0, many1},
sequence::{pair, terminated},
};
pub use num_traits::{Inv, One as NumOne, Pow, Unsigned};
pub use num_traits::{self, Inv, One as NumOne, Pow, Unsigned};
pub use once_cell::unsync::OnceCell;
}
6 changes: 3 additions & 3 deletions circuit/environment/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pub mod metrics;
mod metrics;
pub use metrics::*;

pub mod scope;
mod scope;
pub use scope::*;

pub mod witness;
mod witness;
pub use witness::*;
16 changes: 8 additions & 8 deletions circuit/environment/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pub mod eject;
mod eject;
pub use eject::*;

pub mod from;
mod from;
pub use from::*;

pub mod inject;
mod inject;
pub use inject::*;

pub mod metrics;
mod metrics;
pub use metrics::*;

pub mod operators;
mod operators;
pub use operators::*;

pub mod to;
mod to;
pub use to::*;

pub mod to_bits;
mod to_bits;
pub use to_bits::*;

pub mod types;
mod types;
pub use types::*;
1 change: 1 addition & 0 deletions circuit/environment/src/traits/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pub use crate::prelude::num_traits::Pow;
pub use console::traits::{
arithmetic::*,
bitwise::*,
Expand Down
14 changes: 7 additions & 7 deletions circuit/environment/src/traits/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pub mod address;
mod address;
pub use address::*;

pub mod boolean;
mod boolean;
pub use boolean::*;

pub mod field;
mod field;
pub use field::*;

pub mod group;
mod group;
pub use group::*;

pub mod integers;
mod integers;
pub use integers::{IntegerCore, IntegerTrait};

pub mod scalar;
mod scalar;
pub use scalar::*;

pub mod string;
mod string;
pub use string::*;
2 changes: 1 addition & 1 deletion circuit/program/src/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod verify;
use crate::{Identifier, Plaintext, ProgramID, Record, Value};
use snarkvm_circuit_account::Signature;
use snarkvm_circuit_network::Aleo;
use snarkvm_circuit_types::{environment::prelude::*, Address, Boolean, Equal, Field, Group, Scalar, U16};
use snarkvm_circuit_types::{environment::prelude::*, Address, Boolean, Field, Group, Scalar, U16};

pub enum InputID<A: Aleo> {
/// The hash of the constant input.
Expand Down
41 changes: 25 additions & 16 deletions circuit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,37 @@

#![forbid(unsafe_code)]

pub use snarkvm_circuit_account as account;
pub use snarkvm_circuit_account::*;
pub use modules::*;

pub use snarkvm_circuit_algorithms as algorithms;
pub use snarkvm_circuit_algorithms::*;
pub mod modules {
pub use snarkvm_circuit_account as account;
pub use snarkvm_circuit_account::*;

pub use snarkvm_circuit_collections as collections;
pub use snarkvm_circuit_collections::*;
pub use snarkvm_circuit_algorithms as algorithms;
pub use snarkvm_circuit_algorithms::*;

pub use snarkvm_circuit_environment as environment;
pub use snarkvm_circuit_environment::*;
pub use snarkvm_circuit_collections as collections;
pub use snarkvm_circuit_collections::*;

pub use snarkvm_circuit_network as network;
pub use snarkvm_circuit_network::*;
pub use snarkvm_circuit_environment as environment;
pub use snarkvm_circuit_environment::{Assignment, Circuit, Eject, Environment, Inject, Mode};

pub use snarkvm_circuit_program as program;
pub use snarkvm_circuit_program::*;
pub use snarkvm_circuit_network as network;
pub use snarkvm_circuit_network::*;

pub use snarkvm_circuit_types as types;
pub use snarkvm_circuit_types::*;
pub use snarkvm_circuit_program as program;
pub use snarkvm_circuit_program::*;

pub use snarkvm_circuit_types as types;
pub use snarkvm_circuit_types::*;
}

pub mod traits {
pub use snarkvm_circuit_algorithms::traits::*;
pub use snarkvm_circuit_environment::traits::*;
}

pub mod prelude {
pub use super::*;
pub use snarkvm_circuit_environment::*;
pub use crate::modules::*;
pub use snarkvm_circuit_environment::prelude::*;
}
47 changes: 28 additions & 19 deletions circuit/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,34 @@

#![forbid(unsafe_code)]

pub use snarkvm_circuit_environment as environment;
pub use snarkvm_circuit_types_address as address;
pub use snarkvm_circuit_types_boolean as boolean;
pub use snarkvm_circuit_types_field as field;
pub use snarkvm_circuit_types_group as group;
pub use snarkvm_circuit_types_integers as integers;
pub use snarkvm_circuit_types_scalar as scalar;
pub use snarkvm_circuit_types_string as string;

pub use address::Address;
pub use boolean::Boolean;
pub use environment::prelude::*;
pub use field::Field;
pub use group::Group;
pub use integers::{I128, I16, I32, I64, I8, U128, U16, U32, U64, U8};
pub use scalar::Scalar;
pub use string::StringType;
pub use modules::*;

pub mod modules {
pub use snarkvm_circuit_environment as environment;

pub use snarkvm_circuit_types_address as address;
pub use snarkvm_circuit_types_address::Address;

pub use snarkvm_circuit_types_boolean as boolean;
pub use snarkvm_circuit_types_boolean::Boolean;

pub use snarkvm_circuit_types_field as field;
pub use snarkvm_circuit_types_field::Field;

pub use snarkvm_circuit_types_group as group;
pub use snarkvm_circuit_types_group::Group;

pub use snarkvm_circuit_types_integers as integers;
pub use snarkvm_circuit_types_integers::{I128, I16, I32, I64, I8, U128, U16, U32, U64, U8};

pub use snarkvm_circuit_types_scalar as scalar;
pub use snarkvm_circuit_types_scalar::Scalar;

pub use snarkvm_circuit_types_string as string;
pub use snarkvm_circuit_types_string::StringType;
}

pub mod prelude {
pub use super::*;
pub use environment::prelude::*;
pub use crate::modules::*;
pub use snarkvm_circuit_environment::prelude::*;
}
2 changes: 1 addition & 1 deletion console/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

pub use snarkvm_console_types::{environment::prelude::*, Address, Field, Group, Scalar};

pub mod address;
mod address;

#[cfg(feature = "compute_key")]
pub mod compute_key;
Expand Down
10 changes: 4 additions & 6 deletions console/algorithms/src/blake2xs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

///!
///! Blake2Xs function
///!
///! This implementation is based on the BLAKE2Xs specification in Section 2 of
///! <https://www.blake2.net/blake2x.pdf>
///!
/// Blake2Xs function
///
/// This implementation is based on the BLAKE2Xs specification in Section 2 of
/// <https://www.blake2.net/blake2x.pdf>
mod hash_to_curve;

pub struct Blake2Xs;
Expand Down
Loading

1 comment on commit f315728

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'snarkVM Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: f315728 Previous: 8a36895 Ratio
bls12_377: fq_add_assign 44 ns/iter (± 0) 16 ns/iter (± 0) 2.75

This comment was automatically generated by workflow using github-action-benchmark.

CC: @raychu86

Please sign in to comment.