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

feat: extend range of possible implementations of bytereader/bytewriter #262

Merged
merged 5 commits into from
Mar 15, 2024
Merged
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 air/src/air/assertions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
// LICENSE file in the root directory of this source tree.

use crate::errors::AssertionError;
use alloc::vec::Vec;
use core::{
cmp::Ordering,
fmt::{Display, Formatter},
};
use math::FieldElement;
use utils::collections::*;

#[cfg(test)]
mod tests;
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/assertions/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// LICENSE file in the root directory of this source tree.

use super::{Assertion, AssertionError};
use alloc::vec::Vec;
use math::{fields::f128::BaseElement, FieldElement};
use rand_utils::{rand_value, rand_vector};
use utils::collections::*;

// SINGLE ASSERTIONS
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/boundary/constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// LICENSE file in the root directory of this source tree.

use super::{Assertion, ExtensionOf, FieldElement};
use alloc::{collections::BTreeMap, vec::Vec};
use math::{fft, polynom};
use utils::collections::*;

// BOUNDARY CONSTRAINT
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/boundary/constraint_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// LICENSE file in the root directory of this source tree.

use super::{Assertion, BoundaryConstraint, ConstraintDivisor, ExtensionOf, FieldElement};
use utils::collections::*;
use alloc::{collections::BTreeMap, vec::Vec};

// BOUNDARY CONSTRAINT GROUP
// ================================================================================================
Expand Down
5 changes: 4 additions & 1 deletion air/src/air/boundary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
// LICENSE file in the root directory of this source tree.

use super::{AirContext, Assertion, ConstraintDivisor};
use alloc::{
collections::{BTreeMap, BTreeSet},
vec::Vec,
};
use math::{ExtensionOf, FieldElement};
use utils::collections::*;

mod constraint;
pub use constraint::BoundaryConstraint;
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/boundary/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use super::{
super::tests::{build_prng, build_sequence_poly},
Assertion, BoundaryConstraint,
};
use alloc::{collections::BTreeMap, vec::Vec};
use crypto::{hashers::Blake3_256, DefaultRandomCoin, RandomCoin};
use math::{fields::f64::BaseElement, polynom, FieldElement, StarkField};
use rand_utils::{rand_value, rand_vector, shuffle};
use utils::collections::*;

// BOUNDARY CONSTRAINT TESTS
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/coefficients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use alloc::vec::Vec;
use math::FieldElement;
use utils::collections::*;

// AUXILIARY TRACE SEGMENT RANDOMNESS
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// LICENSE file in the root directory of this source tree.

use crate::{air::TransitionConstraintDegree, ProofOptions, TraceInfo};
use alloc::vec::Vec;
use core::cmp;
use math::StarkField;
use utils::collections::*;

// AIR CONTEXT
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/divisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// LICENSE file in the root directory of this source tree.

use crate::air::Assertion;
use alloc::vec::Vec;
use core::fmt::{Display, Formatter};
use math::{FieldElement, StarkField};
use utils::collections::*;

// CONSTRAINT DIVISOR
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// LICENSE file in the root directory of this source tree.

use crate::ProofOptions;
use alloc::{collections::BTreeMap, vec::Vec};
use crypto::{RandomCoin, RandomCoinError};
use math::{fft, ExtensibleField, ExtensionOf, FieldElement, StarkField, ToElements};
use utils::collections::*;

mod trace_info;
pub use trace_info::{TraceInfo, TraceLayout};
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use super::{
TransitionConstraintDegree,
};
use crate::{AuxTraceRandElements, FieldExtension};
use alloc::{collections::BTreeMap, vec::Vec};
use crypto::{hashers::Blake3_256, DefaultRandomCoin, RandomCoin};
use math::{fields::f64::BaseElement, get_power_series, polynom, FieldElement, StarkField};
use utils::collections::*;

// PERIODIC COLUMNS
// ================================================================================================
Expand Down
6 changes: 2 additions & 4 deletions air/src/air/trace_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use alloc::{string::ToString, vec::Vec};
use math::{StarkField, ToElements};
use utils::{
collections::*, string::*, ByteReader, ByteWriter, Deserializable, DeserializationError,
Serializable,
};
use utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable};

// CONSTANTS
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/transition/degree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// LICENSE file in the root directory of this source tree.

use super::{super::super::ProofOptions, MIN_CYCLE_LENGTH};
use alloc::vec::Vec;
use core::cmp;
use utils::collections::*;

// TRANSITION CONSTRAINT DEGREE
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/transition/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// LICENSE file in the root directory of this source tree.

use super::FieldElement;
use utils::collections::*;
use alloc::vec::Vec;

// EVALUATION FRAME
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion air/src/air/transition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// LICENSE file in the root directory of this source tree.

use super::{AirContext, ConstraintDivisor, ExtensionOf, FieldElement};
use utils::collections::*;
use alloc::vec::Vec;

mod frame;
pub use frame::EvaluationFrame;
Expand Down
3 changes: 1 addition & 2 deletions air/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
//! This crate also contains components describing STARK protocol parameters ([ProofOptions]) and
//! proof structure ([StarkProof](proof::StarkProof)).

#![cfg_attr(not(feature = "std"), no_std)]
#![no_std]

#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;

Expand Down
5 changes: 2 additions & 3 deletions air/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use alloc::vec::Vec;
use fri::FriOptions;
use math::{StarkField, ToElements};
use utils::{
collections::*, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
};
use utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable};

// CONSTANTS
// ================================================================================================
Expand Down
4 changes: 2 additions & 2 deletions air/src/proof/commitments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use alloc::vec::Vec;
use crypto::Hasher;
use utils::{
collections::*, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
SliceReader,
ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader,
};

// COMMITMENTS
Expand Down
6 changes: 2 additions & 4 deletions air/src/proof/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
// LICENSE file in the root directory of this source tree.

use crate::{ProofOptions, TraceInfo, TraceLayout};
use alloc::{string::ToString, vec::Vec};
use math::{StarkField, ToElements};
use utils::{
collections::*, string::*, ByteReader, ByteWriter, Deserializable, DeserializationError,
Serializable,
};
use utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable};

// PROOF CONTEXT
// ================================================================================================
Expand Down
5 changes: 2 additions & 3 deletions air/src/proof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
//! Contains STARK proof struct and associated components.

use crate::{ProofOptions, TraceInfo, TraceLayout};
use alloc::vec::Vec;
use core::cmp;
use crypto::Hasher;
use fri::FriProof;
use math::FieldElement;
use utils::{
collections::*, ByteReader, Deserializable, DeserializationError, Serializable, SliceReader,
};
use utils::{ByteReader, Deserializable, DeserializationError, Serializable, SliceReader};

mod context;
pub use context::Context;
Expand Down
4 changes: 2 additions & 2 deletions air/src/proof/ood_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use alloc::vec::Vec;
use math::FieldElement;
use utils::{
collections::*, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
SliceReader,
ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader,
};

// TYPE ALIASES
Expand Down
4 changes: 2 additions & 2 deletions air/src/proof/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// LICENSE file in the root directory of this source tree.

use super::Table;
use alloc::vec::Vec;
use crypto::{BatchMerkleProof, ElementHasher, Hasher};
use math::FieldElement;
use utils::{
collections::*, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
SliceReader,
ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader,
};

// QUERIES
Expand Down
2 changes: 1 addition & 1 deletion air/src/proof/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// LICENSE file in the root directory of this source tree.

use super::{DeserializationError, SliceReader};
use alloc::vec::Vec;
use core::iter::FusedIterator;
use math::FieldElement;
use utils::collections::*;
use utils::ByteReader;

// CONSTANTS
Expand Down
3 changes: 1 addition & 2 deletions crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
//! [RandomCoin] implementation uses a cryptographic hash function to generate pseudo-random
//! elements form a seed.

#![cfg_attr(not(feature = "std"), no_std)]
#![no_std]

#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;

Expand Down
3 changes: 2 additions & 1 deletion crypto/src/merkle/concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
// LICENSE file in the root directory of this source tree.

use crate::Hasher;
use alloc::vec::Vec;
use core::slice;
use utils::{collections::*, iterators::*, rayon};
use utils::{iterators::*, rayon};

// CONSTANTS
// ================================================================================================
Expand Down
5 changes: 4 additions & 1 deletion crypto/src/merkle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
// LICENSE file in the root directory of this source tree.

use crate::{errors::MerkleTreeError, hash::Hasher};
use alloc::{
collections::{BTreeMap, BTreeSet},
vec::Vec,
};
use core::slice;
use utils::collections::*;

mod proofs;
pub use proofs::BatchMerkleProof;
Expand Down
3 changes: 2 additions & 1 deletion crypto/src/merkle/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// LICENSE file in the root directory of this source tree.

use crate::{errors::MerkleTreeError, Hasher};
use utils::{collections::*, string::*, ByteReader, DeserializationError, Serializable};
use alloc::{collections::BTreeMap, string::ToString, vec::Vec};
use utils::{ByteReader, DeserializationError, Serializable};

// CONSTANTS
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion crypto/src/random/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// LICENSE file in the root directory of this source tree.

use crate::{errors::RandomCoinError, Digest, ElementHasher, RandomCoin};
use alloc::vec::Vec;
use math::{FieldElement, StarkField};
use utils::collections::*;

// DEFAULT RANDOM COIN IMPLEMENTATION
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion crypto/src/random/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// LICENSE file in the root directory of this source tree.

use crate::{errors::RandomCoinError, ElementHasher, Hasher};
use alloc::vec::Vec;
use math::{FieldElement, StarkField};
use utils::collections::*;

mod default;
pub use default::DefaultRandomCoin;
Expand Down
2 changes: 1 addition & 1 deletion examples/src/rescue_raps/custom_trace_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use core_utils::{collections::*, uninit_vector};
use core_utils::uninit_vector;
use winterfell::{
math::{FieldElement, StarkField},
matrix::ColMatrix,
Expand Down
3 changes: 2 additions & 1 deletion fri/src/folding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#[cfg(feature = "concurrent")]
use utils::iterators::*;

use alloc::vec::Vec;
use math::{
fft::{get_inv_twiddles, serial_fft},
get_power_series_with_offset, polynom, FieldElement, StarkField,
};
use utils::{collections::*, iter_mut, uninit_vector};
use utils::{iter_mut, uninit_vector};

// DEGREE-RESPECTING PROJECTION
// ================================================================================================
Expand Down
3 changes: 1 addition & 2 deletions fri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@
//! * [DEEP-FRI: Sampling Outside the Box Improves Soundness](https://eprint.iacr.org/2019/336)
//! * Swastik Kooparty's [talk on DEEP-FRI](https://www.youtube.com/watch?v=txo_kPSn59Y&list=PLcIyXLwiPilWvjvNkhMn283LV370Pk5CT&index=6)

#![cfg_attr(not(feature = "std"), no_std)]
#![no_std]

#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;

Expand Down
4 changes: 2 additions & 2 deletions fri/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use alloc::{string::ToString, vec::Vec};
use crypto::{BatchMerkleProof, ElementHasher, Hasher};
use math::FieldElement;
use utils::{
collections::*, string::*, ByteReader, ByteWriter, Deserializable, DeserializationError,
Serializable, SliceReader,
ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader,
};

// FRI PROOF
Expand Down
2 changes: 1 addition & 1 deletion fri/src/prover/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

use alloc::vec::Vec;
use core::marker::PhantomData;
use crypto::{ElementHasher, Hasher, RandomCoin};
use math::FieldElement;
use utils::collections::*;

// PROVER CHANNEL TRAIT
// ================================================================================================
Expand Down
Loading
Loading