Skip to content

Commit

Permalink
refactor: hasher imports from core to be through core::chiplets mod
Browse files Browse the repository at this point in the history
  • Loading branch information
grjte committed Aug 2, 2022
1 parent 8b07d87 commit 336c352
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion air/src/chiplets/hasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::{
use crate::utils::{are_equal, binary_not, is_binary, EvaluationResult};
use core::ops::Range;
use vm_core::{
hasher::{
chiplets::hasher::{
Hasher, CAPACITY_LEN, DIGEST_LEN, DIGEST_RANGE, HASH_CYCLE_LEN, NUM_SELECTORS, STATE_WIDTH,
},
utils::range as create_range,
Expand Down
2 changes: 1 addition & 1 deletion air/src/chiplets/hasher/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{
};
use rand_utils::rand_array;
use vm_core::{
hasher::{apply_round, Selectors, LINEAR_HASH, STATE_WIDTH},
chiplets::hasher::{apply_round, Selectors, LINEAR_HASH, STATE_WIDTH},
Felt, FieldElement, TRACE_WIDTH,
};
use winter_air::EvaluationFrame;
Expand Down
2 changes: 1 addition & 1 deletion air/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern crate alloc;

use vm_core::{
hasher::Digest,
chiplets::hasher::Digest,
utils::{collections::Vec, ByteWriter, Serializable},
ExtensionOf, CLK_COL_IDX, FMP_COL_IDX, MIN_STACK_DEPTH, STACK_TRACE_OFFSET,
};
Expand Down
2 changes: 1 addition & 1 deletion core/src/inputs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{
chiplets::hasher,
errors::{AdviceSetError, InputError},
hasher,
utils::IntoBytes,
Felt, FieldElement, Word, MIN_STACK_DEPTH,
};
Expand Down
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ extern crate alloc;
use core::ops::Range;

pub mod chiplets;
pub use chiplets::hasher;
pub mod decoder;
pub mod errors;
pub mod range;
Expand Down
2 changes: 1 addition & 1 deletion core/src/program/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{
hasher::{self, Digest},
chiplets::hasher::{self, Digest},
utils::{collections::Vec, Box},
Felt, FieldElement, Operation,
};
Expand Down
2 changes: 1 addition & 1 deletion miden/tests/integration/operations/crypto_ops.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rand_utils::rand_vector;
use vm_core::{
hasher::{apply_permutation, hash_elements, STATE_WIDTH},
chiplets::hasher::{apply_permutation, hash_elements, STATE_WIDTH},
AdviceSet, Felt, FieldElement, StarkField,
};

Expand Down
2 changes: 1 addition & 1 deletion processor/src/chiplets/hasher/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{Felt, FieldElement, OpBatch, StarkField, TraceFragment, Vec, Word, ZERO};
use vm_core::hasher::{
use vm_core::chiplets::hasher::{
absorb_into_state, get_digest, init_state, init_state_from_words, Selectors, LINEAR_HASH,
MP_VERIFY, MR_UPDATE_NEW, MR_UPDATE_OLD, RETURN_HASH, RETURN_STATE, STATE_WIDTH, TRACE_WIDTH,
};
Expand Down
4 changes: 2 additions & 2 deletions processor/src/chiplets/hasher/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::{
};
use rand_utils::rand_array;
use vm_core::{
hasher::{self, NUM_ROUNDS},
chiplets::hasher::{self, NUM_ROUNDS},
AdviceSet, ONE, ZERO,
};

Expand Down Expand Up @@ -413,7 +413,7 @@ fn assert_row_equal(trace: &[Vec<Felt>], row_idx: usize, values: &[Felt]) {
}

fn apply_permutation(mut state: HasherState) -> HasherState {
vm_core::hasher::apply_permutation(&mut state);
hasher::apply_permutation(&mut state);
state
}

Expand Down
6 changes: 4 additions & 2 deletions processor/src/chiplets/hasher/trace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use super::{Felt, FieldElement, HasherState, Selectors, TraceFragment, Vec, TRACE_WIDTH};
use vm_core::hasher::{apply_round, NUM_ROUNDS, STATE_WIDTH};
use super::{
Felt, FieldElement, HasherState, Selectors, TraceFragment, Vec, STATE_WIDTH, TRACE_WIDTH,
};
use vm_core::chiplets::hasher::{apply_round, NUM_ROUNDS};

// HASHER TRACE
// ================================================================================================
Expand Down
6 changes: 4 additions & 2 deletions processor/src/chiplets/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::{utils::get_trace_len, CodeBlock, ExecutionTrace, Operation, Process};
use vm_core::{
chiplets::bitwise::{BITWISE_OR, OP_CYCLE_LEN},
hasher::{HASH_CYCLE_LEN, LINEAR_HASH, RETURN_STATE},
chiplets::{
bitwise::{BITWISE_OR, OP_CYCLE_LEN},
hasher::{HASH_CYCLE_LEN, LINEAR_HASH, RETURN_STATE},
},
Felt, FieldElement, ProgramInputs, CHIPLETS_RANGE, CHIPLETS_WIDTH,
};

Expand Down
4 changes: 2 additions & 2 deletions processor/src/decoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use super::{
StarkField, Vec, Word, MIN_TRACE_LEN, ONE, OP_BATCH_SIZE, ZERO,
};
use vm_core::{
chiplets::hasher::DIGEST_LEN,
code_blocks::get_span_op_group_count,
decoder::{
NUM_HASHER_COLUMNS, NUM_OP_BATCH_FLAGS, NUM_OP_BITS, OP_BATCH_1_GROUPS, OP_BATCH_2_GROUPS,
OP_BATCH_4_GROUPS, OP_BATCH_8_GROUPS,
},
hasher::DIGEST_LEN,
AssemblyOp,
};

Expand All @@ -27,7 +27,7 @@ mod tests;
// CONSTANTS
// ================================================================================================

const HASH_CYCLE_LEN: Felt = Felt::new(vm_core::hasher::HASH_CYCLE_LEN as u64);
const HASH_CYCLE_LEN: Felt = Felt::new(vm_core::chiplets::hasher::HASH_CYCLE_LEN as u64);

// DECODER PROCESS EXTENSION
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
extern crate alloc;

use vm_core::{
chiplets::hasher::Digest,
code_blocks::{CodeBlock, Join, Loop, OpBatch, Span, Split, OP_BATCH_SIZE, OP_GROUP_SIZE},
errors::AdviceSetError,
hasher::Digest,
utils::collections::{BTreeMap, Vec},
AdviceInjector, Decorator, DecoratorIterator, Felt, FieldElement, Operation, Program,
ProgramInputs, StackTopState, StarkField, Word, CHIPLETS_WIDTH, DECODER_TRACE_WIDTH,
Expand Down
2 changes: 1 addition & 1 deletion processor/src/operations/crypto_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ mod tests {
use crate::Word;
use rand_utils::rand_vector;
use vm_core::{
hasher::{apply_permutation, STATE_WIDTH},
chiplets::hasher::{apply_permutation, STATE_WIDTH},
AdviceSet, ProgramInputs,
};

Expand Down
2 changes: 1 addition & 1 deletion processor/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub const NUM_RAND_ROWS: usize = 1;
// TYPE ALIASES
// ================================================================================================

type RandomCoin = vm_core::utils::RandomCoin<Felt, vm_core::hasher::Hasher>;
type RandomCoin = vm_core::utils::RandomCoin<Felt, vm_core::chiplets::hasher::Hasher>;

// VM EXECUTION TRACE
// ================================================================================================
Expand Down
4 changes: 3 additions & 1 deletion processor/src/trace/tests/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use super::{
Word, ONE, ZERO,
};
use crate::chiplets::SiblingTableRow;
use vm_core::{hasher::P1_COL_IDX, AdviceSet, FieldElement, StarkField, AUX_TRACE_RAND_ELEMENTS};
use vm_core::{
chiplets::hasher::P1_COL_IDX, AdviceSet, FieldElement, StarkField, AUX_TRACE_RAND_ELEMENTS,
};

// SIBLING TABLE TESTS
// ================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion processor/src/trace/tests/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{build_trace_from_ops, Felt, FieldElement, Trace, NUM_RAND_ROWS};
use crate::{ONE, ZERO};
use rand_utils::rand_array;
use vm_core::{
hasher::HASH_CYCLE_LEN,
chiplets::hasher::HASH_CYCLE_LEN,
range::{P0_COL_IDX, P1_COL_IDX, Q_COL_IDX},
Operation, AUX_TRACE_RAND_ELEMENTS,
};
Expand Down
2 changes: 1 addition & 1 deletion verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use winterfell::VerifierError;
// ================================================================================================

pub use assembly;
pub use vm_core::hasher::Digest;
pub use vm_core::chiplets::hasher::Digest;
pub use winterfell::StarkProof;

// VERIFIER
Expand Down

0 comments on commit 336c352

Please sign in to comment.