Skip to content

Commit

Permalink
chore: migrate to miden-crypto v0.9.0 (#1287)
Browse files Browse the repository at this point in the history
* chore: fix no-std errors
* fix: Falcon DSA decorators and tests
  • Loading branch information
Al-Kindi-0 authored Mar 25, 2024
1 parent dcd6259 commit d5de231
Show file tree
Hide file tree
Showing 133 changed files with 317 additions and 228 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#### VM Internals
- Removed unused `find_lone_leaf()` function from the Advice Provider (#1262).
- [BREAKING] Changed fields type of the `StackOutputs` struct from `Vec<u64>` to `Vec<Felt>` (#1268).
- [BREAKING] Migrated to `miden-crypto` v0.9.0 (#1287).

## 0.8.0 (02-26-2024)

Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/chiplets/bitwise/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use crate::{
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, collections::*, is_binary, is_zero, EvaluationResult},
utils::{are_equal, binary_not, is_binary, is_zero, EvaluationResult},
ONE, ZERO,
};
use alloc::vec::Vec;
use winter_air::TransitionConstraintDegree;

#[cfg(test)]
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/chiplets/hasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ use crate::{
},
HASHER_NODE_INDEX_COL_IDX, HASHER_SELECTOR_COL_RANGE, HASHER_STATE_COL_RANGE,
},
utils::{are_equal, binary_not, collections::*, is_binary, EvaluationResult},
utils::{are_equal, binary_not, is_binary, EvaluationResult},
ONE, ZERO,
};
use alloc::vec::Vec;

#[cfg(test)]
mod tests;
Expand Down
2 changes: 1 addition & 1 deletion air/src/constraints/chiplets/hasher/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use super::{
};
use crate::{
trace::chiplets::hasher::{Selectors, LINEAR_HASH, STATE_WIDTH},
utils::collections::*,
Felt, TRACE_WIDTH,
};
use alloc::vec::Vec;
use rand_utils::rand_array;
use vm_core::chiplets::hasher::apply_round;
use winter_air::EvaluationFrame;
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/chiplets/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use crate::{
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},
utils::{binary_not, is_binary, EvaluationResult},
};
use alloc::vec::Vec;
use winter_air::TransitionConstraintDegree;

#[cfg(test)]
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/chiplets/memory/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use crate::trace::{
},
TRACE_WIDTH,
};
use crate::{chiplets::memory, utils::collections::*, Felt, FieldElement, ONE, ZERO};
use crate::{chiplets::memory, Felt, FieldElement, ONE, ZERO};
use alloc::vec::Vec;
use rand_utils::rand_value;

// UNIT TESTS
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/chiplets/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::super::{
EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree, CHIPLETS_OFFSET,
};
use crate::utils::{are_equal, binary_not, collections::*, is_binary};
use crate::utils::{are_equal, binary_not, is_binary};
use alloc::vec::Vec;

mod bitwise;
mod hasher;
Expand Down
4 changes: 3 additions & 1 deletion air/src/constraints/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ use crate::{
chiplets::ChipletsFrameExt,
constraints::MainFrameExt,
trace::range::{B_RANGE_COL_IDX, M_COL_IDX, V_COL_IDX},
utils::{are_equal, collections::*},
utils::are_equal,
Assertion, EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree,
};
use alloc::vec::Vec;

use vm_core::{ExtensionOf, ZERO};
use winter_air::AuxTraceRandElements;

Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/stack/field_ops/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree};
use crate::{
stack::EvaluationFrameExt,
utils::{are_equal, collections::*, is_binary},
utils::{are_equal, is_binary},
};
use alloc::vec::Vec;

#[cfg(test)]
pub mod tests;
Expand Down
6 changes: 2 additions & 4 deletions air/src/constraints/stack/io_ops/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree};
use crate::{
stack::EvaluationFrameExt,
utils::{are_equal, collections::*},
};
use crate::{stack::EvaluationFrameExt, utils::are_equal};
use alloc::vec::Vec;

#[cfg(test)]
pub mod tests;
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +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, collections::*, is_binary};
use crate::utils::{are_equal, is_binary};
use alloc::vec::Vec;
use vm_core::{stack::STACK_TOP_SIZE, StackOutputs};

pub mod field_ops;
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/stack/overflow/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree};
use crate::{stack::EvaluationFrameExt, utils::collections::*};
use crate::stack::EvaluationFrameExt;
use alloc::vec::Vec;

#[cfg(test)]
pub mod tests;
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/stack/stack_manipulation/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree};
use crate::{
stack::EvaluationFrameExt,
utils::{are_equal, binary_not, collections::*},
utils::{are_equal, binary_not},
};
use alloc::vec::Vec;

#[cfg(test)]
pub mod tests;
Expand Down
6 changes: 2 additions & 4 deletions air/src/constraints/stack/system_ops/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use super::{op_flags::OpFlags, EvaluationFrame, FieldElement, TransitionConstraintDegree};
use crate::{
stack::EvaluationFrameExt,
utils::{are_equal, collections::*},
};
use crate::{stack::EvaluationFrameExt, utils::are_equal};
use alloc::vec::Vec;

#[cfg(test)]
pub mod tests;
Expand Down
3 changes: 2 additions & 1 deletion air/src/constraints/stack/u32_ops/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{op_flags::OpFlags, EvaluationFrame, Felt, FieldElement, TransitionConstraintDegree};
use crate::{
stack::EvaluationFrameExt,
utils::{are_equal, collections::*, is_binary},
utils::{are_equal, is_binary},
};
use alloc::vec::Vec;

#[cfg(test)]
pub mod tests;
Expand Down
3 changes: 2 additions & 1 deletion air/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{trace::MIN_TRACE_LEN, utils::string::*};
use crate::trace::MIN_TRACE_LEN;
use alloc::string::String;
use core::fmt::{Display, Formatter};

// EXECUTION ERROR
Expand Down
14 changes: 9 additions & 5 deletions air/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![no_std]

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

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

use alloc::vec::Vec;

use vm_core::{
utils::{collections::*, ByteReader, ByteWriter, Deserializable, Serializable},
utils::{ByteReader, ByteWriter, Deserializable, Serializable},
ExtensionOf, ProgramInfo, StackInputs, StackOutputs, ONE, ZERO,
};
use winter_air::{
Expand Down Expand Up @@ -173,7 +177,7 @@ impl Air for ProcessorAir {
);

// Add initial assertions for the range checker's auxiliary columns.
range::get_aux_assertions_first_step(&mut result);
range::get_aux_assertions_first_step::<E>(&mut result);

// --- set assertions for the last step ---------------------------------------------------
let last_step = self.last_step();
Expand All @@ -187,7 +191,7 @@ impl Air for ProcessorAir {
);

// Add the range checker's auxiliary column assertions for the last step.
range::get_aux_assertions_last_step(&mut result, last_step);
range::get_aux_assertions_last_step::<E>(&mut result, last_step);

result
}
Expand Down
5 changes: 2 additions & 3 deletions air/src/proof.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use alloc::vec::Vec;
use vm_core::{
crypto::hash::{Blake3_192, Blake3_256, Hasher, Rpo256},
utils::{
collections::*, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
},
utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable},
};
use winter_air::proof::StarkProof;

Expand Down
2 changes: 1 addition & 1 deletion air/src/trace/main_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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 alloc::vec::Vec;
use core::ops::{Deref, Range};
use vm_core::{utils::range, Felt, ONE, ZERO};

Expand Down
4 changes: 2 additions & 2 deletions air/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::FieldElement;
use alloc::vec::Vec;
use core::ops::Range;
use vm_core::utils::{collections::*, range as create_range};
use vm_core::utils::range as create_range;

// RE-EXPORTS
// ================================================================================================
pub use vm_core::utils::{collections, string};

// BASIC CONSTRAINT OPERATORS
// ================================================================================================
Expand Down
8 changes: 4 additions & 4 deletions assembly/src/assembler/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use super::{
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};
use alloc::collections::BTreeMap;
use alloc::string::ToString;
use alloc::vec::Vec;

// ASSEMBLY CONTEXT
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/assembler/instruction/procedures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{
Assembler, AssemblyContext, AssemblyError, CodeBlock, Operation, ProcedureId, RpoDigest,
SpanBuilder,
};
use crate::utils::collections::*;
use alloc::vec::Vec;

// PROCEDURE INVOCATIONS
// ================================================================================================
Expand Down
10 changes: 5 additions & 5 deletions assembly/src/assembler/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::{
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, ONE, ZERO,
AssemblyError, CallSet, CodeBlock, CodeBlockTable, Felt, Kernel, Library, LibraryError,
LibraryPath, Module, NamedProcedure, Operation, Procedure, ProcedureId, ProcedureName, Program,
ONE, ZERO,
};
use crate::utils::collections::*;
use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use core::{borrow::Borrow, cell::RefCell};
use vm_core::{utils::group_vector_elements, Decorator, DecoratorList};

Expand Down
3 changes: 2 additions & 1 deletion assembly/src/assembler/module_provider.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::{Library, LibraryError, Module, ProcedureId};
use crate::utils::collections::*;
use alloc::collections::BTreeMap;
use alloc::vec::Vec;

// MODULE PROVIDER
// ================================================================================================
Expand Down
5 changes: 2 additions & 3 deletions assembly/src/assembler/procedure_cache.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::{
btree_map::Entry, AssemblyError, BTreeMap, NamedProcedure, Procedure, ProcedureId, RpoDigest,
};
use super::{AssemblyError, BTreeMap, NamedProcedure, Procedure, ProcedureId, RpoDigest};
use alloc::collections::btree_map::Entry;

// PROCEDURE CACHE
// ================================================================================================
Expand Down
3 changes: 2 additions & 1 deletion assembly/src/assembler/span_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use super::{
AssemblyContext, AssemblyError, BodyWrapper, Borrow, CodeBlock, Decorator, DecoratorList,
Instruction, Operation,
};
use crate::utils::{collections::*, string::*};
use alloc::string::ToString;
use alloc::vec::Vec;
use vm_core::{AdviceInjector, AssemblyOp};

// SPAN BUILDER
Expand Down
2 changes: 2 additions & 0 deletions assembly/src/assembler/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use super::{combine_blocks, Assembler, CodeBlock, Library, Module, Operation};
use crate::{ast::ModuleAst, LibraryNamespace, LibraryPath, Version};
use alloc::string::ToString;
use alloc::vec::Vec;
use core::slice::Iter;

// TESTS
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/ast/code_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{
ByteReader, ByteWriter, Deserializable, DeserializationError, Node, Serializable,
SourceLocation, MAX_BODY_LEN,
};
use crate::utils::collections::*;
use alloc::vec::Vec;
use core::{iter, slice};

// CODE BODY
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/ast/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{
CodeBody, FormattableNode, InvokedProcsMap, LibraryPath, ProcedureAst, ProcedureId,
ProcedureName,
};
use crate::utils::collections::*;
use alloc::vec::Vec;
use core::fmt;

const INDENT_STRING: &str = " ";
Expand Down
4 changes: 3 additions & 1 deletion assembly/src/ast/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use super::{
ParsingError, ProcedureId, ProcedureName, Serializable, Token, TokenStream, MAX_IMPORTS,
MAX_INVOKED_IMPORTED_PROCS,
};
use crate::utils::{collections::*, string::*};
use alloc::collections::BTreeMap;
use alloc::string::{String, ToString};
use alloc::vec::Vec;

// TYPE ALIASES
// ================================================================================================
Expand Down
4 changes: 3 additions & 1 deletion assembly/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use super::{
LabelError, LibraryPath, ParsingError, ProcedureId, ProcedureName, Serializable, SliceReader,
StarkField, Token, TokenStream, MAX_LABEL_LEN,
};
use crate::utils::{collections::*, string::*};
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::vec::Vec;
use vm_core::utils::bound_into_included_u64;

pub use tracing::{event, info_span, instrument, Level};
Expand Down
3 changes: 2 additions & 1 deletion assembly/src/ast/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ use super::{
Token, TokenStream,
},
};
use crate::utils::{collections::*, string::*};

use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::{fmt, str::from_utf8};
use vm_core::utils::Serializable;

Expand Down
2 changes: 1 addition & 1 deletion assembly/src/ast/nodes/advice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::{
},
serde::signatures,
};
use crate::utils::string::*;
use alloc::string::ToString;
use core::fmt;
use vm_core::{AdviceInjector, Felt, SignatureKind, ZERO};

Expand Down
2 changes: 1 addition & 1 deletion assembly/src/ast/nodes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{AstFormatterContext, CodeBody, Felt, FormattableCodeBody, ProcedureId, RpoDigest};
use crate::utils::collections::*;
use alloc::vec::Vec;
use core::fmt;
use vm_core::DebugOptions;

Expand Down
2 changes: 1 addition & 1 deletion assembly/src/ast/nodes/serde/debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{super::DebugOptions, ByteReader, ByteWriter, DeserializationError};
use crate::utils::string::*;
use alloc::string::ToString;

const STACK_ALL: u8 = 0;
const STACK_TOP: u8 = 1;
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/ast/nodes/serde/deserialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{
super::AdviceInjectorNode, debug, ByteReader, CodeBody, Deserializable, DeserializationError,
Felt, Instruction, Node, OpCode, ProcedureId, RpoDigest, MAX_PUSH_INPUTS,
};
use crate::utils::string::*;
use alloc::string::ToString;

// NODE DESERIALIZATION
// ================================================================================================
Expand Down
Loading

0 comments on commit d5de231

Please sign in to comment.