diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f68372..c35100f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,6 +79,11 @@ jobs: check_no_std: name: Check no_std runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - nightly steps: - name: Checkout uses: actions/checkout@v2 diff --git a/Cargo.toml b/Cargo.toml index 3905c32..4c9fd88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ authors = ["arkworks contributors"] edition = "2021" [dependencies] -ark-crypto-primitives = { version="^0.4.0", features = ["merkle_tree", "sponge"] } +ark-crypto-primitives = { default-features = false, features = ["merkle_tree", "sponge"], version="^0.4.0" } ark-ff = { version = "0.4" } ark-poly = { version = "0.4.2" } ark-std = { version="^0.4.0" } @@ -13,11 +13,11 @@ ark-serialize = { version = "0.4" } ark-test-curves = { version = "0.4", features = [ "bls12_381_curve" ] } blake2 = { version = "0.10" } blake3 = { version = "1.5.0" } +itertools = "0.13.0" lazy_static = { version = "1.4" } poseidon-paramgen = { version = "0.4" } rand = { version = "0.8" } sha3 = { version = "0.10" } -itertools = "0.13.0" [patch.crates-io] ark-crypto-primitives = { git= "https://github.com/arkworks-rs/crypto-primitives" } diff --git a/src/crypto/fs/blake3.rs b/src/crypto/fs/blake3.rs index a6df98a..04dca57 100644 --- a/src/crypto/fs/blake3.rs +++ b/src/crypto/fs/blake3.rs @@ -1,4 +1,5 @@ use ark_crypto_primitives::sponge::{Absorb, CryptographicSponge}; +use ark_std::{vec, vec::Vec}; use blake3::Hasher; #[derive(Default, Clone, Copy)] diff --git a/src/crypto/merkle_tree/blake2.rs b/src/crypto/merkle_tree/blake2.rs index 8595b26..95dad56 100644 --- a/src/crypto/merkle_tree/blake2.rs +++ b/src/crypto/merkle_tree/blake2.rs @@ -1,4 +1,8 @@ -use std::{borrow::Borrow, marker::PhantomData}; +use ark_std::{ + borrow::Borrow, + marker::PhantomData, + {vec, vec::Vec}, +}; use ark_crypto_primitives::{ crh::{CRHScheme, TwoToOneCRHScheme}, diff --git a/src/crypto/merkle_tree/blake3.rs b/src/crypto/merkle_tree/blake3.rs index 709df9b..3ab9893 100644 --- a/src/crypto/merkle_tree/blake3.rs +++ b/src/crypto/merkle_tree/blake3.rs @@ -1,4 +1,8 @@ -use std::{borrow::Borrow, marker::PhantomData}; +use ark_std::{ + borrow::Borrow, + marker::PhantomData, + {vec, vec::Vec}, +}; use super::HashCounter; use ark_crypto_primitives::{ diff --git a/src/crypto/merkle_tree/mock.rs b/src/crypto/merkle_tree/mock.rs index 2f879ab..7069c38 100644 --- a/src/crypto/merkle_tree/mock.rs +++ b/src/crypto/merkle_tree/mock.rs @@ -1,4 +1,8 @@ -use std::{borrow::Borrow, marker::PhantomData}; +use ark_std::{ + borrow::Borrow, + marker::PhantomData, + {vec, vec::Vec}, +}; use ark_crypto_primitives::{ crh::{CRHScheme, TwoToOneCRHScheme}, diff --git a/src/crypto/merkle_tree/mod.rs b/src/crypto/merkle_tree/mod.rs index 915c86d..2808b14 100644 --- a/src/crypto/merkle_tree/mod.rs +++ b/src/crypto/merkle_tree/mod.rs @@ -4,7 +4,12 @@ pub mod mock; pub mod poseidon; pub mod sha3; -use std::{borrow::Borrow, marker::PhantomData, sync::atomic::AtomicUsize}; +use ark_std::{ + borrow::Borrow, + marker::PhantomData, + sync::atomic::AtomicUsize, + {vec, vec::Vec}, +}; use ark_crypto_primitives::crh::CRHScheme; use ark_serialize::CanonicalSerialize; @@ -24,19 +29,19 @@ impl HashCounter { pub(crate) fn add() -> usize { HASH_COUNTER .counter - .fetch_add(1, std::sync::atomic::Ordering::SeqCst) + .fetch_add(1, ark_std::sync::atomic::Ordering::SeqCst) } pub fn reset() { HASH_COUNTER .counter - .store(0, std::sync::atomic::Ordering::SeqCst) + .store(0, ark_std::sync::atomic::Ordering::SeqCst) } pub fn get() -> usize { HASH_COUNTER .counter - .load(std::sync::atomic::Ordering::SeqCst) + .load(ark_std::sync::atomic::Ordering::SeqCst) } } diff --git a/src/crypto/merkle_tree/poseidon.rs b/src/crypto/merkle_tree/poseidon.rs index 3eef521..adf6127 100644 --- a/src/crypto/merkle_tree/poseidon.rs +++ b/src/crypto/merkle_tree/poseidon.rs @@ -1,4 +1,4 @@ -use std::{borrow::Borrow, marker::PhantomData}; +use ark_std::{borrow::Borrow, marker::PhantomData, vec::Vec}; use ark_crypto_primitives::crh::poseidon; use ark_crypto_primitives::sponge::poseidon::PoseidonSponge; diff --git a/src/crypto/merkle_tree/sha3.rs b/src/crypto/merkle_tree/sha3.rs index a154b78..1e7625a 100644 --- a/src/crypto/merkle_tree/sha3.rs +++ b/src/crypto/merkle_tree/sha3.rs @@ -1,4 +1,8 @@ -use std::{borrow::Borrow, marker::PhantomData}; +use ark_std::{ + borrow::Borrow, + marker::PhantomData, + {vec, vec::Vec}, +}; use super::HashCounter; use ark_crypto_primitives::{ diff --git a/src/direct/ldt.rs b/src/direct/ldt.rs index 50acd24..57cf9b7 100644 --- a/src/direct/ldt.rs +++ b/src/direct/ldt.rs @@ -3,7 +3,7 @@ use ark_crypto_primitives::{ sponge::{Absorb, CryptographicSponge}, }; use ark_ff::FftField; -use ark_std::marker::PhantomData; +use ark_std::{marker::PhantomData, vec::Vec}; use crate::{ direct::{config::DirectConfig, prover::DirectProver, verifier::DirectVerifier}, diff --git a/src/direct/proof.rs b/src/direct/proof.rs index ab98aaa..f417e3e 100644 --- a/src/direct/proof.rs +++ b/src/direct/proof.rs @@ -3,6 +3,7 @@ use ark_crypto_primitives::{ sponge::{Absorb, CryptographicSponge}, }; use ark_ff::FftField; +use ark_std::vec::Vec; use crate::utils::squeeze_integer; diff --git a/src/direct/prover.rs b/src/direct/prover.rs index 025650e..06447fe 100644 --- a/src/direct/prover.rs +++ b/src/direct/prover.rs @@ -4,7 +4,7 @@ use ark_crypto_primitives::{ }; use ark_ff::FftField; -use ark_std::marker::PhantomData; +use ark_std::{marker::PhantomData, vec::Vec}; use crate::{ direct::{config::DirectConfig, proof::DirectProof}, diff --git a/src/direct/verifier.rs b/src/direct/verifier.rs index 93d6f7e..bc37887 100644 --- a/src/direct/verifier.rs +++ b/src/direct/verifier.rs @@ -3,7 +3,7 @@ use ark_crypto_primitives::{ sponge::{Absorb, CryptographicSponge}, }; use ark_ff::FftField; -use ark_std::marker::PhantomData; +use ark_std::{marker::PhantomData, vec::Vec}; use crate::{ direct::{config::DirectConfig, proof::DirectProof}, diff --git a/src/domain.rs b/src/domain.rs index 59725d3..04e5f58 100644 --- a/src/domain.rs +++ b/src/domain.rs @@ -1,9 +1,8 @@ -use std::ops::Deref; - use ark_ff::FftField; use ark_poly::{ EvaluationDomain, GeneralEvaluationDomain, MixedRadixEvaluationDomain, Radix2EvaluationDomain, }; +use ark_std::ops::Deref; #[derive(Debug, Clone)] pub struct Domain { @@ -164,7 +163,7 @@ impl Deref for Domain { #[cfg(test)] mod tests { - use std::collections::HashSet; + use ark_std::collections::HashSet; use super::*; use crate::crypto::fields::Field64 as TestField; diff --git a/src/lib.rs b/src/lib.rs index dd8d8c4..1cbf9a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#![no_std] pub mod crypto; pub mod direct; pub mod domain; diff --git a/src/poly_utils/bs08.rs b/src/poly_utils/bs08.rs index 4268630..95fab23 100644 --- a/src/poly_utils/bs08.rs +++ b/src/poly_utils/bs08.rs @@ -1,5 +1,6 @@ use ark_ff::Field; use ark_poly::{univariate::DensePolynomial, DenseUVPolynomial, Polynomial}; +use ark_std::{vec, vec::Vec}; use crate::utils; diff --git a/src/poly_utils/folding.rs b/src/poly_utils/folding.rs index e0bee47..a9f805e 100644 --- a/src/poly_utils/folding.rs +++ b/src/poly_utils/folding.rs @@ -1,5 +1,6 @@ use ark_ff::Field; use ark_poly::{univariate::DensePolynomial, Polynomial}; +use ark_std::vec::Vec; use crate::poly_utils::interpolation; diff --git a/src/poly_utils/interpolation.rs b/src/poly_utils/interpolation.rs index 28abfee..77fa1f5 100644 --- a/src/poly_utils/interpolation.rs +++ b/src/poly_utils/interpolation.rs @@ -2,6 +2,7 @@ use ark_ff::{batch_inversion, FftField, Field}; use ark_poly::{ univariate::DensePolynomial, DenseUVPolynomial, Evaluations, Polynomial, Radix2EvaluationDomain, }; +use ark_std::{vec, vec::Vec}; use crate::utils; diff --git a/src/poly_utils/quotient.rs b/src/poly_utils/quotient.rs index 688a1ee..2a99cf7 100644 --- a/src/poly_utils/quotient.rs +++ b/src/poly_utils/quotient.rs @@ -1,5 +1,6 @@ use ark_ff::{FftField, Field}; use ark_poly::{univariate::DensePolynomial, Polynomial}; +use ark_std::vec::Vec; use super::interpolation; @@ -67,6 +68,7 @@ pub fn quotient_with_hint<'a, F: Field>( #[cfg(test)] mod tests { use ark_poly::DenseUVPolynomial; + use ark_std::vec; use rand::Rng; use super::*; diff --git a/src/stir/config.rs b/src/stir/config.rs index 594e780..402e2b6 100644 --- a/src/stir/config.rs +++ b/src/stir/config.rs @@ -2,6 +2,7 @@ use ark_crypto_primitives::{ merkle_tree::{Config as MerkleConfig, LeafParam, TwoToOneParam}, sponge::CryptographicSponge, }; +use ark_std::vec::Vec; pub struct STIRConfig { pub folding_factor: usize, diff --git a/src/stir/ldt.rs b/src/stir/ldt.rs index 52e0ae8..6948c3c 100644 --- a/src/stir/ldt.rs +++ b/src/stir/ldt.rs @@ -9,6 +9,7 @@ use ark_crypto_primitives::{ }; use ark_ff::{FftField, PrimeField}; use ark_std::marker::PhantomData; +use ark_std::vec::Vec; pub struct STIR where diff --git a/src/stir/mod.rs b/src/stir/mod.rs index 1495836..8a2f632 100644 --- a/src/stir/mod.rs +++ b/src/stir/mod.rs @@ -12,6 +12,7 @@ mod tests { use ark_poly::univariate::DensePolynomial; use ark_poly::DenseUVPolynomial; use ark_std::test_rng; + use ark_std::vec; use crate::{ crypto::{fields::Field256, fs, merkle_tree}, diff --git a/src/stir/proof.rs b/src/stir/proof.rs index 43a6fa9..e8ab401 100644 --- a/src/stir/proof.rs +++ b/src/stir/proof.rs @@ -4,6 +4,7 @@ use ark_crypto_primitives::{ }; use ark_ff::{batch_inversion, Field}; use ark_poly::{univariate::DensePolynomial, Polynomial}; +use ark_std::vec::Vec; use super::config::STIRConfig; diff --git a/src/stir/prover.rs b/src/stir/prover.rs index 97b661f..755f1c5 100644 --- a/src/stir/prover.rs +++ b/src/stir/prover.rs @@ -5,6 +5,7 @@ use ark_crypto_primitives::{ use ark_ff::{FftField, PrimeField}; use ark_poly::Polynomial; use ark_std::marker::PhantomData; +use ark_std::vec::Vec; use crate::{ ldt::Prover, diff --git a/src/stir/prover_state.rs b/src/stir/prover_state.rs index 6e906b8..70ffd73 100644 --- a/src/stir/prover_state.rs +++ b/src/stir/prover_state.rs @@ -4,6 +4,7 @@ use ark_crypto_primitives::{ }; use ark_ff::{FftField, PrimeField}; use ark_poly::{univariate::DensePolynomial, DenseUVPolynomial, EvaluationDomain, Polynomial}; +use ark_std::{vec, vec::Vec}; use crate::{ domain::Domain, diff --git a/src/stir/verifier.rs b/src/stir/verifier.rs index b7d5348..8dece4c 100644 --- a/src/stir/verifier.rs +++ b/src/stir/verifier.rs @@ -5,6 +5,7 @@ use ark_crypto_primitives::{ use ark_ff::{FftField, PrimeField}; use ark_poly::Polynomial; use ark_std::marker::PhantomData; +use ark_std::vec::Vec; use crate::{ ldt::Verifier, diff --git a/src/stir/verifier_state.rs b/src/stir/verifier_state.rs index 0cf6bce..2c4d5b0 100644 --- a/src/stir/verifier_state.rs +++ b/src/stir/verifier_state.rs @@ -7,6 +7,7 @@ use ark_poly::{ univariate::DensePolynomial, DenseUVPolynomial, EvaluationDomain, Polynomial, Radix2EvaluationDomain, }; +use ark_std::{vec, vec::Vec}; use itertools::izip; use crate::{ diff --git a/src/utils.rs b/src/utils.rs index b6f8b36..f3f551f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,4 @@ -use std::collections::BTreeSet; +use ark_std::{collections::BTreeSet, vec, vec::Vec}; use ark_crypto_primitives::sponge::CryptographicSponge; diff --git a/src/witness/single.rs b/src/witness/single.rs index e62d005..815427d 100644 --- a/src/witness/single.rs +++ b/src/witness/single.rs @@ -4,6 +4,7 @@ use ark_crypto_primitives::{ }; use ark_ff::FftField; use ark_poly::{univariate::DensePolynomial, Polynomial}; +use ark_std::vec::Vec; use crate::{ domain::Domain,