From 21bd410b8d7f128444c455be2db3adbbbd5822ff Mon Sep 17 00:00:00 2001 From: Augusto Hack Date: Fri, 23 Feb 2024 06:03:56 +0100 Subject: [PATCH] fix: clippy errors for redundant imports (#1255) --- air/src/constraints/chiplets/bitwise/mod.rs | 4 +- air/src/constraints/chiplets/hasher/mod.rs | 17 +++++---- air/src/constraints/chiplets/hasher/tests.rs | 3 +- air/src/constraints/chiplets/memory/mod.rs | 14 ++++--- air/src/constraints/chiplets/memory/tests.rs | 3 +- air/src/constraints/chiplets/mod.rs | 4 +- air/src/constraints/range.rs | 4 +- air/src/constraints/stack/field_ops/mod.rs | 6 +-- air/src/constraints/stack/io_ops/mod.rs | 9 +++-- air/src/constraints/stack/mod.rs | 4 +- air/src/constraints/stack/overflow/mod.rs | 6 +-- .../stack/stack_manipulation/mod.rs | 6 +-- air/src/constraints/stack/system_ops/mod.rs | 9 +++-- air/src/constraints/stack/u32_ops/mod.rs | 6 +-- air/src/errors.rs | 3 +- air/src/lib.rs | 6 +-- air/src/proof.rs | 5 ++- air/src/trace/main_trace.rs | 3 +- air/src/utils.rs | 6 ++- assembly/src/assembler/context.rs | 10 +++-- .../src/assembler/instruction/procedures.rs | 5 ++- assembly/src/assembler/mod.rs | 10 ++--- assembly/src/assembler/module_provider.rs | 3 +- assembly/src/assembler/span_builder.rs | 3 +- assembly/src/ast/code_body.rs | 3 +- assembly/src/ast/format.rs | 3 +- assembly/src/ast/imports.rs | 7 ++-- assembly/src/ast/mod.rs | 8 ++-- assembly/src/ast/module.rs | 3 +- assembly/src/ast/nodes/advice.rs | 3 +- assembly/src/ast/nodes/mod.rs | 5 +-- assembly/src/ast/nodes/serde/debug.rs | 3 +- .../src/ast/nodes/serde/deserialization.rs | 3 +- assembly/src/ast/nodes/serde/mod.rs | 3 +- assembly/src/ast/nodes/serde/signatures.rs | 3 +- assembly/src/ast/parsers/constants.rs | 3 +- assembly/src/ast/parsers/context.rs | 2 +- assembly/src/ast/parsers/io_ops.rs | 4 +- assembly/src/ast/parsers/labels.rs | 3 +- assembly/src/ast/parsers/mod.rs | 9 +++-- assembly/src/ast/procedure.rs | 2 +- assembly/src/ast/program.rs | 3 +- assembly/src/ast/tests.rs | 6 +-- assembly/src/errors.rs | 3 +- assembly/src/lib.rs | 3 +- assembly/src/library/masl.rs | 11 +++--- assembly/src/library/mod.rs | 3 +- assembly/src/library/path.rs | 5 ++- assembly/src/procedures/mod.rs | 5 ++- assembly/src/tokens/lines.rs | 3 +- assembly/src/tokens/mod.rs | 5 ++- assembly/src/tokens/stream.rs | 5 +-- core/src/errors.rs | 2 +- core/src/operations/decorators/assembly_op.rs | 2 +- core/src/operations/decorators/mod.rs | 2 +- core/src/program/blocks/join_block.rs | 3 +- core/src/program/blocks/loop_block.rs | 3 +- core/src/program/blocks/mod.rs | 3 +- core/src/program/blocks/span_block.rs | 4 +- core/src/program/blocks/split_block.rs | 3 +- core/src/program/info.rs | 3 +- core/src/program/mod.rs | 11 ++---- core/src/stack/inputs.rs | 4 +- core/src/stack/mod.rs | 5 +-- core/src/stack/outputs.rs | 6 +-- core/src/utils/mod.rs | 17 ++++----- miden/benches/program_compilation.rs | 2 +- miden/src/cli/data.rs | 6 +-- miden/src/cli/prove.rs | 2 +- miden/src/cli/run.rs | 2 +- miden/src/examples/blake3.rs | 2 +- miden/src/examples/fibonacci.rs | 2 +- miden/src/repl/mod.rs | 8 ++-- miden/src/tools/mod.rs | 2 +- .../tests/integration/air/chiplets/hasher.rs | 2 +- processor/src/chiplets/aux_trace/mod.rs | 3 +- processor/src/chiplets/bitwise/mod.rs | 3 +- processor/src/chiplets/bitwise/tests.rs | 4 +- processor/src/chiplets/hasher/mod.rs | 4 +- processor/src/chiplets/hasher/tests.rs | 3 +- processor/src/chiplets/hasher/trace.rs | 3 +- processor/src/chiplets/kernel_rom/tests.rs | 2 +- processor/src/chiplets/memory/mod.rs | 4 +- processor/src/chiplets/memory/segment.rs | 3 +- processor/src/chiplets/memory/tests.rs | 9 ++--- processor/src/chiplets/mod.rs | 5 ++- processor/src/chiplets/tests.rs | 4 +- processor/src/debug.rs | 12 +++--- processor/src/decoder/aux_trace/mod.rs | 4 +- processor/src/decoder/block_stack.rs | 4 +- processor/src/decoder/mod.rs | 3 +- processor/src/decoder/tests.rs | 2 +- processor/src/decoder/trace.rs | 9 +++-- processor/src/errors.rs | 6 +-- .../advice/injectors/adv_map_injectors.rs | 3 +- .../advice/injectors/adv_stack_injectors.rs | 2 +- processor/src/host/advice/injectors/dsa.rs | 3 +- processor/src/host/advice/injectors/smt.rs | 3 +- processor/src/host/advice/inputs.rs | 3 +- processor/src/host/advice/map.rs | 3 +- processor/src/host/advice/mod.rs | 2 +- processor/src/host/advice/providers.rs | 6 +-- processor/src/host/debug.rs | 2 +- processor/src/lib.rs | 2 +- processor/src/operations/comb_ops.rs | 2 +- processor/src/operations/crypto_ops.rs | 2 +- processor/src/operations/fri_ops.rs | 2 +- processor/src/range/aux_trace.rs | 3 +- processor/src/range/mod.rs | 6 +-- processor/src/range/tests.rs | 4 +- processor/src/stack/aux_trace.rs | 5 +-- processor/src/stack/mod.rs | 5 +-- processor/src/stack/overflow.rs | 3 +- processor/src/stack/tests.rs | 5 +-- processor/src/stack/trace.rs | 4 +- processor/src/system/mod.rs | 3 +- processor/src/trace/mod.rs | 5 ++- processor/src/trace/tests/chiplets/hasher.rs | 2 +- processor/src/trace/tests/hasher.rs | 10 ++--- processor/src/trace/tests/mod.rs | 7 +++- processor/src/trace/tests/stack.rs | 6 +-- processor/src/trace/utils.rs | 8 ++-- processor/src/utils.rs | 3 +- stdlib/tests/collections/mmr.rs | 10 ++--- stdlib/tests/crypto/blake3.rs | 1 - stdlib/tests/crypto/ecdsa_secp256k1.rs | 1 - stdlib/tests/crypto/elgamal.rs | 4 +- stdlib/tests/crypto/falcon.rs | 6 +-- stdlib/tests/crypto/fri/mod.rs | 1 - stdlib/tests/crypto/fri/remainder.rs | 1 - stdlib/tests/crypto/fri/verifier_fri_e2f4.rs | 38 +++++++++---------- stdlib/tests/crypto/keccak256.rs | 1 - stdlib/tests/crypto/native.rs | 1 - stdlib/tests/crypto/sha256.rs | 1 - stdlib/tests/crypto/stark/mod.rs | 4 +- .../stark/verifier_recursive/channel.rs | 2 +- .../crypto/stark/verifier_recursive/mod.rs | 13 +++---- stdlib/tests/math/ecgfp5/base_field.rs | 6 +-- stdlib/tests/math/ecgfp5/group.rs | 1 - stdlib/tests/math/ecgfp5/scalar_field.rs | 3 +- stdlib/tests/math/secp256k1/base_field.rs | 2 - stdlib/tests/math/secp256k1/group.rs | 1 - stdlib/tests/math/secp256k1/scalar_field.rs | 2 - stdlib/tests/math/u256_mod.rs | 1 - stdlib/tests/math/u64_mod.rs | 1 - stdlib/tests/sys/mod.rs | 1 - test-utils/src/crypto.rs | 2 +- test-utils/src/lib.rs | 9 +++-- 148 files changed, 338 insertions(+), 340 deletions(-) diff --git a/air/src/constraints/chiplets/bitwise/mod.rs b/air/src/constraints/chiplets/bitwise/mod.rs index 2ca76300a2..c01e10f4d9 100644 --- a/air/src/constraints/chiplets/bitwise/mod.rs +++ b/air/src/constraints/chiplets/bitwise/mod.rs @@ -1,11 +1,11 @@ -use super::{EvaluationFrame, Felt, FieldElement, Vec}; +use super::{EvaluationFrame, Felt, FieldElement}; use crate::{ trace::chiplets::{ bitwise::{NUM_DECOMP_BITS, NUM_SELECTORS, OP_CYCLE_LEN}, BITWISE_A_COL_IDX, BITWISE_A_COL_RANGE, BITWISE_B_COL_IDX, BITWISE_B_COL_RANGE, BITWISE_OUTPUT_COL_IDX, BITWISE_PREV_OUTPUT_COL_IDX, BITWISE_SELECTOR_COL_IDX, }, - utils::{are_equal, binary_not, is_binary, is_zero, EvaluationResult}, + utils::{are_equal, binary_not, collections::*, is_binary, is_zero, EvaluationResult}, ONE, ZERO, }; use winter_air::TransitionConstraintDegree; diff --git a/air/src/constraints/chiplets/hasher/mod.rs b/air/src/constraints/chiplets/hasher/mod.rs index 46d3a794af..17e4ecc211 100644 --- a/air/src/constraints/chiplets/hasher/mod.rs +++ b/air/src/constraints/chiplets/hasher/mod.rs @@ -1,12 +1,13 @@ -use super::{EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree, Vec}; -use crate::trace::chiplets::{ - hasher::{ - Hasher, CAPACITY_LEN, DIGEST_LEN, DIGEST_RANGE, HASH_CYCLE_LEN, NUM_SELECTORS, STATE_WIDTH, - }, - HASHER_NODE_INDEX_COL_IDX, HASHER_SELECTOR_COL_RANGE, HASHER_STATE_COL_RANGE, -}; +use super::{EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree}; use crate::{ - utils::{are_equal, binary_not, is_binary, EvaluationResult}, + trace::chiplets::{ + hasher::{ + Hasher, CAPACITY_LEN, DIGEST_LEN, DIGEST_RANGE, HASH_CYCLE_LEN, NUM_SELECTORS, + STATE_WIDTH, + }, + HASHER_NODE_INDEX_COL_IDX, HASHER_SELECTOR_COL_RANGE, HASHER_STATE_COL_RANGE, + }, + utils::{are_equal, binary_not, collections::*, is_binary, EvaluationResult}, ONE, ZERO, }; diff --git a/air/src/constraints/chiplets/hasher/tests.rs b/air/src/constraints/chiplets/hasher/tests.rs index 7c183164df..5c278efc3b 100644 --- a/air/src/constraints/chiplets/hasher/tests.rs +++ b/air/src/constraints/chiplets/hasher/tests.rs @@ -4,10 +4,11 @@ use super::{ }; use crate::{ trace::chiplets::hasher::{Selectors, LINEAR_HASH, STATE_WIDTH}, + utils::collections::*, Felt, TRACE_WIDTH, }; use rand_utils::rand_array; -use vm_core::{chiplets::hasher::apply_round, utils::collections::Vec}; +use vm_core::chiplets::hasher::apply_round; use winter_air::EvaluationFrame; // UNIT TESTS diff --git a/air/src/constraints/chiplets/memory/mod.rs b/air/src/constraints/chiplets/memory/mod.rs index 850aed2f35..159719428e 100644 --- a/air/src/constraints/chiplets/memory/mod.rs +++ b/air/src/constraints/chiplets/memory/mod.rs @@ -1,10 +1,12 @@ -use super::{EvaluationFrame, FieldElement, Vec}; -use crate::trace::chiplets::{ - memory::NUM_ELEMENTS, MEMORY_ADDR_COL_IDX, MEMORY_CLK_COL_IDX, MEMORY_CTX_COL_IDX, - MEMORY_D0_COL_IDX, MEMORY_D1_COL_IDX, MEMORY_D_INV_COL_IDX, MEMORY_TRACE_OFFSET, - MEMORY_V_COL_RANGE, +use super::{EvaluationFrame, FieldElement}; +use crate::{ + trace::chiplets::{ + memory::NUM_ELEMENTS, MEMORY_ADDR_COL_IDX, MEMORY_CLK_COL_IDX, MEMORY_CTX_COL_IDX, + MEMORY_D0_COL_IDX, MEMORY_D1_COL_IDX, MEMORY_D_INV_COL_IDX, MEMORY_TRACE_OFFSET, + MEMORY_V_COL_RANGE, + }, + utils::{binary_not, collections::*, is_binary, EvaluationResult}, }; -use crate::utils::{binary_not, is_binary, EvaluationResult}; use winter_air::TransitionConstraintDegree; #[cfg(test)] diff --git a/air/src/constraints/chiplets/memory/tests.rs b/air/src/constraints/chiplets/memory/tests.rs index 41eef4260f..910aabf36d 100644 --- a/air/src/constraints/chiplets/memory/tests.rs +++ b/air/src/constraints/chiplets/memory/tests.rs @@ -9,9 +9,8 @@ use crate::trace::{ }, TRACE_WIDTH, }; -use crate::{chiplets::memory, Felt, FieldElement, ONE, ZERO}; +use crate::{chiplets::memory, utils::collections::*, Felt, FieldElement, ONE, ZERO}; use rand_utils::rand_value; -use vm_core::utils::collections::Vec; // UNIT TESTS // ================================================================================================ diff --git a/air/src/constraints/chiplets/mod.rs b/air/src/constraints/chiplets/mod.rs index 9810f91cec..7dc36f9d26 100644 --- a/air/src/constraints/chiplets/mod.rs +++ b/air/src/constraints/chiplets/mod.rs @@ -1,7 +1,7 @@ use super::super::{ - EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree, Vec, CHIPLETS_OFFSET, + EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree, CHIPLETS_OFFSET, }; -use crate::utils::{are_equal, binary_not, is_binary}; +use crate::utils::{are_equal, binary_not, collections::*, is_binary}; mod bitwise; mod hasher; diff --git a/air/src/constraints/range.rs b/air/src/constraints/range.rs index 1b8e95d9cd..9b3a756a51 100644 --- a/air/src/constraints/range.rs +++ b/air/src/constraints/range.rs @@ -2,10 +2,10 @@ use crate::{ chiplets::ChipletsFrameExt, constraints::MainFrameExt, trace::range::{B_RANGE_COL_IDX, M_COL_IDX, V_COL_IDX}, - utils::are_equal, + utils::{are_equal, collections::*}, Assertion, EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree, }; -use vm_core::{utils::collections::Vec, ExtensionOf, ZERO}; +use vm_core::{ExtensionOf, ZERO}; use winter_air::AuxTraceRandElements; // CONSTANTS diff --git a/air/src/constraints/stack/field_ops/mod.rs b/air/src/constraints/stack/field_ops/mod.rs index 31afeaee4c..b2ec9981f3 100644 --- a/air/src/constraints/stack/field_ops/mod.rs +++ b/air/src/constraints/stack/field_ops/mod.rs @@ -1,10 +1,8 @@ -use super::{op_flags::OpFlags, EvaluationFrame, Vec}; +use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree}; use crate::{ stack::EvaluationFrameExt, - utils::{are_equal, is_binary}, + utils::{are_equal, collections::*, is_binary}, }; -use vm_core::FieldElement; -use winter_air::TransitionConstraintDegree; #[cfg(test)] pub mod tests; diff --git a/air/src/constraints/stack/io_ops/mod.rs b/air/src/constraints/stack/io_ops/mod.rs index 9628bc41f1..3b6179289d 100644 --- a/air/src/constraints/stack/io_ops/mod.rs +++ b/air/src/constraints/stack/io_ops/mod.rs @@ -1,7 +1,8 @@ -use super::{op_flags::OpFlags, EvaluationFrame, Vec}; -use crate::{stack::EvaluationFrameExt, utils::are_equal}; -use vm_core::FieldElement; -use winter_air::TransitionConstraintDegree; +use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree}; +use crate::{ + stack::EvaluationFrameExt, + utils::{are_equal, collections::*}, +}; #[cfg(test)] pub mod tests; diff --git a/air/src/constraints/stack/mod.rs b/air/src/constraints/stack/mod.rs index 03853b2384..00dbb4f2b2 100644 --- a/air/src/constraints/stack/mod.rs +++ b/air/src/constraints/stack/mod.rs @@ -4,8 +4,8 @@ use super::super::{ STACK_AUX_TRACE_OFFSET, STACK_TRACE_OFFSET, ZERO, }; use crate::decoder::{IS_CALL_FLAG_COL_IDX, IS_SYSCALL_FLAG_COL_IDX, USER_OP_HELPERS_OFFSET}; -use crate::utils::{are_equal, is_binary}; -use vm_core::{stack::STACK_TOP_SIZE, utils::collections::Vec, StackOutputs}; +use crate::utils::{are_equal, collections::*, is_binary}; +use vm_core::{stack::STACK_TOP_SIZE, StackOutputs}; pub mod field_ops; pub mod io_ops; diff --git a/air/src/constraints/stack/overflow/mod.rs b/air/src/constraints/stack/overflow/mod.rs index 0761a93846..32bd93093a 100644 --- a/air/src/constraints/stack/overflow/mod.rs +++ b/air/src/constraints/stack/overflow/mod.rs @@ -1,7 +1,5 @@ -use super::{op_flags::OpFlags, EvaluationFrame, Vec}; -use crate::stack::EvaluationFrameExt; -use vm_core::FieldElement; -use winter_air::TransitionConstraintDegree; +use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree}; +use crate::{stack::EvaluationFrameExt, utils::collections::*}; #[cfg(test)] pub mod tests; diff --git a/air/src/constraints/stack/stack_manipulation/mod.rs b/air/src/constraints/stack/stack_manipulation/mod.rs index e825499d2f..3fdee5cae0 100644 --- a/air/src/constraints/stack/stack_manipulation/mod.rs +++ b/air/src/constraints/stack/stack_manipulation/mod.rs @@ -1,10 +1,8 @@ -use super::{op_flags::OpFlags, EvaluationFrame, Vec}; +use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree}; use crate::{ stack::EvaluationFrameExt, - utils::{are_equal, binary_not}, + utils::{are_equal, binary_not, collections::*}, }; -use vm_core::FieldElement; -use winter_air::TransitionConstraintDegree; #[cfg(test)] pub mod tests; diff --git a/air/src/constraints/stack/system_ops/mod.rs b/air/src/constraints/stack/system_ops/mod.rs index 073020edcf..2775f73e22 100644 --- a/air/src/constraints/stack/system_ops/mod.rs +++ b/air/src/constraints/stack/system_ops/mod.rs @@ -1,7 +1,8 @@ -use super::{op_flags::OpFlags, EvaluationFrame, Vec}; -use crate::{stack::EvaluationFrameExt, utils::are_equal}; -use vm_core::FieldElement; -use winter_air::TransitionConstraintDegree; +use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree}; +use crate::{ + stack::EvaluationFrameExt, + utils::{are_equal, collections::*}, +}; #[cfg(test)] pub mod tests; diff --git a/air/src/constraints/stack/u32_ops/mod.rs b/air/src/constraints/stack/u32_ops/mod.rs index 3c35c0e417..401166f72c 100644 --- a/air/src/constraints/stack/u32_ops/mod.rs +++ b/air/src/constraints/stack/u32_ops/mod.rs @@ -1,10 +1,8 @@ -use super::{op_flags::OpFlags, EvaluationFrame, Vec}; +use super::{op_flags::OpFlags, EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree}; use crate::{ stack::EvaluationFrameExt, - utils::{are_equal, is_binary}, + utils::{are_equal, collections::*, is_binary}, }; -use vm_core::{Felt, FieldElement}; -use winter_air::TransitionConstraintDegree; #[cfg(test)] pub mod tests; diff --git a/air/src/errors.rs b/air/src/errors.rs index ce9c50b8be..feda629ab7 100644 --- a/air/src/errors.rs +++ b/air/src/errors.rs @@ -1,5 +1,4 @@ -use super::String; -use crate::trace::MIN_TRACE_LEN; +use crate::{trace::MIN_TRACE_LEN, utils::string::*}; use core::fmt::{Display, Formatter}; // EXECUTION ERROR diff --git a/air/src/lib.rs b/air/src/lib.rs index a01664b019..a597604ce4 100644 --- a/air/src/lib.rs +++ b/air/src/lib.rs @@ -5,9 +5,7 @@ extern crate alloc; use vm_core::{ - utils::{ - collections::Vec, string::String, ByteReader, ByteWriter, Deserializable, Serializable, - }, + utils::{collections::*, ByteReader, ByteWriter, Deserializable, Serializable}, ExtensionOf, ProgramInfo, StackInputs, StackOutputs, ONE, ZERO, }; use winter_air::{ @@ -30,7 +28,7 @@ mod proof; mod utils; use utils::TransitionConstraintRange; -// EXPORTS +// RE-EXPORTS // ================================================================================================ pub use errors::ExecutionOptionsError; diff --git a/air/src/proof.rs b/air/src/proof.rs index 4fd4fc5a30..43d8dec278 100644 --- a/air/src/proof.rs +++ b/air/src/proof.rs @@ -1,7 +1,8 @@ -use super::DeserializationError; use vm_core::{ crypto::hash::{Blake3_192, Blake3_256, Hasher, Rpo256}, - utils::{collections::Vec, ByteReader, ByteWriter, Deserializable, Serializable}, + utils::{ + collections::*, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, + }, }; use winter_air::proof::StarkProof; diff --git a/air/src/trace/main_trace.rs b/air/src/trace/main_trace.rs index 24cc8922a5..405f5471db 100644 --- a/air/src/trace/main_trace.rs +++ b/air/src/trace/main_trace.rs @@ -16,9 +16,8 @@ use super::{ CHIPLETS_OFFSET, CLK_COL_IDX, CTX_COL_IDX, DECODER_TRACE_OFFSET, FMP_COL_IDX, FN_HASH_OFFSET, STACK_TRACE_OFFSET, }; +use crate::utils::collections::*; use core::ops::{Deref, Range}; -#[cfg(any(test, feature = "internals"))] -use vm_core::utils::collections::Vec; use vm_core::{utils::range, Felt, ONE, ZERO}; // CONSTANTS diff --git a/air/src/utils.rs b/air/src/utils.rs index 7cd7a04a03..687b8432fc 100644 --- a/air/src/utils.rs +++ b/air/src/utils.rs @@ -1,6 +1,10 @@ use super::FieldElement; use core::ops::Range; -use vm_core::{utils::collections::Vec, utils::range as create_range}; +use vm_core::utils::{collections::*, range as create_range}; + +// RE-EXPORTS +// ================================================================================================ +pub use vm_core::utils::{collections, string}; // BASIC CONSTRAINT OPERATORS // ================================================================================================ diff --git a/assembly/src/assembler/context.rs b/assembly/src/assembler/context.rs index fbede97fbc..6d30ef70c2 100644 --- a/assembly/src/assembler/context.rs +++ b/assembly/src/assembler/context.rs @@ -1,9 +1,11 @@ use super::{ - AssemblyError, BTreeMap, CallSet, CodeBlock, CodeBlockTable, Kernel, LibraryPath, - NamedProcedure, Procedure, ProcedureCache, ProcedureId, ProcedureName, RpoDigest, ToString, - Vec, + AssemblyError, CallSet, CodeBlock, CodeBlockTable, Kernel, LibraryPath, NamedProcedure, + Procedure, ProcedureCache, ProcedureId, ProcedureName, RpoDigest, +}; +use crate::{ + ast::{ModuleAst, ProgramAst}, + utils::{collections::*, string::*}, }; -use crate::ast::{ModuleAst, ProgramAst}; // ASSEMBLY CONTEXT // ================================================================================================ diff --git a/assembly/src/assembler/instruction/procedures.rs b/assembly/src/assembler/instruction/procedures.rs index 50ade25032..1801caac39 100644 --- a/assembly/src/assembler/instruction/procedures.rs +++ b/assembly/src/assembler/instruction/procedures.rs @@ -1,7 +1,8 @@ use super::{ - super::Vec, Assembler, AssemblyContext, AssemblyError, CodeBlock, Operation, ProcedureId, - RpoDigest, SpanBuilder, + Assembler, AssemblyContext, AssemblyError, CodeBlock, Operation, ProcedureId, RpoDigest, + SpanBuilder, }; +use crate::utils::collections::*; // PROCEDURE INVOCATIONS // ================================================================================================ diff --git a/assembly/src/assembler/mod.rs b/assembly/src/assembler/mod.rs index 5a93cd8027..67686db4b4 100644 --- a/assembly/src/assembler/mod.rs +++ b/assembly/src/assembler/mod.rs @@ -1,12 +1,12 @@ -use super::ast::instrument; use super::{ - ast::{Instruction, ModuleAst, Node, ProcedureAst, ProgramAst}, + ast::{instrument, Instruction, ModuleAst, Node, ProcedureAst, ProgramAst}, btree_map, crypto::hash::RpoDigest, AssemblyError, BTreeMap, CallSet, CodeBlock, CodeBlockTable, Felt, Kernel, Library, LibraryError, LibraryPath, Module, NamedProcedure, Operation, Procedure, ProcedureId, - ProcedureName, Program, ToString, Vec, ONE, ZERO, + ProcedureName, Program, ONE, ZERO, }; +use crate::utils::collections::*; use core::{borrow::Borrow, cell::RefCell}; use vm_core::{utils::group_vector_elements, Decorator, DecoratorList}; @@ -196,8 +196,8 @@ impl Assembler { /// - If a module with the same path already exists in the module stack of the /// [AssemblyContext]. /// - If a lock to the [ProcedureCache] can not be attained. - #[instrument(level = "trace", - name = "compile_module", + #[instrument(level = "trace", + name = "compile_module", fields(module = path.unwrap_or(&LibraryPath::anon_path()).path()), skip_all)] pub fn compile_module( &self, diff --git a/assembly/src/assembler/module_provider.rs b/assembly/src/assembler/module_provider.rs index 7f2172fa69..f25d0b33d6 100644 --- a/assembly/src/assembler/module_provider.rs +++ b/assembly/src/assembler/module_provider.rs @@ -1,4 +1,5 @@ -use super::{BTreeMap, Library, LibraryError, Module, ProcedureId, Vec}; +use super::{Library, LibraryError, Module, ProcedureId}; +use crate::utils::collections::*; // MODULE PROVIDER // ================================================================================================ diff --git a/assembly/src/assembler/span_builder.rs b/assembly/src/assembler/span_builder.rs index 63db32f057..b767fb2dbb 100644 --- a/assembly/src/assembler/span_builder.rs +++ b/assembly/src/assembler/span_builder.rs @@ -1,7 +1,8 @@ use super::{ AssemblyContext, AssemblyError, BodyWrapper, Borrow, CodeBlock, Decorator, DecoratorList, - Instruction, Operation, ToString, Vec, + Instruction, Operation, }; +use crate::utils::{collections::*, string::*}; use vm_core::{AdviceInjector, AssemblyOp}; // SPAN BUILDER diff --git a/assembly/src/ast/code_body.rs b/assembly/src/ast/code_body.rs index 9f34d5f2e4..230035f83c 100644 --- a/assembly/src/ast/code_body.rs +++ b/assembly/src/ast/code_body.rs @@ -1,7 +1,8 @@ use super::{ ByteReader, ByteWriter, Deserializable, DeserializationError, Node, Serializable, - SourceLocation, Vec, MAX_BODY_LEN, + SourceLocation, MAX_BODY_LEN, }; +use crate::utils::collections::*; use core::{iter, slice}; // CODE BODY diff --git a/assembly/src/ast/format.rs b/assembly/src/ast/format.rs index a8634fe1dc..2ba9c6fec3 100644 --- a/assembly/src/ast/format.rs +++ b/assembly/src/ast/format.rs @@ -1,7 +1,8 @@ use super::{ CodeBody, FormattableNode, InvokedProcsMap, LibraryPath, ProcedureAst, ProcedureId, - ProcedureName, Vec, + ProcedureName, }; +use crate::utils::collections::*; use core::fmt; const INDENT_STRING: &str = " "; diff --git a/assembly/src/ast/imports.rs b/assembly/src/ast/imports.rs index fd6c7b28c0..70912ee7b1 100644 --- a/assembly/src/ast/imports.rs +++ b/assembly/src/ast/imports.rs @@ -1,8 +1,9 @@ use super::{ - BTreeMap, ByteReader, ByteWriter, Deserializable, DeserializationError, InvokedProcsMap, - LibraryPath, ParsingError, ProcedureId, ProcedureName, Serializable, String, ToString, Token, - TokenStream, Vec, MAX_IMPORTS, MAX_INVOKED_IMPORTED_PROCS, + ByteReader, ByteWriter, Deserializable, DeserializationError, InvokedProcsMap, LibraryPath, + ParsingError, ProcedureId, ProcedureName, Serializable, Token, TokenStream, MAX_IMPORTS, + MAX_INVOKED_IMPORTED_PROCS, }; +use crate::utils::{collections::*, string::*}; // TYPE ALIASES // ================================================================================================ diff --git a/assembly/src/ast/mod.rs b/assembly/src/ast/mod.rs index fad3d8d2af..9f0652ad44 100644 --- a/assembly/src/ast/mod.rs +++ b/assembly/src/ast/mod.rs @@ -3,11 +3,11 @@ //! Structs in this module (specifically [ProgramAst] and [ModuleAst]) can be used to parse source //! code into relevant ASTs. This can be done via their `parse()` methods. use super::{ - crypto::hash::RpoDigest, BTreeMap, ByteReader, ByteWriter, Deserializable, - DeserializationError, Felt, LabelError, LibraryPath, ParsingError, ProcedureId, ProcedureName, - Serializable, SliceReader, StarkField, String, ToString, Token, TokenStream, Vec, - MAX_LABEL_LEN, + crypto::hash::RpoDigest, ByteReader, ByteWriter, Deserializable, DeserializationError, Felt, + LabelError, LibraryPath, ParsingError, ProcedureId, ProcedureName, Serializable, SliceReader, + StarkField, Token, TokenStream, MAX_LABEL_LEN, }; +use crate::utils::{collections::*, string::*}; use vm_core::utils::bound_into_included_u64; pub use tracing::{event, info_span, instrument, Level}; diff --git a/assembly/src/ast/module.rs b/assembly/src/ast/module.rs index 6514aa7b9c..e15099a401 100644 --- a/assembly/src/ast/module.rs +++ b/assembly/src/ast/module.rs @@ -8,9 +8,10 @@ use super::{ MAX_LOCAL_PROCS, MAX_REEXPORTED_PROCS, { ByteReader, ByteWriter, Deserializable, DeserializationError, ParsingError, SliceReader, - String, ToString, Token, TokenStream, Vec, + Token, TokenStream, }, }; +use crate::utils::{collections::*, string::*}; use core::{fmt, str::from_utf8}; use vm_core::utils::Serializable; diff --git a/assembly/src/ast/nodes/advice.rs b/assembly/src/ast/nodes/advice.rs index d386377fec..5a1b4e58a3 100644 --- a/assembly/src/ast/nodes/advice.rs +++ b/assembly/src/ast/nodes/advice.rs @@ -1,10 +1,11 @@ use super::{ super::{ - ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, ToString, + ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, MAX_STACK_WORD_OFFSET, }, serde::signatures, }; +use crate::utils::string::*; use core::fmt; use vm_core::{AdviceInjector, Felt, SignatureKind, ZERO}; diff --git a/assembly/src/ast/nodes/mod.rs b/assembly/src/ast/nodes/mod.rs index 7549b26009..1a9dd143bc 100644 --- a/assembly/src/ast/nodes/mod.rs +++ b/assembly/src/ast/nodes/mod.rs @@ -1,6 +1,5 @@ -use super::{ - AstFormatterContext, CodeBody, Felt, FormattableCodeBody, ProcedureId, RpoDigest, ToString, Vec, -}; +use super::{AstFormatterContext, CodeBody, Felt, FormattableCodeBody, ProcedureId, RpoDigest}; +use crate::utils::collections::*; use core::fmt; use vm_core::DebugOptions; diff --git a/assembly/src/ast/nodes/serde/debug.rs b/assembly/src/ast/nodes/serde/debug.rs index 27db78bf4d..3b8b30b0b5 100644 --- a/assembly/src/ast/nodes/serde/debug.rs +++ b/assembly/src/ast/nodes/serde/debug.rs @@ -1,4 +1,5 @@ -use super::{super::DebugOptions, ByteReader, ByteWriter, DeserializationError, ToString}; +use super::{super::DebugOptions, ByteReader, ByteWriter, DeserializationError}; +use crate::utils::string::*; const STACK_ALL: u8 = 0; const STACK_TOP: u8 = 1; diff --git a/assembly/src/ast/nodes/serde/deserialization.rs b/assembly/src/ast/nodes/serde/deserialization.rs index c33a34f797..52858ebee0 100644 --- a/assembly/src/ast/nodes/serde/deserialization.rs +++ b/assembly/src/ast/nodes/serde/deserialization.rs @@ -1,7 +1,8 @@ use super::{ super::AdviceInjectorNode, debug, ByteReader, CodeBody, Deserializable, DeserializationError, - Felt, Instruction, Node, OpCode, ProcedureId, RpoDigest, ToString, MAX_PUSH_INPUTS, + Felt, Instruction, Node, OpCode, ProcedureId, RpoDigest, MAX_PUSH_INPUTS, }; +use crate::utils::string::*; // NODE DESERIALIZATION // ================================================================================================ diff --git a/assembly/src/ast/nodes/serde/mod.rs b/assembly/src/ast/nodes/serde/mod.rs index b982e34205..dd35f2610e 100644 --- a/assembly/src/ast/nodes/serde/mod.rs +++ b/assembly/src/ast/nodes/serde/mod.rs @@ -1,4 +1,5 @@ -use super::{CodeBody, Felt, Instruction, Node, ProcedureId, RpoDigest, ToString}; +use super::{CodeBody, Felt, Instruction, Node, ProcedureId, RpoDigest}; +use crate::utils::string::*; use crate::MAX_PUSH_INPUTS; use num_enum::TryFromPrimitive; use vm_core::utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable}; diff --git a/assembly/src/ast/nodes/serde/signatures.rs b/assembly/src/ast/nodes/serde/signatures.rs index 48ba14bb0f..ebaf358562 100644 --- a/assembly/src/ast/nodes/serde/signatures.rs +++ b/assembly/src/ast/nodes/serde/signatures.rs @@ -1,4 +1,5 @@ -use super::{ByteReader, ByteWriter, DeserializationError, ToString}; +use super::{ByteReader, ByteWriter, DeserializationError}; +use crate::utils::string::*; use vm_core::SignatureKind; const RPOFALCON512: u8 = 0; diff --git a/assembly/src/ast/parsers/constants.rs b/assembly/src/ast/parsers/constants.rs index 2731c30091..131aa26cbf 100644 --- a/assembly/src/ast/parsers/constants.rs +++ b/assembly/src/ast/parsers/constants.rs @@ -1,4 +1,5 @@ -use super::{Felt, LocalConstMap, ParsingError, String, Token, Vec}; +use super::{Felt, LocalConstMap, ParsingError, Token}; +use crate::utils::{collections::*, string::*}; use core::fmt::Display; // CONSTANT VALUE EXPRESSIONS diff --git a/assembly/src/ast/parsers/context.rs b/assembly/src/ast/parsers/context.rs index 132148b977..ba5ace4639 100644 --- a/assembly/src/ast/parsers/context.rs +++ b/assembly/src/ast/parsers/context.rs @@ -4,7 +4,7 @@ use super::{ ModuleImports, Node, ParsingError, ProcedureAst, ProcedureId, ProcedureName, ReExportedProcMap, Token, TokenStream, MAX_BODY_LEN, MAX_DOCS_LEN, }; -use vm_core::utils::{collections::Vec, string::ToString}; +use crate::utils::{collections::*, string::*}; // PARSER CONTEXT // ================================================================================================ diff --git a/assembly/src/ast/parsers/io_ops.rs b/assembly/src/ast/parsers/io_ops.rs index afd9c0c571..2a23a9af68 100644 --- a/assembly/src/ast/parsers/io_ops.rs +++ b/assembly/src/ast/parsers/io_ops.rs @@ -3,9 +3,9 @@ use super::{ Instruction::*, LocalConstMap, Node::{self, Instruction}, - ParsingError, Token, Vec, CONSTANT_LABEL_PARSER, HEX_CHUNK_SIZE, + ParsingError, Token, CONSTANT_LABEL_PARSER, HEX_CHUNK_SIZE, }; -use crate::{StarkField, ADVICE_READ_LIMIT, MAX_PUSH_INPUTS}; +use crate::{utils::collections::*, StarkField, ADVICE_READ_LIMIT, MAX_PUSH_INPUTS}; use core::ops::RangeBounds; use vm_core::WORD_SIZE; diff --git a/assembly/src/ast/parsers/labels.rs b/assembly/src/ast/parsers/labels.rs index 2d6171ea06..61ea86445e 100644 --- a/assembly/src/ast/parsers/labels.rs +++ b/assembly/src/ast/parsers/labels.rs @@ -1,4 +1,5 @@ -use super::{Deserializable, LabelError, RpoDigest, SliceReader, ToString, Vec, MAX_LABEL_LEN}; +use super::{Deserializable, LabelError, RpoDigest, SliceReader, MAX_LABEL_LEN}; +use crate::utils::{collections::*, string::*}; // LABEL PARSERS // ================================================================================================ diff --git a/assembly/src/ast/parsers/mod.rs b/assembly/src/ast/parsers/mod.rs index ce683ef9c6..1b8c8f39cd 100644 --- a/assembly/src/ast/parsers/mod.rs +++ b/assembly/src/ast/parsers/mod.rs @@ -2,10 +2,13 @@ use super::{ bound_into_included_u64, AdviceInjectorNode, CodeBody, Deserializable, Felt, Instruction, InvocationTarget, LabelError, LibraryPath, LocalConstMap, LocalProcMap, ModuleImports, Node, ParsingError, ProcedureAst, ProcedureId, ProcedureName, ReExportedProcMap, RpoDigest, - SliceReader, StarkField, String, ToString, Token, TokenStream, Vec, MAX_BODY_LEN, MAX_DOCS_LEN, - MAX_LABEL_LEN, MAX_STACK_WORD_OFFSET, + SliceReader, StarkField, Token, TokenStream, MAX_BODY_LEN, MAX_DOCS_LEN, MAX_LABEL_LEN, + MAX_STACK_WORD_OFFSET, +}; +use crate::{ + utils::{collections::*, string::*}, + HEX_CHUNK_SIZE, }; -use crate::HEX_CHUNK_SIZE; use core::{fmt::Display, ops::RangeBounds}; mod adv_ops; diff --git a/assembly/src/ast/procedure.rs b/assembly/src/ast/procedure.rs index a9474a93bc..4ad93afce2 100644 --- a/assembly/src/ast/procedure.rs +++ b/assembly/src/ast/procedure.rs @@ -3,8 +3,8 @@ use crate::ast::{MAX_BODY_LEN, MAX_DOCS_LEN}; use super::{ super::tokens::SourceLocation, code_body::CodeBody, nodes::Node, ByteReader, ByteWriter, Deserializable, DeserializationError, LibraryPath, ProcedureId, ProcedureName, Serializable, - String, ToString, Vec, }; +use crate::utils::{collections::*, string::*}; use core::{iter, str::from_utf8}; // PROCEDURE AST diff --git a/assembly/src/ast/program.rs b/assembly/src/ast/program.rs index c99022f16e..26139ab9ad 100644 --- a/assembly/src/ast/program.rs +++ b/assembly/src/ast/program.rs @@ -15,9 +15,10 @@ use super::{ }, { ByteReader, ByteWriter, Deserializable, DeserializationError, ParsingError, Serializable, - SliceReader, Token, TokenStream, Vec, + SliceReader, Token, TokenStream, }, }; +use crate::utils::collections::*; use core::{fmt, iter}; #[cfg(feature = "std")] diff --git a/assembly/src/ast/tests.rs b/assembly/src/ast/tests.rs index b3783497fa..6611e6f950 100644 --- a/assembly/src/ast/tests.rs +++ b/assembly/src/ast/tests.rs @@ -1,8 +1,8 @@ use super::{ - AstSerdeOptions, BTreeMap, CodeBody, Felt, Instruction, LocalProcMap, ModuleAst, Node, - ParsingError, ProcedureAst, ProcedureId, ProcedureName, ProgramAst, SourceLocation, String, - ToString, Token, + AstSerdeOptions, CodeBody, Felt, Instruction, LocalProcMap, ModuleAst, Node, ParsingError, + ProcedureAst, ProcedureId, ProcedureName, ProgramAst, SourceLocation, Token, }; +use crate::utils::{collections::*, string::*}; use vm_core::utils::SliceReader; // UNIT TESTS diff --git a/assembly/src/errors.rs b/assembly/src/errors.rs index 47c6983812..414bcceb72 100644 --- a/assembly/src/errors.rs +++ b/assembly/src/errors.rs @@ -1,7 +1,8 @@ use super::{ ast::ProcReExport, crypto::hash::RpoDigest, tokens::SourceLocation, KernelError, - LibraryNamespace, ProcedureId, ProcedureName, String, ToString, Token, Vec, + LibraryNamespace, ProcedureId, ProcedureName, Token, }; +use crate::utils::{collections::*, string::*}; use core::fmt; // ASSEMBLY ERROR diff --git a/assembly/src/lib.rs b/assembly/src/lib.rs index 95f1d2ebf8..a7cc116704 100644 --- a/assembly/src/lib.rs +++ b/assembly/src/lib.rs @@ -9,8 +9,7 @@ use vm_core::{ crypto, errors::KernelError, utils::{ - collections::{btree_map, BTreeMap, BTreeSet, Vec}, - string::{String, ToString}, + collections::{btree_map, BTreeMap}, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader, }, CodeBlockTable, Felt, Kernel, Operation, Program, StarkField, ONE, ZERO, diff --git a/assembly/src/library/masl.rs b/assembly/src/library/masl.rs index d69e0a247f..51eca33fd5 100644 --- a/assembly/src/library/masl.rs +++ b/assembly/src/library/masl.rs @@ -1,9 +1,9 @@ -use super::super::ast::instrument; use super::{ - super::BTreeSet, AstSerdeOptions, ByteReader, ByteWriter, Deserializable, DeserializationError, - Library, LibraryError, LibraryNamespace, LibraryPath, Module, ModuleAst, Serializable, Vec, - Version, MAX_DEPENDENCIES, MAX_MODULES, + AstSerdeOptions, ByteReader, ByteWriter, Deserializable, DeserializationError, Library, + LibraryError, LibraryNamespace, LibraryPath, Module, ModuleAst, Serializable, Version, + MAX_DEPENDENCIES, MAX_MODULES, }; +use crate::utils::collections::*; use core::slice::Iter; // CONSTANT DEFINITIONS @@ -119,8 +119,7 @@ impl MaslLibrary { #[cfg(feature = "std")] mod use_std { - use super::*; - use crate::{ast::ModuleAst, BTreeMap}; + use super::{super::super::ast::instrument, *}; use std::{fs, io, path::Path}; impl MaslLibrary { diff --git a/assembly/src/library/mod.rs b/assembly/src/library/mod.rs index 5cfb181101..56608a9bba 100644 --- a/assembly/src/library/mod.rs +++ b/assembly/src/library/mod.rs @@ -1,8 +1,9 @@ use super::{ ast::{AstSerdeOptions, ModuleAst}, ByteReader, ByteWriter, Deserializable, DeserializationError, LibraryError, PathError, - Serializable, String, ToString, Vec, MAX_LABEL_LEN, NAMESPACE_LABEL_PARSER, + Serializable, MAX_LABEL_LEN, NAMESPACE_LABEL_PARSER, }; +use crate::utils::string::*; use core::{cmp::Ordering, fmt, ops::Deref, str::from_utf8}; mod masl; diff --git a/assembly/src/library/path.rs b/assembly/src/library/path.rs index d3c28c8285..7bb7fb0192 100644 --- a/assembly/src/library/path.rs +++ b/assembly/src/library/path.rs @@ -1,7 +1,8 @@ use super::{ - ByteReader, ByteWriter, Deserializable, DeserializationError, PathError, Serializable, String, - ToString, MAX_LABEL_LEN, + ByteReader, ByteWriter, Deserializable, DeserializationError, PathError, Serializable, + MAX_LABEL_LEN, }; +use crate::utils::string::*; use core::{fmt, ops::Deref, str::from_utf8}; // CONSTANTS diff --git a/assembly/src/procedures/mod.rs b/assembly/src/procedures/mod.rs index 5a6591da9d..4519de64cd 100644 --- a/assembly/src/procedures/mod.rs +++ b/assembly/src/procedures/mod.rs @@ -1,8 +1,9 @@ use super::{ crypto::hash::{Blake3_160, RpoDigest}, - BTreeSet, ByteReader, ByteWriter, CodeBlock, Deserializable, DeserializationError, LabelError, - LibraryPath, Serializable, String, ToString, PROCEDURE_LABEL_PARSER, + ByteReader, ByteWriter, CodeBlock, Deserializable, DeserializationError, LabelError, + LibraryPath, Serializable, PROCEDURE_LABEL_PARSER, }; +use crate::utils::{collections::*, string::*}; use core::{ fmt, ops::{self, Deref}, diff --git a/assembly/src/tokens/lines.rs b/assembly/src/tokens/lines.rs index 58ce722ba9..16d5b2083e 100644 --- a/assembly/src/tokens/lines.rs +++ b/assembly/src/tokens/lines.rs @@ -1,4 +1,5 @@ -use super::{SourceLocation, Token, Vec}; +use super::{SourceLocation, Token}; +use crate::utils::collections::*; use core::{iter, str::Lines}; // LINES STREAM diff --git a/assembly/src/tokens/mod.rs b/assembly/src/tokens/mod.rs index fa21be6c89..4534cb0bbf 100644 --- a/assembly/src/tokens/mod.rs +++ b/assembly/src/tokens/mod.rs @@ -1,8 +1,9 @@ use super::{ ast::{parse_param_with_constant_lookup, InvocationTarget}, - BTreeMap, ByteReader, ByteWriter, Deserializable, DeserializationError, LibraryPath, - ParsingError, ProcedureName, Serializable, String, ToString, Vec, + ByteReader, ByteWriter, Deserializable, DeserializationError, LibraryPath, ParsingError, + ProcedureName, Serializable, }; +use crate::utils::{collections::*, string::*}; use core::fmt; mod lines; diff --git a/assembly/src/tokens/stream.rs b/assembly/src/tokens/stream.rs index 795b21770f..0d81227807 100644 --- a/assembly/src/tokens/stream.rs +++ b/assembly/src/tokens/stream.rs @@ -1,6 +1,5 @@ -use super::{ - BTreeMap, LineTokenizer, LinesStream, ParsingError, SourceLocation, String, Token, Vec, -}; +use super::{LineTokenizer, LinesStream, ParsingError, SourceLocation, Token}; +use crate::utils::{collections::*, string::*}; use core::fmt; // TOKEN STREAM diff --git a/core/src/errors.rs b/core/src/errors.rs index 3936acc623..7ab73b9b13 100644 --- a/core/src/errors.rs +++ b/core/src/errors.rs @@ -1,5 +1,5 @@ +use crate::utils::string::*; use core::fmt; -use winter_utils::string::String; // INPUT ERROR // ================================================================================================ diff --git a/core/src/operations/decorators/assembly_op.rs b/core/src/operations/decorators/assembly_op.rs index 1ade86fb22..b18b893787 100644 --- a/core/src/operations/decorators/assembly_op.rs +++ b/core/src/operations/decorators/assembly_op.rs @@ -1,4 +1,4 @@ -use crate::utils::string::String; +use crate::utils::string::*; use core::fmt; // ASSEMBLY OP diff --git a/core/src/operations/decorators/mod.rs b/core/src/operations/decorators/mod.rs index 432bdd2992..9fb653c32e 100644 --- a/core/src/operations/decorators/mod.rs +++ b/core/src/operations/decorators/mod.rs @@ -1,4 +1,4 @@ -use crate::utils::collections::Vec; +use crate::utils::collections::*; use core::fmt; mod advice; diff --git a/core/src/program/blocks/join_block.rs b/core/src/program/blocks/join_block.rs index 03269f6de6..711b10d481 100644 --- a/core/src/program/blocks/join_block.rs +++ b/core/src/program/blocks/join_block.rs @@ -1,4 +1,5 @@ -use super::{fmt, hasher, Box, CodeBlock, Digest, Felt, Operation}; +use super::{fmt, hasher, CodeBlock, Digest, Felt, Operation}; +use crate::utils::boxed::*; // JOIN BLOCKS // ================================================================================================ diff --git a/core/src/program/blocks/loop_block.rs b/core/src/program/blocks/loop_block.rs index 572f33f817..eb68df6324 100644 --- a/core/src/program/blocks/loop_block.rs +++ b/core/src/program/blocks/loop_block.rs @@ -1,4 +1,5 @@ -use super::{fmt, hasher, Box, CodeBlock, Digest, Felt, Operation}; +use super::{fmt, hasher, CodeBlock, Digest, Felt, Operation}; +use crate::utils::boxed::*; // LOOP BLOCK // ================================================================================================ diff --git a/core/src/program/blocks/mod.rs b/core/src/program/blocks/mod.rs index 7fc2074dd9..1fc7328600 100644 --- a/core/src/program/blocks/mod.rs +++ b/core/src/program/blocks/mod.rs @@ -1,4 +1,5 @@ -use super::{hasher, Box, Digest, Felt, Operation, Vec}; +use super::{hasher, Digest, Felt, Operation}; +use crate::utils::collections::*; use crate::DecoratorList; use core::fmt; diff --git a/core/src/program/blocks/span_block.rs b/core/src/program/blocks/span_block.rs index 80bc3a2c3d..8ba4a8c74b 100644 --- a/core/src/program/blocks/span_block.rs +++ b/core/src/program/blocks/span_block.rs @@ -1,5 +1,5 @@ -use super::{fmt, hasher, Digest, Felt, Operation, Vec}; -use crate::{DecoratorIterator, DecoratorList, ZERO}; +use super::{fmt, hasher, Digest, Felt, Operation}; +use crate::{utils::collections::*, DecoratorIterator, DecoratorList, ZERO}; use winter_utils::flatten_slice_elements; // CONSTANTS diff --git a/core/src/program/blocks/split_block.rs b/core/src/program/blocks/split_block.rs index 59f041a685..91c4e36f54 100644 --- a/core/src/program/blocks/split_block.rs +++ b/core/src/program/blocks/split_block.rs @@ -1,4 +1,5 @@ -use super::{fmt, hasher, Box, CodeBlock, Digest, Felt, Operation}; +use super::{fmt, hasher, CodeBlock, Digest, Felt, Operation}; +use crate::utils::boxed::*; // SPLIT BLOCK // ================================================================================================ diff --git a/core/src/program/info.rs b/core/src/program/info.rs index 3b27fbdb69..b51f6405de 100644 --- a/core/src/program/info.rs +++ b/core/src/program/info.rs @@ -1,8 +1,9 @@ use super::{ super::{ToElements, WORD_SIZE}, ByteReader, ByteWriter, Deserializable, DeserializationError, Digest, Felt, Kernel, Program, - Serializable, Vec, + Serializable, }; +use crate::utils::collections::*; // PROGRAM INFO // ================================================================================================ diff --git a/core/src/program/mod.rs b/core/src/program/mod.rs index 92cff20591..5e5f2ef88d 100644 --- a/core/src/program/mod.rs +++ b/core/src/program/mod.rs @@ -1,14 +1,11 @@ use super::{ chiplets::hasher::{self, Digest}, - errors, - utils::{ - collections::{BTreeMap, Vec}, - Box, - }, - Felt, Operation, + errors, Felt, Operation, +}; +use crate::utils::{ + collections::*, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, }; use core::fmt; -use winter_utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable}; pub mod blocks; use blocks::CodeBlock; diff --git a/core/src/stack/inputs.rs b/core/src/stack/inputs.rs index ccd33a640c..fdfc0ce2ef 100644 --- a/core/src/stack/inputs.rs +++ b/core/src/stack/inputs.rs @@ -1,6 +1,6 @@ -use winter_utils::{ByteReader, Deserializable, DeserializationError}; +use crate::utils::{collections::*, ByteReader, Deserializable, DeserializationError}; -use super::{vec, ByteWriter, Felt, InputError, Serializable, ToElements, Vec}; +use super::{ByteWriter, Felt, InputError, Serializable, ToElements}; use core::slice; // STACK INPUTS diff --git a/core/src/stack/mod.rs b/core/src/stack/mod.rs index 56d3147005..7d73207d9d 100644 --- a/core/src/stack/mod.rs +++ b/core/src/stack/mod.rs @@ -2,10 +2,7 @@ use super::{ errors::{InputError, OutputError}, Felt, StackTopState, StarkField, ToElements, }; -use winter_utils::{ - collections::{vec, Vec}, - ByteWriter, Serializable, -}; +use crate::utils::{ByteWriter, Serializable}; mod inputs; pub use inputs::StackInputs; diff --git a/core/src/stack/outputs.rs b/core/src/stack/outputs.rs index 492e18cf4f..a69a1f328e 100644 --- a/core/src/stack/outputs.rs +++ b/core/src/stack/outputs.rs @@ -1,10 +1,8 @@ +use crate::utils::{collections::*, range, ByteReader, Deserializable, DeserializationError}; use miden_crypto::Word; -use winter_utils::{ByteReader, Deserializable, DeserializationError}; - -use crate::utils::range; use super::{ - ByteWriter, Felt, OutputError, Serializable, StackTopState, StarkField, ToElements, Vec, + ByteWriter, Felt, OutputError, Serializable, StackTopState, StarkField, ToElements, STACK_TOP_SIZE, }; diff --git a/core/src/utils/mod.rs b/core/src/utils/mod.rs index f032f669dd..c90ceb8cd1 100644 --- a/core/src/utils/mod.rs +++ b/core/src/utils/mod.rs @@ -1,20 +1,19 @@ -use super::Felt; -use core::fmt::{self, Write}; +use crate::Felt; use core::{ - fmt::Debug, + fmt::{self, Debug, Write}, ops::{Bound, Range}, }; -use winter_utils::{collections::Vec, string::String}; +use {collections::*, string::*}; // RE-EXPORTS // ================================================================================================ -pub use winter_utils::{ - group_slice_elements, group_vector_elements, string, uninit_vector, Box, ByteReader, - ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader, -}; +pub use winter_utils::{group_slice_elements, group_vector_elements}; -pub use miden_crypto::utils::{collections, vec}; +pub use miden_crypto::utils::{ + boxed, collections, string, uninit_vector, vec, Box, ByteReader, ByteWriter, Deserializable, + DeserializationError, Serializable, SliceReader, +}; pub mod math { pub use math::{batch_inversion, log2}; diff --git a/miden/benches/program_compilation.rs b/miden/benches/program_compilation.rs index 5f7fafc9a8..da2bec96b9 100644 --- a/miden/benches/program_compilation.rs +++ b/miden/benches/program_compilation.rs @@ -1,4 +1,4 @@ -use assembly::{self, Assembler}; +use assembly::Assembler; use criterion::{criterion_group, criterion_main, Criterion}; use std::time::Duration; use stdlib::StdLibrary; diff --git a/miden/src/cli/data.rs b/miden/src/cli/data.rs index 0a81b13596..80ebc3a373 100644 --- a/miden/src/cli/data.rs +++ b/miden/src/cli/data.rs @@ -581,7 +581,7 @@ mod test { } ] }"; - let inputs: InputFile = serde_json::from_str(&program_with_pmt).unwrap(); + let inputs: InputFile = serde_json::from_str(program_with_pmt).unwrap(); let merkle_store = inputs.parse_merkle_store().unwrap(); assert!(merkle_store.is_some()); @@ -607,7 +607,7 @@ mod test { } ] }"; - let inputs: InputFile = serde_json::from_str(&program_with_smt).unwrap(); + let inputs: InputFile = serde_json::from_str(program_with_smt).unwrap(); let merkle_store = inputs.parse_merkle_store().unwrap(); assert!(merkle_store.is_some()); @@ -625,7 +625,7 @@ mod test { } ] }"; - let inputs: InputFile = serde_json::from_str(&program_with_merkle_tree).unwrap(); + let inputs: InputFile = serde_json::from_str(program_with_merkle_tree).unwrap(); let merkle_store = inputs.parse_merkle_store().unwrap(); assert!(merkle_store.is_some()); } diff --git a/miden/src/cli/prove.rs b/miden/src/cli/prove.rs index 1455d1b88d..fbcc138d95 100644 --- a/miden/src/cli/prove.rs +++ b/miden/src/cli/prove.rs @@ -70,7 +70,7 @@ impl ProveCmd { println!("Prove program: {}", self.assembly_file.display()); println!("-------------------------------------------------------------------------------"); - let (program, input_data) = load_data(&self)?; + let (program, input_data) = load_data(self)?; let program_hash: [u8; 32] = program.hash().into(); println!("Proving program with hash {}...", hex::encode(program_hash)); diff --git a/miden/src/cli/run.rs b/miden/src/cli/run.rs index 230e9c5c0f..b9e0243436 100644 --- a/miden/src/cli/run.rs +++ b/miden/src/cli/run.rs @@ -47,7 +47,7 @@ impl RunCmd { let now = Instant::now(); - let (trace, program_hash) = run_program(&self)?; + let (trace, program_hash) = run_program(self)?; println!( "Executed the program with hash {} in {} ms", diff --git a/miden/src/examples/blake3.rs b/miden/src/examples/blake3.rs index a1c79e0326..5dac76c870 100644 --- a/miden/src/examples/blake3.rs +++ b/miden/src/examples/blake3.rs @@ -47,7 +47,7 @@ fn generate_blake3_program(n: usize) -> Program { Assembler::default() .with_library(&StdLibrary::default()) .unwrap() - .compile(&program) + .compile(program) .unwrap() } diff --git a/miden/src/examples/fibonacci.rs b/miden/src/examples/fibonacci.rs index bf8c5c3962..c5d7e2b82d 100644 --- a/miden/src/examples/fibonacci.rs +++ b/miden/src/examples/fibonacci.rs @@ -39,7 +39,7 @@ fn generate_fibonacci_program(n: usize) -> Program { n - 1 ); - Assembler::default().compile(&program).unwrap() + Assembler::default().compile(program).unwrap() } /// Computes the `n`-th term of Fibonacci sequence diff --git a/miden/src/repl/mod.rs b/miden/src/repl/mod.rs index 86c8647dc8..5b4245b3e2 100644 --- a/miden/src/repl/mod.rs +++ b/miden/src/repl/mod.rs @@ -182,7 +182,7 @@ pub fn start_repl(library_paths: &Vec, use_stdlib: bool) { memory = mem; } Err(e) => { - println!("{}", format!("Error running program: {:?}", e)); + println!("Error running program: {:?}", e); program_lines.pop(); } } @@ -201,7 +201,7 @@ pub fn start_repl(library_paths: &Vec, use_stdlib: bool) { should_print_stack = false; } else if line == "!mem" { should_print_stack = false; - if memory.len() == 0 { + if memory.is_empty() { println!("The memory has not been initialized yet"); continue; } @@ -284,13 +284,13 @@ pub fn start_repl(library_paths: &Vec, use_stdlib: bool) { /// Processor to be executed. fn execute( program: String, - provided_libraries: &Vec, + provided_libraries: &[MaslLibrary], ) -> Result<(Vec<(u64, Word)>, Vec), String> { // compile program let mut assembler = Assembler::default(); assembler = assembler - .with_libraries(provided_libraries.clone().into_iter()) + .with_libraries(provided_libraries.iter()) .map_err(|err| format!("{err}"))?; let program = assembler.compile(program).map_err(|err| format!("{err}"))?; diff --git a/miden/src/tools/mod.rs b/miden/src/tools/mod.rs index 9e9a766293..0441ce67fb 100644 --- a/miden/src/tools/mod.rs +++ b/miden/src/tools/mod.rs @@ -1,7 +1,7 @@ use super::{cli::InputFile, ProgramError}; use clap::Parser; use core::fmt; -use miden::{utils::collections::Vec, Assembler, DefaultHost, Host, Operation, StackInputs}; +use miden::{utils::collections::*, Assembler, DefaultHost, Host, Operation, StackInputs}; use processor::{AsmOpInfo, TraceLenSummary}; use std::{fs, path::PathBuf}; use stdlib::StdLibrary; diff --git a/miden/tests/integration/air/chiplets/hasher.rs b/miden/tests/integration/air/chiplets/hasher.rs index 37cc8ae249..6c9e71e32c 100644 --- a/miden/tests/integration/air/chiplets/hasher.rs +++ b/miden/tests/integration/air/chiplets/hasher.rs @@ -86,7 +86,7 @@ fn mtree_merge() { let tree_b = MerkleTree::new(leaves_b.clone()).unwrap(); let root_a = tree_a.root(); let root_b = tree_b.root(); - let root_merged = Rpo256::merge(&[root_a.into(), root_b.into()]); + let root_merged = Rpo256::merge(&[root_a, root_b]); let mut store = MerkleStore::default(); store.extend(tree_a.inner_nodes()); store.extend(tree_b.inner_nodes()); diff --git a/processor/src/chiplets/aux_trace/mod.rs b/processor/src/chiplets/aux_trace/mod.rs index 7d908c5a42..7292da2c19 100644 --- a/processor/src/chiplets/aux_trace/mod.rs +++ b/processor/src/chiplets/aux_trace/mod.rs @@ -1,4 +1,5 @@ -use super::{super::trace::AuxColumnBuilder, Felt, FieldElement, Vec}; +use super::{super::trace::AuxColumnBuilder, Felt, FieldElement}; +use crate::utils::collections::*; use miden_air::trace::{ chiplets::{ diff --git a/processor/src/chiplets/bitwise/mod.rs b/processor/src/chiplets/bitwise/mod.rs index deca49e45d..bdf18f5c52 100644 --- a/processor/src/chiplets/bitwise/mod.rs +++ b/processor/src/chiplets/bitwise/mod.rs @@ -1,4 +1,5 @@ -use super::{utils::get_trace_len, ExecutionError, Felt, TraceFragment, Vec, ZERO}; +use super::{utils::get_trace_len, ExecutionError, Felt, TraceFragment, ZERO}; +use crate::utils::collections::*; use miden_air::trace::chiplets::bitwise::{ A_COL_IDX, A_COL_RANGE, BITWISE_AND, BITWISE_XOR, B_COL_IDX, B_COL_RANGE, OUTPUT_COL_IDX, PREV_OUTPUT_COL_IDX, TRACE_WIDTH, diff --git a/processor/src/chiplets/bitwise/tests.rs b/processor/src/chiplets/bitwise/tests.rs index 136db60674..1ea5e89df1 100644 --- a/processor/src/chiplets/bitwise/tests.rs +++ b/processor/src/chiplets/bitwise/tests.rs @@ -1,10 +1,10 @@ -use super::{Bitwise, Felt, TraceFragment, Vec}; +use super::{Bitwise, Felt, TraceFragment}; use miden_air::trace::chiplets::bitwise::{ A_COL_IDX, A_COL_RANGE, BITWISE_AND, BITWISE_XOR, B_COL_IDX, B_COL_RANGE, OP_CYCLE_LEN, OUTPUT_COL_IDX, PREV_OUTPUT_COL_IDX, TRACE_WIDTH, }; use test_utils::rand::rand_value; -use vm_core::ZERO; +use vm_core::{utils::collections::*, ZERO}; #[test] fn bitwise_init() { diff --git a/processor/src/chiplets/hasher/mod.rs b/processor/src/chiplets/hasher/mod.rs index efb109982e..cdcf7e2e84 100644 --- a/processor/src/chiplets/hasher/mod.rs +++ b/processor/src/chiplets/hasher/mod.rs @@ -1,6 +1,6 @@ use super::{ - BTreeMap, Felt, HasherState, MerklePath, MerkleRootUpdate, OpBatch, TraceFragment, Vec, Word, - ONE, ZERO, + BTreeMap, Felt, HasherState, MerklePath, MerkleRootUpdate, OpBatch, TraceFragment, Word, ONE, + ZERO, }; use miden_air::trace::chiplets::hasher::{ Digest, Selectors, DIGEST_LEN, DIGEST_RANGE, LINEAR_HASH, MP_VERIFY, MR_UPDATE_NEW, diff --git a/processor/src/chiplets/hasher/tests.rs b/processor/src/chiplets/hasher/tests.rs index 084a1837e3..b595a5474b 100644 --- a/processor/src/chiplets/hasher/tests.rs +++ b/processor/src/chiplets/hasher/tests.rs @@ -1,8 +1,9 @@ use super::{ init_state_from_words, Digest, Felt, Hasher, HasherState, MerklePath, Selectors, TraceFragment, - Vec, Word, LINEAR_HASH, MP_VERIFY, MR_UPDATE_NEW, MR_UPDATE_OLD, RETURN_HASH, RETURN_STATE, + Word, LINEAR_HASH, MP_VERIFY, MR_UPDATE_NEW, MR_UPDATE_OLD, RETURN_HASH, RETURN_STATE, TRACE_WIDTH, }; +use crate::utils::collections::*; use miden_air::trace::chiplets::hasher::{ DIGEST_LEN, HASH_CYCLE_LEN, NUM_ROUNDS, NUM_SELECTORS, STATE_COL_RANGE, diff --git a/processor/src/chiplets/hasher/trace.rs b/processor/src/chiplets/hasher/trace.rs index 2efa840104..e19174907a 100644 --- a/processor/src/chiplets/hasher/trace.rs +++ b/processor/src/chiplets/hasher/trace.rs @@ -1,4 +1,5 @@ -use super::{Felt, HasherState, Selectors, TraceFragment, Vec, STATE_WIDTH, TRACE_WIDTH, ZERO}; +use super::{Felt, HasherState, Selectors, TraceFragment, STATE_WIDTH, TRACE_WIDTH, ZERO}; +use crate::utils::collections::*; use core::ops::Range; use miden_air::trace::chiplets::hasher::NUM_ROUNDS; use vm_core::chiplets::hasher::apply_round; diff --git a/processor/src/chiplets/kernel_rom/tests.rs b/processor/src/chiplets/kernel_rom/tests.rs index cf7f7d515c..a2cf510b60 100644 --- a/processor/src/chiplets/kernel_rom/tests.rs +++ b/processor/src/chiplets/kernel_rom/tests.rs @@ -1,5 +1,5 @@ use super::{Felt, Kernel, KernelRom, TraceFragment, Word, ONE, TRACE_WIDTH, ZERO}; -use vm_core::utils::collections::Vec; +use vm_core::utils::collections::*; // CONSTANTS // ================================================================================================ diff --git a/processor/src/chiplets/memory/mod.rs b/processor/src/chiplets/memory/mod.rs index dacd620c0d..a2a522b44e 100644 --- a/processor/src/chiplets/memory/mod.rs +++ b/processor/src/chiplets/memory/mod.rs @@ -1,8 +1,8 @@ use super::{ utils::{split_element_u32_into_u16, split_u32_into_u16}, - BTreeMap, Felt, FieldElement, RangeChecker, TraceFragment, Vec, Word, EMPTY_WORD, ONE, + Felt, FieldElement, RangeChecker, TraceFragment, Word, EMPTY_WORD, ONE, }; -use crate::system::ContextId; +use crate::{system::ContextId, utils::collections::*}; use miden_air::trace::chiplets::memory::{ ADDR_COL_IDX, CLK_COL_IDX, CTX_COL_IDX, D0_COL_IDX, D1_COL_IDX, D_INV_COL_IDX, V_COL_RANGE, }; diff --git a/processor/src/chiplets/memory/segment.rs b/processor/src/chiplets/memory/segment.rs index 9b416870ad..e6ee97210c 100644 --- a/processor/src/chiplets/memory/segment.rs +++ b/processor/src/chiplets/memory/segment.rs @@ -2,7 +2,8 @@ use miden_air::trace::chiplets::memory::{ Selectors, MEMORY_COPY_READ, MEMORY_INIT_READ, MEMORY_WRITE, }; -use super::{BTreeMap, Felt, Vec, Word, INIT_MEM_VALUE}; +use super::{Felt, Word, INIT_MEM_VALUE}; +use crate::utils::collections::*; // MEMORY SEGMENT TRACE // ================================================================================================ diff --git a/processor/src/chiplets/memory/tests.rs b/processor/src/chiplets/memory/tests.rs index 9773e1b010..ebb98db017 100644 --- a/processor/src/chiplets/memory/tests.rs +++ b/processor/src/chiplets/memory/tests.rs @@ -1,13 +1,12 @@ -use crate::ContextId; - use super::{ - super::ZERO, Felt, FieldElement, Memory, TraceFragment, Vec, ADDR_COL_IDX, CLK_COL_IDX, - CTX_COL_IDX, D0_COL_IDX, D1_COL_IDX, D_INV_COL_IDX, EMPTY_WORD, ONE, V_COL_RANGE, + super::ZERO, Felt, FieldElement, Memory, TraceFragment, ADDR_COL_IDX, CLK_COL_IDX, CTX_COL_IDX, + D0_COL_IDX, D1_COL_IDX, D_INV_COL_IDX, EMPTY_WORD, ONE, V_COL_RANGE, }; +use crate::ContextId; use miden_air::trace::chiplets::memory::{ Selectors, MEMORY_COPY_READ, MEMORY_INIT_READ, MEMORY_WRITE, TRACE_WIDTH as MEMORY_TRACE_WIDTH, }; -use vm_core::Word; +use vm_core::{utils::collections::*, Word}; #[test] fn mem_init() { diff --git a/processor/src/chiplets/mod.rs b/processor/src/chiplets/mod.rs index 142a842c5d..74654a81a5 100644 --- a/processor/src/chiplets/mod.rs +++ b/processor/src/chiplets/mod.rs @@ -1,9 +1,10 @@ use crate::system::ContextId; use super::{ - crypto::MerklePath, utils, BTreeMap, ChipletsTrace, ExecutionError, Felt, FieldElement, - RangeChecker, TraceFragment, Vec, Word, CHIPLETS_WIDTH, EMPTY_WORD, ONE, ZERO, + crypto::MerklePath, utils, ChipletsTrace, ExecutionError, Felt, FieldElement, RangeChecker, + TraceFragment, Word, CHIPLETS_WIDTH, EMPTY_WORD, ONE, ZERO, }; +use crate::utils::collections::*; use miden_air::trace::chiplets::hasher::{Digest, HasherState}; use vm_core::{code_blocks::OpBatch, Kernel}; diff --git a/processor/src/chiplets/tests.rs b/processor/src/chiplets/tests.rs index 37fda7e045..7bbb683f5b 100644 --- a/processor/src/chiplets/tests.rs +++ b/processor/src/chiplets/tests.rs @@ -1,6 +1,6 @@ use crate::{ - CodeBlock, DefaultHost, ExecutionOptions, ExecutionTrace, Kernel, Operation, Process, - StackInputs, Vec, + utils::collections::*, CodeBlock, DefaultHost, ExecutionOptions, ExecutionTrace, Kernel, + Operation, Process, StackInputs, }; use miden_air::trace::{ chiplets::{ diff --git a/processor/src/debug.rs b/processor/src/debug.rs index e929d09379..48df4dfde8 100644 --- a/processor/src/debug.rs +++ b/processor/src/debug.rs @@ -1,12 +1,12 @@ use crate::{ - range::RangeChecker, system::ContextId, Chiplets, ChipletsLengths, Decoder, ExecutionError, - Felt, Host, Process, Stack, System, TraceLenSummary, Vec, + range::RangeChecker, + system::ContextId, + utils::{collections::*, string::*}, + Chiplets, ChipletsLengths, Decoder, ExecutionError, Felt, Host, Process, Stack, System, + TraceLenSummary, }; use core::fmt; -use vm_core::{ - utils::string::{String, ToString}, - AssemblyOp, Operation, StackOutputs, Word, -}; +use vm_core::{AssemblyOp, Operation, StackOutputs, Word}; /// VmState holds a current process state information at a specific clock cycle. #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/processor/src/decoder/aux_trace/mod.rs b/processor/src/decoder/aux_trace/mod.rs index 0da1797359..8b083f99ba 100644 --- a/processor/src/decoder/aux_trace/mod.rs +++ b/processor/src/decoder/aux_trace/mod.rs @@ -1,5 +1,5 @@ -use super::{Felt, Vec, ONE, ZERO}; -use crate::trace::AuxColumnBuilder; +use super::{Felt, ONE, ZERO}; +use crate::{trace::AuxColumnBuilder, utils::collections::*}; use miden_air::trace::main_trace::MainTrace; use vm_core::{FieldElement, Operation}; diff --git a/processor/src/decoder/block_stack.rs b/processor/src/decoder/block_stack.rs index 8d9bc0e294..c478829694 100644 --- a/processor/src/decoder/block_stack.rs +++ b/processor/src/decoder/block_stack.rs @@ -1,5 +1,5 @@ -use super::{Felt, Vec, Word, ONE, ZERO}; -use crate::system::ContextId; +use super::{Felt, Word, ONE, ZERO}; +use crate::{system::ContextId, utils::collections::*}; // BLOCK STACK // ================================================================================================ diff --git a/processor/src/decoder/mod.rs b/processor/src/decoder/mod.rs index ff22372762..7b012d27d4 100644 --- a/processor/src/decoder/mod.rs +++ b/processor/src/decoder/mod.rs @@ -1,7 +1,8 @@ use super::{ Call, Dyn, ExecutionError, Felt, Host, Join, Loop, OpBatch, Operation, Process, Span, Split, - Vec, Word, EMPTY_WORD, MIN_TRACE_LEN, ONE, OP_BATCH_SIZE, ZERO, + Word, EMPTY_WORD, MIN_TRACE_LEN, ONE, OP_BATCH_SIZE, ZERO, }; +use crate::utils::collections::*; use miden_air::trace::{ chiplets::hasher::DIGEST_LEN, decoder::{ diff --git a/processor/src/decoder/tests.rs b/processor/src/decoder/tests.rs index 94b0fd13f9..c0897cfd58 100644 --- a/processor/src/decoder/tests.rs +++ b/processor/src/decoder/tests.rs @@ -18,7 +18,7 @@ use miden_air::trace::{ use test_utils::rand::rand_value; use vm_core::{ code_blocks::{CodeBlock, Span, OP_BATCH_SIZE}, - utils::collections::Vec, + utils::collections::*, CodeBlockTable, EMPTY_WORD, ONE, ZERO, }; diff --git a/processor/src/decoder/trace.rs b/processor/src/decoder/trace.rs index 9164dc07d8..59d0f4c9c5 100644 --- a/processor/src/decoder/trace.rs +++ b/processor/src/decoder/trace.rs @@ -1,9 +1,10 @@ use super::{ - super::utils::get_trace_len, get_num_groups_in_next_batch, Felt, Operation, Vec, Word, - DIGEST_LEN, MIN_TRACE_LEN, NUM_HASHER_COLUMNS, NUM_OP_BATCH_FLAGS, NUM_OP_BITS, - NUM_OP_BITS_EXTRA_COLS, ONE, OP_BATCH_1_GROUPS, OP_BATCH_2_GROUPS, OP_BATCH_4_GROUPS, - OP_BATCH_8_GROUPS, OP_BATCH_SIZE, ZERO, + super::utils::get_trace_len, get_num_groups_in_next_batch, Felt, Operation, Word, DIGEST_LEN, + MIN_TRACE_LEN, NUM_HASHER_COLUMNS, NUM_OP_BATCH_FLAGS, NUM_OP_BITS, NUM_OP_BITS_EXTRA_COLS, + ONE, OP_BATCH_1_GROUPS, OP_BATCH_2_GROUPS, OP_BATCH_4_GROUPS, OP_BATCH_8_GROUPS, OP_BATCH_SIZE, + ZERO, }; +use crate::utils::collections::*; use core::ops::Range; use vm_core::utils::new_array_vec; diff --git a/processor/src/errors.rs b/processor/src/errors.rs index 4f10550f47..71f29e7622 100644 --- a/processor/src/errors.rs +++ b/processor/src/errors.rs @@ -3,11 +3,9 @@ use super::{ system::{FMP_MAX, FMP_MIN}, CodeBlock, Digest, Felt, QuadFelt, Word, }; +use crate::utils::string::*; use core::fmt::{Display, Formatter}; -use vm_core::{ - stack::STACK_TOP_SIZE, - utils::{string::String, to_hex}, -}; +use vm_core::{stack::STACK_TOP_SIZE, utils::to_hex}; use winter_prover::{math::FieldElement, ProverError}; #[cfg(feature = "std")] diff --git a/processor/src/host/advice/injectors/adv_map_injectors.rs b/processor/src/host/advice/injectors/adv_map_injectors.rs index f9c4389c21..6f5d08a920 100644 --- a/processor/src/host/advice/injectors/adv_map_injectors.rs +++ b/processor/src/host/advice/injectors/adv_map_injectors.rs @@ -1,8 +1,7 @@ use super::super::{AdviceProvider, ExecutionError, Felt, HostResponse}; -use crate::ProcessState; +use crate::{utils::collections::*, ProcessState}; use vm_core::{ crypto::hash::{Rpo256, RpoDigest}, - utils::collections::Vec, EMPTY_WORD, WORD_SIZE, }; diff --git a/processor/src/host/advice/injectors/adv_stack_injectors.rs b/processor/src/host/advice/injectors/adv_stack_injectors.rs index b7049d3d74..5046149d82 100644 --- a/processor/src/host/advice/injectors/adv_stack_injectors.rs +++ b/processor/src/host/advice/injectors/adv_stack_injectors.rs @@ -1,5 +1,5 @@ use super::super::{AdviceSource, ExecutionError, Felt, HostResponse}; -use crate::{AdviceProvider, Ext2InttError, FieldElement, ProcessState, Vec}; +use crate::{utils::collections::*, AdviceProvider, Ext2InttError, FieldElement, ProcessState}; use vm_core::{QuadExtension, SignatureKind}; use winter_prover::math::fft; diff --git a/processor/src/host/advice/injectors/dsa.rs b/processor/src/host/advice/injectors/dsa.rs index 0680c690bc..64083cfa17 100644 --- a/processor/src/host/advice/injectors/dsa.rs +++ b/processor/src/host/advice/injectors/dsa.rs @@ -1,4 +1,5 @@ -use super::super::{ExecutionError, Felt, Vec, Word}; +use super::super::{ExecutionError, Felt, Word}; +use crate::utils::collections::*; use vm_core::{ crypto::dsa::rpo_falcon512::{KeyPair, Polynomial}, utils::Deserializable, diff --git a/processor/src/host/advice/injectors/smt.rs b/processor/src/host/advice/injectors/smt.rs index 8e4a123543..f7c96d7f62 100644 --- a/processor/src/host/advice/injectors/smt.rs +++ b/processor/src/host/advice/injectors/smt.rs @@ -1,11 +1,10 @@ use super::super::{AdviceSource, ExecutionError, Felt, HostResponse, Word}; -use crate::{AdviceProvider, ProcessState}; +use crate::{utils::collections::*, AdviceProvider, ProcessState}; use vm_core::{ crypto::{ hash::RpoDigest, merkle::{EmptySubtreeRoots, Smt, SMT_DEPTH}, }, - utils::collections::Vec, WORD_SIZE, }; diff --git a/processor/src/host/advice/inputs.rs b/processor/src/host/advice/inputs.rs index d1650bc6e0..c289222aae 100644 --- a/processor/src/host/advice/inputs.rs +++ b/processor/src/host/advice/inputs.rs @@ -1,6 +1,7 @@ use vm_core::crypto::hash::RpoDigest; -use super::{AdviceMap, Felt, InnerNodeInfo, InputError, MerkleStore, Vec}; +use super::{AdviceMap, Felt, InnerNodeInfo, InputError, MerkleStore}; +use crate::utils::collections::*; // ADVICE INPUTS // ================================================================================================ diff --git a/processor/src/host/advice/map.rs b/processor/src/host/advice/map.rs index 575e04be31..62a0b393ce 100644 --- a/processor/src/host/advice/map.rs +++ b/processor/src/host/advice/map.rs @@ -1,4 +1,5 @@ -use super::{BTreeMap, Felt, Vec}; +use super::Felt; +use crate::utils::collections::*; use vm_core::{crypto::hash::RpoDigest, utils::collections::btree_map::IntoIter}; // ADVICE MAP diff --git a/processor/src/host/advice/mod.rs b/processor/src/host/advice/mod.rs index 2e19ce713c..94c391b84a 100644 --- a/processor/src/host/advice/mod.rs +++ b/processor/src/host/advice/mod.rs @@ -6,7 +6,7 @@ use vm_core::{ hash::RpoDigest, merkle::{InnerNodeInfo, MerklePath, MerkleStore, NodeIndex, StoreNode}, }, - utils::collections::{BTreeMap, KvMap, RecordingMap, Vec}, + utils::collections::*, AdviceInjector, SignatureKind, }; diff --git a/processor/src/host/advice/providers.rs b/processor/src/host/advice/providers.rs index 9776d6487f..3088d90526 100644 --- a/processor/src/host/advice/providers.rs +++ b/processor/src/host/advice/providers.rs @@ -1,8 +1,8 @@ use super::{ - injectors, AdviceInputs, AdviceProvider, AdviceSource, BTreeMap, ExecutionError, Felt, KvMap, - MerklePath, MerkleStore, NodeIndex, RecordingMap, RpoDigest, StoreNode, Vec, Word, + injectors, AdviceInputs, AdviceProvider, AdviceSource, ExecutionError, Felt, MerklePath, + MerkleStore, NodeIndex, RpoDigest, StoreNode, Word, }; -use crate::ProcessState; +use crate::{utils::collections::*, ProcessState}; use vm_core::SignatureKind; // TYPE ALIASES diff --git a/processor/src/host/debug.rs b/processor/src/host/debug.rs index ef6949a0c3..1cd9810e13 100644 --- a/processor/src/host/debug.rs +++ b/processor/src/host/debug.rs @@ -1,5 +1,5 @@ use super::ProcessState; -use crate::{system::ContextId, Vec}; +use crate::{system::ContextId, utils::collections::*}; use vm_core::{DebugOptions, Word}; // DEBUG HANDLER diff --git a/processor/src/lib.rs b/processor/src/lib.rs index efa61695ad..ec5412c4a9 100644 --- a/processor/src/lib.rs +++ b/processor/src/lib.rs @@ -20,7 +20,7 @@ use vm_core::{ code_blocks::{ Call, CodeBlock, Dyn, Join, Loop, OpBatch, Span, Split, OP_BATCH_SIZE, OP_GROUP_SIZE, }, - utils::collections::{BTreeMap, Vec}, + utils::collections::*, CodeBlockTable, Decorator, DecoratorIterator, Felt, FieldElement, StackTopState, }; diff --git a/processor/src/operations/comb_ops.rs b/processor/src/operations/comb_ops.rs index 5b7b7abc13..f64b95e3f8 100644 --- a/processor/src/operations/comb_ops.rs +++ b/processor/src/operations/comb_ops.rs @@ -171,7 +171,7 @@ where #[cfg(test)] mod tests { - use crate::Vec; + use crate::utils::collections::*; use test_utils::{build_test, rand::rand_array}; use vm_core::{Felt, FieldElement, Operation, StackInputs, ONE, ZERO}; diff --git a/processor/src/operations/crypto_ops.rs b/processor/src/operations/crypto_ops.rs index 64332e5897..cec3477461 100644 --- a/processor/src/operations/crypto_ops.rs +++ b/processor/src/operations/crypto_ops.rs @@ -189,7 +189,7 @@ mod tests { use vm_core::{ chiplets::hasher::{apply_permutation, STATE_WIDTH}, crypto::merkle::{MerkleStore, MerkleTree, NodeIndex}, - utils::collections::Vec, + utils::collections::*, }; #[test] diff --git a/processor/src/operations/fri_ops.rs b/processor/src/operations/fri_ops.rs index c0beeafda4..32d7f58e0c 100644 --- a/processor/src/operations/fri_ops.rs +++ b/processor/src/operations/fri_ops.rs @@ -244,7 +244,7 @@ mod tests { ExtensionOf, Felt, FieldElement, Operation, Process, QuadFelt, StarkField, TWO, TWO_INV, }; use test_utils::rand::{rand_array, rand_value, rand_vector}; - use vm_core::{utils::collections::Vec, StackInputs}; + use vm_core::{utils::collections::*, StackInputs}; use winter_prover::math::{fft, get_power_series_with_offset}; use winter_utils::transpose_slice; diff --git a/processor/src/range/aux_trace.rs b/processor/src/range/aux_trace.rs index 7adbe810bf..cd93359f45 100644 --- a/processor/src/range/aux_trace.rs +++ b/processor/src/range/aux_trace.rs @@ -1,4 +1,5 @@ -use super::{uninit_vector, BTreeMap, Felt, FieldElement, Vec, NUM_RAND_ROWS}; +use super::{uninit_vector, Felt, FieldElement, NUM_RAND_ROWS}; +use crate::utils::collections::*; use miden_air::trace::main_trace::MainTrace; use miden_air::trace::range::{M_COL_IDX, V_COL_IDX}; diff --git a/processor/src/range/mod.rs b/processor/src/range/mod.rs index 10f6e2c12c..51f4a220cb 100644 --- a/processor/src/range/mod.rs +++ b/processor/src/range/mod.rs @@ -1,7 +1,5 @@ -use super::{ - trace::NUM_RAND_ROWS, utils::uninit_vector, BTreeMap, Felt, FieldElement, RangeCheckTrace, Vec, - ZERO, -}; +use super::{trace::NUM_RAND_ROWS, Felt, FieldElement, RangeCheckTrace, ZERO}; +use crate::utils::{collections::*, uninit_vector}; mod aux_trace; pub use aux_trace::AuxTraceBuilder; diff --git a/processor/src/range/tests.rs b/processor/src/range/tests.rs index e6d8b4cd79..650ff58c03 100644 --- a/processor/src/range/tests.rs +++ b/processor/src/range/tests.rs @@ -1,7 +1,7 @@ -use super::{BTreeMap, Felt, RangeChecker, Vec, ZERO}; +use super::{Felt, RangeChecker, ZERO}; use crate::{utils::get_trace_len, RangeCheckTrace}; use test_utils::rand::rand_array; -use vm_core::utils::ToElements; +use vm_core::utils::{collections::*, ToElements}; #[test] fn range_checks() { diff --git a/processor/src/stack/aux_trace.rs b/processor/src/stack/aux_trace.rs index a33ab87a58..325a642227 100644 --- a/processor/src/stack/aux_trace.rs +++ b/processor/src/stack/aux_trace.rs @@ -1,6 +1,5 @@ -use crate::trace::AuxColumnBuilder; - -use super::{Felt, FieldElement, OverflowTableRow, Vec}; +use super::{Felt, FieldElement, OverflowTableRow}; +use crate::{trace::AuxColumnBuilder, utils::collections::*}; use miden_air::trace::main_trace::MainTrace; // AUXILIARY TRACE BUILDER diff --git a/processor/src/stack/mod.rs b/processor/src/stack/mod.rs index f62bef5aac..8027c21b3f 100644 --- a/processor/src/stack/mod.rs +++ b/processor/src/stack/mod.rs @@ -1,6 +1,5 @@ -use super::{ - BTreeMap, Felt, FieldElement, StackInputs, StackOutputs, Vec, ONE, STACK_TRACE_WIDTH, ZERO, -}; +use super::{Felt, FieldElement, StackInputs, StackOutputs, ONE, STACK_TRACE_WIDTH, ZERO}; +use crate::utils::collections::*; use core::cmp; use vm_core::{stack::STACK_TOP_SIZE, Word, WORD_SIZE}; diff --git a/processor/src/stack/overflow.rs b/processor/src/stack/overflow.rs index 8d73a06703..96be4bf725 100644 --- a/processor/src/stack/overflow.rs +++ b/processor/src/stack/overflow.rs @@ -1,4 +1,5 @@ -use super::{AuxTraceBuilder, BTreeMap, Felt, FieldElement, Vec, ZERO}; +use super::{AuxTraceBuilder, Felt, FieldElement, ZERO}; +use crate::utils::collections::*; use vm_core::{utils::uninit_vector, StarkField}; // OVERFLOW TABLE diff --git a/processor/src/stack/tests.rs b/processor/src/stack/tests.rs index 70e4411bd9..f12302fd5d 100644 --- a/processor/src/stack/tests.rs +++ b/processor/src/stack/tests.rs @@ -1,12 +1,11 @@ use super::{ - super::StackTopState, Felt, OverflowTableRow, Stack, StackInputs, Vec, ONE, STACK_TOP_SIZE, - ZERO, + super::StackTopState, Felt, OverflowTableRow, Stack, StackInputs, ONE, STACK_TOP_SIZE, ZERO, }; use miden_air::trace::{ stack::{B0_COL_IDX, B1_COL_IDX, H0_COL_IDX, NUM_STACK_HELPER_COLS}, STACK_TRACE_WIDTH, }; -use vm_core::{FieldElement, StarkField}; +use vm_core::{utils::collections::*, FieldElement, StarkField}; // TYPE ALIASES // ================================================================================================ diff --git a/processor/src/stack/trace.rs b/processor/src/stack/trace.rs index fef410fa5a..a4fbee690b 100644 --- a/processor/src/stack/trace.rs +++ b/processor/src/stack/trace.rs @@ -1,8 +1,8 @@ use super::{ - super::utils::get_trace_len, Felt, FieldElement, Vec, MAX_TOP_IDX, ONE, STACK_TRACE_WIDTH, ZERO, + super::utils::get_trace_len, Felt, FieldElement, MAX_TOP_IDX, ONE, STACK_TRACE_WIDTH, ZERO, }; +use crate::utils::{collections::*, math::batch_inversion}; use miden_air::trace::stack::{H0_COL_IDX, NUM_STACK_HELPER_COLS, STACK_TOP_SIZE}; -use vm_core::utils::math::batch_inversion; // STACK TRACE // ================================================================================================ diff --git a/processor/src/system/mod.rs b/processor/src/system/mod.rs index dfefdf7467..7c4cceb05c 100644 --- a/processor/src/system/mod.rs +++ b/processor/src/system/mod.rs @@ -1,4 +1,5 @@ -use super::{ExecutionError, Felt, FieldElement, SysTrace, Vec, Word, EMPTY_WORD, ONE, ZERO}; +use super::{ExecutionError, Felt, FieldElement, SysTrace, Word, EMPTY_WORD, ONE, ZERO}; +use crate::utils::collections::*; use core::fmt::{self, Display}; #[cfg(test)] diff --git a/processor/src/trace/mod.rs b/processor/src/trace/mod.rs index 3f88af2129..0124e41d9e 100644 --- a/processor/src/trace/mod.rs +++ b/processor/src/trace/mod.rs @@ -3,11 +3,12 @@ use super::{ decoder::AuxTraceBuilder as DecoderAuxTraceBuilder, range::AuxTraceBuilder as RangeCheckerAuxTraceBuilder, stack::AuxTraceBuilder as StackAuxTraceBuilder, ColMatrix, Digest, Felt, FieldElement, Host, - Process, StackTopState, Vec, + Process, StackTopState, }; -use miden_air::trace::main_trace::MainTrace; +use crate::utils::collections::*; use miden_air::trace::{ decoder::{NUM_USER_OP_HELPERS, USER_OP_HELPERS_OFFSET}, + main_trace::MainTrace, AUX_TRACE_RAND_ELEMENTS, AUX_TRACE_WIDTH, DECODER_TRACE_OFFSET, MIN_TRACE_LEN, STACK_TRACE_OFFSET, TRACE_WIDTH, }; diff --git a/processor/src/trace/tests/chiplets/hasher.rs b/processor/src/trace/tests/chiplets/hasher.rs index 4ec57b9619..65b8fc7595 100644 --- a/processor/src/trace/tests/chiplets/hasher.rs +++ b/processor/src/trace/tests/chiplets/hasher.rs @@ -22,7 +22,7 @@ use vm_core::{ chiplets::hasher::apply_permutation, code_blocks::CodeBlock, crypto::merkle::{MerkleStore, MerkleTree, NodeIndex}, - utils::{collections::Vec, range}, + utils::{collections::*, range}, Word, }; diff --git a/processor/src/trace/tests/hasher.rs b/processor/src/trace/tests/hasher.rs index 432033603b..af84f1c885 100644 --- a/processor/src/trace/tests/hasher.rs +++ b/processor/src/trace/tests/hasher.rs @@ -1,12 +1,12 @@ use super::{ super::{Trace, NUM_RAND_ROWS}, - build_trace_from_ops_with_inputs, rand_array, AdviceInputs, Felt, Operation, Vec, Word, ONE, - ZERO, + build_trace_from_ops_with_inputs, rand_array, AdviceInputs, Felt, Operation, Word, ONE, ZERO, }; -use crate::StackInputs; -use miden_air::trace::main_trace::MainTrace; -use miden_air::trace::{chiplets::hasher::P1_COL_IDX, AUX_TRACE_RAND_ELEMENTS}; +use crate::{utils::collections::*, StackInputs}; +use miden_air::trace::{ + chiplets::hasher::P1_COL_IDX, main_trace::MainTrace, AUX_TRACE_RAND_ELEMENTS, +}; use vm_core::{ crypto::merkle::{MerkleStore, MerkleTree, NodeIndex}, FieldElement, diff --git a/processor/src/trace/tests/mod.rs b/processor/src/trace/tests/mod.rs index ffae201c0c..70af6682ee 100644 --- a/processor/src/trace/tests/mod.rs +++ b/processor/src/trace/tests/mod.rs @@ -1,8 +1,11 @@ use super::{ super::chiplets::init_state_from_words, ExecutionTrace, Felt, FieldElement, Process, Trace, - Vec, NUM_RAND_ROWS, + NUM_RAND_ROWS, +}; +use crate::{ + utils::collections::*, AdviceInputs, DefaultHost, ExecutionOptions, MemAdviceProvider, + StackInputs, }; -use crate::{AdviceInputs, DefaultHost, ExecutionOptions, MemAdviceProvider, StackInputs}; use test_utils::rand::rand_array; use vm_core::{ code_blocks::CodeBlock, CodeBlockTable, Kernel, Operation, StackOutputs, Word, ONE, ZERO, diff --git a/processor/src/trace/tests/stack.rs b/processor/src/trace/tests/stack.rs index 7c65964480..ec32f2e3b1 100644 --- a/processor/src/trace/tests/stack.rs +++ b/processor/src/trace/tests/stack.rs @@ -1,8 +1,8 @@ use super::{ - build_trace_from_ops, rand_array, Felt, FieldElement, Operation, Trace, Vec, NUM_RAND_ROWS, - ONE, ZERO, + build_trace_from_ops, rand_array, Felt, FieldElement, Operation, Trace, NUM_RAND_ROWS, ONE, + ZERO, }; -use crate::stack::OverflowTableRow; +use crate::{stack::OverflowTableRow, utils::collections::*}; use miden_air::trace::{AUX_TRACE_RAND_ELEMENTS, STACK_AUX_TRACE_OFFSET}; // CONSTANTS diff --git a/processor/src/trace/utils.rs b/processor/src/trace/utils.rs index 6bd018f00f..848e63f8a5 100644 --- a/processor/src/trace/utils.rs +++ b/processor/src/trace/utils.rs @@ -1,8 +1,10 @@ -use super::{Felt, Vec, NUM_RAND_ROWS}; -use crate::chiplets::Chiplets; +use super::{Felt, FieldElement, NUM_RAND_ROWS}; +use crate::{ + chiplets::Chiplets, + utils::{collections::*, uninit_vector}, +}; use core::slice; use miden_air::trace::main_trace::MainTrace; -use vm_core::{utils::uninit_vector, FieldElement}; #[cfg(test)] use vm_core::{utils::ToElements, Operation}; diff --git a/processor/src/utils.rs b/processor/src/utils.rs index 9c490f1b4b..7c316a1699 100644 --- a/processor/src/utils.rs +++ b/processor/src/utils.rs @@ -1,4 +1,5 @@ -use super::{Felt, Vec}; +use super::Felt; +use collections::*; // RE-EXPORTS // ================================================================================================ diff --git a/stdlib/tests/collections/mmr.rs b/stdlib/tests/collections/mmr.rs index 7178d6aa76..cb7f8f34dc 100644 --- a/stdlib/tests/collections/mmr.rs +++ b/stdlib/tests/collections/mmr.rs @@ -1,5 +1,5 @@ use test_utils::{ - collections::Vec, + collections::*, crypto::{ init_merkle_leaf, init_merkle_leaves, MerkleError, MerkleStore, MerkleTree, Mmr, NodeIndex, RpoDigest, @@ -551,7 +551,7 @@ fn test_mmr_pack_roundtrip() { let hash = accumulator.hash_peaks(); // Set up the VM stack with the MMR hash, and its target address - let mut stack = stack_to_ints(&hash.as_elements()); + let mut stack = stack_to_ints(hash.as_elements()); let mmr_ptr = 1000; stack.insert(0, mmr_ptr); // first value is used by unpack, to load data to memory stack.insert(0, mmr_ptr); // second is used by pack, to load data from memory @@ -587,7 +587,7 @@ fn test_mmr_pack_roundtrip() { // first the number of leaves expect_memory.extend_from_slice(&[accumulator.num_leaves() as u64, 0, 0, 0]); // followed by the peaks - expect_memory.extend(digests_to_ints(&accumulator.peaks())); + expect_memory.extend(digests_to_ints(accumulator.peaks())); // followed by padding data let size = 4 + 16 * 4; expect_memory.resize(size, 0); @@ -724,7 +724,7 @@ fn test_mmr_large() { let num_leaves = accumulator.num_leaves() as u64; let mut expected_memory = vec![num_leaves, 0, 0, 0]; - expected_memory.extend(digests_to_ints(&accumulator.peaks())); + expected_memory.extend(digests_to_ints(accumulator.peaks())); let expect_stack: Vec = accumulator.hash_peaks().iter().rev().map(|v| v.as_int()).collect(); @@ -749,7 +749,7 @@ fn test_mmr_large_add_roundtrip() { let hash = old_accumulator.hash_peaks(); // Set up the VM stack with the MMR hash, and its target address - let mut stack = stack_to_ints(&hash.as_elements()); + let mut stack = stack_to_ints(hash.as_elements()); stack.insert(0, mmr_ptr as u64); // both the advice stack and merkle store start empty (data is available in diff --git a/stdlib/tests/crypto/blake3.rs b/stdlib/tests/crypto/blake3.rs index 2d23a38692..633d81610a 100644 --- a/stdlib/tests/crypto/blake3.rs +++ b/stdlib/tests/crypto/blake3.rs @@ -1,4 +1,3 @@ -use crate::build_test; use test_utils::{group_slice_elements, rand::rand_array, Felt, IntoBytes}; #[test] diff --git a/stdlib/tests/crypto/ecdsa_secp256k1.rs b/stdlib/tests/crypto/ecdsa_secp256k1.rs index efdfda11a9..32cf16f457 100644 --- a/stdlib/tests/crypto/ecdsa_secp256k1.rs +++ b/stdlib/tests/crypto/ecdsa_secp256k1.rs @@ -1,4 +1,3 @@ -use crate::build_test; use test_utils::test_case; // Wrapper types for ease of writing parameterized test cases diff --git a/stdlib/tests/crypto/elgamal.rs b/stdlib/tests/crypto/elgamal.rs index 8c4c22fabe..77d307b0d4 100644 --- a/stdlib/tests/crypto/elgamal.rs +++ b/stdlib/tests/crypto/elgamal.rs @@ -1,6 +1,4 @@ -use crate::build_test; -use crate::math::ecgfp5::base_field::Ext5; -use crate::math::ecgfp5::group::ECExt5; +use crate::math::ecgfp5::{base_field::Ext5, group::ECExt5}; use std::ops::Add; use test_utils::{rand::rand_array, Felt, FieldElement}; diff --git a/stdlib/tests/crypto/falcon.rs b/stdlib/tests/crypto/falcon.rs index 26fd9b3ccc..8ec911acc0 100644 --- a/stdlib/tests/crypto/falcon.rs +++ b/stdlib/tests/crypto/falcon.rs @@ -28,7 +28,7 @@ fn falcon_prove_verify() { let program = Assembler::default() .with_library(&StdLibrary::default()) .expect("failed to load stdlib") - .compile(&source) + .compile(source) .expect("failed to compile test source"); let stack_inputs = @@ -65,10 +65,10 @@ fn generate_test( let to_adv_map = pk_sk_bytes.iter().map(|a| Felt::new(*a as u64)).collect::>(); - let advice_map: Vec<(Digest, Vec)> = vec![(pk, to_adv_map.into())]; + let advice_map: Vec<(Digest, Vec)> = vec![(pk, to_adv_map)]; let mut op_stack = vec![]; - let message = message.into_iter().map(|a| a.as_int() as u64).collect::>(); + let message = message.into_iter().map(|a| a.as_int()).collect::>(); op_stack.extend_from_slice(&message); op_stack.extend_from_slice(&pk.as_elements().iter().map(|a| a.as_int()).collect::>()); diff --git a/stdlib/tests/crypto/fri/mod.rs b/stdlib/tests/crypto/fri/mod.rs index df9e383893..69b6350235 100644 --- a/stdlib/tests/crypto/fri/mod.rs +++ b/stdlib/tests/crypto/fri/mod.rs @@ -1,4 +1,3 @@ -use crate::build_test; use processor::Digest; use test_utils::{collections::BTreeMap, crypto::MerkleStore, Felt, StarkField}; diff --git a/stdlib/tests/crypto/fri/remainder.rs b/stdlib/tests/crypto/fri/remainder.rs index cb6429a9fb..6056aa9d6c 100644 --- a/stdlib/tests/crypto/fri/remainder.rs +++ b/stdlib/tests/crypto/fri/remainder.rs @@ -1,4 +1,3 @@ -use crate::build_test; use test_utils::{ math::fft, rand::rand_vector, test_case, Felt, FieldElement, QuadFelt, StarkField, ONE, }; diff --git a/stdlib/tests/crypto/fri/verifier_fri_e2f4.rs b/stdlib/tests/crypto/fri/verifier_fri_e2f4.rs index 99c8308463..9f5f65bb94 100644 --- a/stdlib/tests/crypto/fri/verifier_fri_e2f4.rs +++ b/stdlib/tests/crypto/fri/verifier_fri_e2f4.rs @@ -84,7 +84,7 @@ pub fn fri_prove_verify_fold4_ext2(trace_length_e: usize) -> Result Result { - return Ok(FriResult { - partial_trees, - advice_maps, - positions: all_position_evaluation, - alphas, - commitments, - remainder, - num_queries: positions.len(), - }); - } - Err(err) => return Err(err), + Ok(((partial_trees, advice_maps), all_position_evaluation, alphas)) => Ok(FriResult { + partial_trees, + advice_maps, + positions: all_position_evaluation, + alphas, + commitments, + remainder, + num_queries: positions.len(), + }), + Err(err) => Err(err), } } @@ -166,7 +164,7 @@ fn verify_proof( let queried_evaluations = positions.iter().map(|&p| evaluations[p]).collect::>(); let result = - miden_verifier.verify_fold_4_ext_2(&mut channel, &queried_evaluations, &positions)?; + miden_verifier.verify_fold_4_ext_2(&mut channel, &queried_evaluations, positions)?; Ok(result) } @@ -296,9 +294,9 @@ impl FriVerifierFold4Ext2 { } fn iterate_query_fold_4_quad_ext( - layer_alphas: &Vec, - partial_trees: &Vec, - key_val_map: &Vec<(RpoDigest, Vec)>, + layer_alphas: &[QuadExt], + partial_trees: &[PartialMerkleTree], + key_val_map: &[(RpoDigest, Vec)], position: usize, number_of_layers: usize, initial_domain_size: usize, @@ -312,13 +310,13 @@ fn iterate_query_fold_4_quad_ext( let initial_domain_generator = *domain_generator; let norm_cst = Felt::get_root_of_unity(2).inv(); - let mut init_exp = initial_domain_generator.exp((position as u64).into()); + let mut init_exp = initial_domain_generator.exp(position as u64); let arr = vec![evaluation]; let a = QuadExt::slice_as_base_elements(&arr); let position_evaluation = - vec![a[0].as_int(), a[1].as_int(), (position as u64).into(), init_exp.as_int()]; + vec![a[0].as_int(), a[1].as_int(), position as u64, init_exp.as_int()]; let mut alphas = vec![]; for depth in 0..number_of_layers { @@ -387,7 +385,7 @@ fn iterate_query_fold_4_quad_ext( alphas.push(0); alphas.push(0); - *domain_generator = (*domain_generator).exp((4 as u32).into()); + *domain_generator = (*domain_generator).exp((4_u32).into()); cur_pos = folded_pos; domain_size /= 4; } diff --git a/stdlib/tests/crypto/keccak256.rs b/stdlib/tests/crypto/keccak256.rs index f3853a079c..bc6b89c3c4 100644 --- a/stdlib/tests/crypto/keccak256.rs +++ b/stdlib/tests/crypto/keccak256.rs @@ -1,4 +1,3 @@ -use crate::build_test; use sha3::{Digest, Keccak256}; use test_utils::{ rand::{rand_array, rand_value}, diff --git a/stdlib/tests/crypto/native.rs b/stdlib/tests/crypto/native.rs index 0c58a5ae20..c62243f812 100644 --- a/stdlib/tests/crypto/native.rs +++ b/stdlib/tests/crypto/native.rs @@ -1,4 +1,3 @@ -use crate::build_test; use processor::ExecutionError; use test_utils::{build_expected_hash, build_expected_perm, TestError}; diff --git a/stdlib/tests/crypto/sha256.rs b/stdlib/tests/crypto/sha256.rs index 8fe1400281..8a40459f7f 100644 --- a/stdlib/tests/crypto/sha256.rs +++ b/stdlib/tests/crypto/sha256.rs @@ -1,4 +1,3 @@ -use crate::build_test; use sha2::{Digest, Sha256}; use test_utils::{ group_slice_elements, diff --git a/stdlib/tests/crypto/stark/mod.rs b/stdlib/tests/crypto/stark/mod.rs index 179ed8e892..64877654c4 100644 --- a/stdlib/tests/crypto/stark/mod.rs +++ b/stdlib/tests/crypto/stark/mod.rs @@ -1,8 +1,6 @@ mod verifier_recursive; - use verifier_recursive::{generate_advice_inputs, VerifierData}; -use crate::build_test; use assembly::Assembler; use miden_air::{FieldExtension, HashFunction, PublicInputs}; use processor::DefaultHost; @@ -52,7 +50,7 @@ pub fn generate_recursive_verifier_data( source: &str, stack_inputs: Vec, ) -> Result { - let program = Assembler::default().compile(&source).unwrap(); + let program = Assembler::default().compile(source).unwrap(); let stack_inputs = StackInputs::try_from_values(stack_inputs).unwrap(); let advice_inputs = AdviceInputs::default(); let advice_provider = MemAdviceProvider::from(advice_inputs); diff --git a/stdlib/tests/crypto/stark/verifier_recursive/channel.rs b/stdlib/tests/crypto/stark/verifier_recursive/channel.rs index 5ae18f558a..61864c34f3 100644 --- a/stdlib/tests/crypto/stark/verifier_recursive/channel.rs +++ b/stdlib/tests/crypto/stark/verifier_recursive/channel.rs @@ -3,7 +3,7 @@ use miden_air::ProcessorAir; use test_utils::{ - collections::Vec, + collections::*, crypto::{BatchMerkleProof, MerklePath, PartialMerkleTree, Rpo256, RpoDigest}, group_vector_elements, math::{FieldElement, QuadExtension, StarkField}, diff --git a/stdlib/tests/crypto/stark/verifier_recursive/mod.rs b/stdlib/tests/crypto/stark/verifier_recursive/mod.rs index 4ab6d11f63..e698b9092a 100644 --- a/stdlib/tests/crypto/stark/verifier_recursive/mod.rs +++ b/stdlib/tests/crypto/stark/verifier_recursive/mod.rs @@ -1,7 +1,7 @@ use miden_air::ProcessorAir; use processor::crypto::RpoRandomCoin; use test_utils::{ - collections::Vec, + collections::*, crypto::{MerkleStore, RandomCoin, Rpo256, RpoDigest}, math::{fft, FieldElement, QuadExtension, StarkField, ToElements}, Felt, VerifierError, @@ -55,7 +55,7 @@ pub fn generate_advice_inputs( // reseed the coin with the commitment to the main trace segment public_coin.reseed(trace_commitments[0]); - tape.extend_from_slice(&digest_to_int_vec(&trace_commitments)); + tape.extend_from_slice(&digest_to_int_vec(trace_commitments)); // process auxiliary trace segments, to build a set of random elements for each segment let mut aux_trace_rand_elements = AuxTraceRandElements::::new(); @@ -81,7 +81,7 @@ pub fn generate_advice_inputs( let _ood_main_trace_frame = ood_trace_frame.main_frame(); let _ood_aux_trace_frame = ood_trace_frame.aux_frame(); - tape.extend_from_slice(&to_int_vec(&ood_trace_frame.values())); + tape.extend_from_slice(&to_int_vec(ood_trace_frame.values())); public_coin.reseed(Rpo256::hash_elements(ood_trace_frame.values())); // read evaluations of composition polynomial columns @@ -151,14 +151,11 @@ pub fn generate_advice_inputs( pub fn digest_to_int_vec(digest: &[RpoDigest]) -> Vec { digest .iter() - .map(|digest| digest.as_elements().into_iter().map(|e| e.as_int())) + .map(|digest| digest.as_elements().iter().map(|e| e.as_int())) .flatten() .collect() } pub fn to_int_vec(ext_felts: &[QuadExt]) -> Vec { - QuadExt::slice_as_base_elements(ext_felts) - .into_iter() - .map(|e| e.as_int()) - .collect() + QuadExt::slice_as_base_elements(ext_felts).iter().map(|e| e.as_int()).collect() } diff --git a/stdlib/tests/math/ecgfp5/base_field.rs b/stdlib/tests/math/ecgfp5/base_field.rs index 649124d420..c60889ff49 100644 --- a/stdlib/tests/math/ecgfp5/base_field.rs +++ b/stdlib/tests/math/ecgfp5/base_field.rs @@ -1,8 +1,4 @@ -use crate::build_test; -use core::{ - cmp::PartialEq, - ops::{Add, Div, Mul, Neg, Sub}, -}; +use core::ops::{Add, Div, Mul, Neg, Sub}; use test_utils::{rand::rand_value, Felt, FieldElement, StarkField, ONE, ZERO}; // Given an element v ∈ Z_q | q = 2^64 - 2^32 + 1, this routine raises diff --git a/stdlib/tests/math/ecgfp5/group.rs b/stdlib/tests/math/ecgfp5/group.rs index f903b4b2a9..a61a6fdee8 100644 --- a/stdlib/tests/math/ecgfp5/group.rs +++ b/stdlib/tests/math/ecgfp5/group.rs @@ -1,5 +1,4 @@ use super::base_field::{bv_or, Ext5}; -use crate::build_test; use std::ops::Add; use test_utils::{test_case, Felt, ONE, ZERO}; diff --git a/stdlib/tests/math/ecgfp5/scalar_field.rs b/stdlib/tests/math/ecgfp5/scalar_field.rs index 444187e96a..8ded33e5b6 100644 --- a/stdlib/tests/math/ecgfp5/scalar_field.rs +++ b/stdlib/tests/math/ecgfp5/scalar_field.rs @@ -1,5 +1,4 @@ -use crate::build_test; -use std::{cmp::PartialEq, ops::Mul}; +use std::ops::Mul; use test_utils::rand::rand_value; #[derive(Copy, Clone, Debug)] diff --git a/stdlib/tests/math/secp256k1/base_field.rs b/stdlib/tests/math/secp256k1/base_field.rs index 69c997582f..10400dcf2e 100644 --- a/stdlib/tests/math/secp256k1/base_field.rs +++ b/stdlib/tests/math/secp256k1/base_field.rs @@ -1,5 +1,3 @@ -use crate::build_test; -use core::cmp::PartialEq; use core::ops::{Add, Mul, Neg, Sub}; use test_utils::rand::rand_array; diff --git a/stdlib/tests/math/secp256k1/group.rs b/stdlib/tests/math/secp256k1/group.rs index a889a22837..9837028184 100644 --- a/stdlib/tests/math/secp256k1/group.rs +++ b/stdlib/tests/math/secp256k1/group.rs @@ -1,4 +1,3 @@ -use crate::build_test; use test_utils::test_case; // Wrapper types introduced for parameterized testing diff --git a/stdlib/tests/math/secp256k1/scalar_field.rs b/stdlib/tests/math/secp256k1/scalar_field.rs index 60d22dd0a9..2314dcc107 100644 --- a/stdlib/tests/math/secp256k1/scalar_field.rs +++ b/stdlib/tests/math/secp256k1/scalar_field.rs @@ -1,5 +1,3 @@ -use crate::build_test; -use core::cmp::PartialEq; use core::ops::Mul; use test_utils::rand::rand_array; diff --git a/stdlib/tests/math/u256_mod.rs b/stdlib/tests/math/u256_mod.rs index 596eeff0be..14150c321c 100644 --- a/stdlib/tests/math/u256_mod.rs +++ b/stdlib/tests/math/u256_mod.rs @@ -1,4 +1,3 @@ -use crate::build_test; use num_bigint::BigUint; use test_utils::rand::rand_vector; diff --git a/stdlib/tests/math/u64_mod.rs b/stdlib/tests/math/u64_mod.rs index d497638960..7e3da8503a 100644 --- a/stdlib/tests/math/u64_mod.rs +++ b/stdlib/tests/math/u64_mod.rs @@ -1,4 +1,3 @@ -use crate::build_test; use core::cmp; use processor::ExecutionError; use test_utils::{proptest::prelude::*, rand::rand_value, Felt, TestError, U32_BOUND, ZERO}; diff --git a/stdlib/tests/sys/mod.rs b/stdlib/tests/sys/mod.rs index 7479e4986e..50aee4de8c 100644 --- a/stdlib/tests/sys/mod.rs +++ b/stdlib/tests/sys/mod.rs @@ -1,4 +1,3 @@ -use crate::build_test; use test_utils::{proptest::prelude::*, rand::rand_vector, STACK_TOP_SIZE}; #[test] diff --git a/test-utils/src/crypto.rs b/test-utils/src/crypto.rs index 89f0d2e852..c4ffe45c6c 100644 --- a/test-utils/src/crypto.rs +++ b/test-utils/src/crypto.rs @@ -1,4 +1,4 @@ -use super::{Felt, Vec, Word, ZERO}; +use super::{collections::*, Felt, Word, ZERO}; // RE-EXPORTS // ================================================================================================ diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index 117feb135a..d0aa78f9b6 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -9,14 +9,14 @@ extern crate alloc; #[cfg(not(target_family = "wasm"))] use proptest::prelude::{Arbitrary, Strategy}; -use vm_core::chiplets::hasher::apply_permutation; -use vm_core::utils::{collections::Vec, string::String}; +use vm_core::{ + chiplets::hasher::apply_permutation, + utils::{collections::*, string::*}, +}; // EXPORTS // ================================================================================================ -pub use vm_core::chiplets::hasher::{hash_elements, STATE_WIDTH}; - pub use assembly::{Library, MaslLibrary}; pub use processor::{ AdviceInputs, AdviceProvider, ContextId, DefaultHost, ExecutionError, ExecutionOptions, @@ -26,6 +26,7 @@ pub use prover::{prove, MemAdviceProvider, ProvingOptions}; pub use test_case::test_case; pub use verifier::{verify, AcceptableOptions, ProgramInfo, VerifierError}; pub use vm_core::{ + chiplets::hasher::{hash_elements, STATE_WIDTH}, stack::STACK_TOP_SIZE, utils::{collections, group_slice_elements, group_vector_elements, IntoBytes, ToElements}, Felt, FieldElement, Program, StarkField, Word, EMPTY_WORD, ONE, WORD_SIZE, ZERO,