Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Deprecate public type aliases #149

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/absorb_multiple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use triton_vm::twenty_first::prelude::Sponge;

use crate::data_type::DataType;
use crate::empty_stack;
use crate::prelude::Tip5;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::basic_snippet::BasicSnippet;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::VmHasher;

/// Absorb a sequence of field elements stored in memory, into the Sponge.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
Expand Down Expand Up @@ -145,7 +145,7 @@ impl Procedure for AbsorbMultiple {
memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
// read arguments
let length = stack.pop().unwrap().value() as usize;
Expand Down
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/absorb_multiple_static_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use triton_vm::twenty_first::prelude::Sponge;

use crate::data_type::DataType;
use crate::memory::load_words_from_memory_pop_pointer;
use crate::prelude::Tip5;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::basic_snippet::BasicSnippet;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::VmHasher;

/// Absorb a sequence of field elements stored in memory, into the Sponge.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
Expand Down Expand Up @@ -117,7 +117,7 @@ impl Procedure for AbsorbMultipleStaticSize {
memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
// read arguments
let address = stack.pop().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/algebraic_hasher/hash_static_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ mod tests {
use triton_vm::twenty_first::util_types::sponge::Sponge;

use super::*;
use crate::prelude::Tip5;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

#[test]
fn hash_static_size_small_pbt() {
Expand All @@ -93,7 +93,7 @@ mod tests {
memory: &mut HashMap<BFieldElement, BFieldElement>,
nondeterminism: &NonDeterminism,
public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
*sponge = Some(Tip5::init());

Expand Down
6 changes: 3 additions & 3 deletions tasm-lib/src/hashing/algebraic_hasher/hash_varlen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use triton_vm::twenty_first::util_types::sponge::Sponge;
use crate::data_type::DataType;
use crate::hashing::absorb_multiple::AbsorbMultiple;
use crate::library::Library;
use crate::prelude::Tip5;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::basic_snippet::BasicSnippet;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::VmHasher;

/// Calculate hash of a raw sequence of a `BFieldElement`.
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -40,7 +40,7 @@ impl HashVarlen {

/// Mutate the sponge with the same operations as this snippet
/// Used to facilitate rust-shadowing in downstream dependencies.
pub fn sponge_mutation(&self, sponge: &mut VmHasher, preimage: &[BFieldElement]) {
pub fn sponge_mutation(&self, sponge: &mut Tip5, preimage: &[BFieldElement]) {
*sponge = Tip5::init();

sponge.pad_and_absorb_all(preimage);
Expand Down Expand Up @@ -93,7 +93,7 @@ impl Procedure for HashVarlen {
memory: &mut HashMap<BFieldElement, BFieldElement>,
nondeterminism: &NonDeterminism,
public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
*sponge = Some(Tip5::init());

Expand Down
6 changes: 3 additions & 3 deletions tasm-lib/src/hashing/algebraic_hasher/sample_indices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use crate::empty_stack;
use crate::list::length::Length;
use crate::list::new::New;
use crate::list::push::Push;
use crate::prelude::Tip5;
use crate::rust_shadowing_helper_functions;
use crate::traits::basic_snippet::BasicSnippet;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::VmHasher;

/// Sample n pseudorandom integers between 0 and k. It does this by squeezing the sponge. It is the
/// caller's responsibility to ensure that the sponge is initialized to the right state.
Expand Down Expand Up @@ -142,7 +142,7 @@ impl Procedure for SampleIndices {
memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");

Expand Down Expand Up @@ -206,7 +206,7 @@ impl Procedure for SampleIndices {
stack.push(BFieldElement::new(upper_bound as u64));

let public_input: Vec<BFieldElement> = vec![];
let state = VmHasher { state: rng.gen() };
let state = Tip5 { state: rng.gen() };

ProcedureInitialState {
stack,
Expand Down
2 changes: 1 addition & 1 deletion tasm-lib/src/hashing/algebraic_hasher/sample_scalar_one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod tests {
_memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<crate::VmHasher>,
sponge: &mut Option<crate::prelude::Tip5>,
) -> Vec<BFieldElement> {
let vals = sponge.as_mut().unwrap().squeeze();

Expand Down
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/algebraic_hasher/sample_scalars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ mod test {
use crate::empty_stack;
use crate::memory::dyn_malloc::DYN_MALLOC_FIRST_ADDRESS;
use crate::memory::encode_to_memory;
use crate::prelude::Tip5;
use crate::rust_shadowing_helper_functions;
use crate::snippet_bencher::BenchmarkCase;
use crate::test_helpers::tasm_final_state;
Expand All @@ -99,7 +100,6 @@ mod test {
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

impl Procedure for SampleScalars {
fn rust_shadow(
Expand All @@ -108,7 +108,7 @@ mod test {
memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");
let num_scalars = stack.pop().unwrap().value() as usize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ mod tests {

use super::SampleScalarsStaticLengthDynMalloc;
use crate::memory::dyn_malloc::DYN_MALLOC_FIRST_ADDRESS;
use crate::prelude::Tip5;
use crate::rust_shadowing_helper_functions;
use crate::test_helpers::tasm_final_state;
use crate::traits::basic_snippet::BasicSnippet;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

impl Procedure for SampleScalarsStaticLengthDynMalloc {
fn rust_shadow(
Expand All @@ -106,7 +106,7 @@ mod tests {
memory: &mut std::collections::HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");
let num_squeezes = Self::num_squeezes(self.num_elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ pub(crate) mod tests {
use triton_vm::twenty_first::util_types::sponge::Sponge;

use super::*;
use crate::prelude::Tip5;
use crate::rust_shadowing_helper_functions::array::array_get;
use crate::rust_shadowing_helper_functions::array::insert_as_array;
use crate::test_helpers::tasm_final_state;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

impl SampleScalarsStaticLengthKMalloc {
/// For testing purposes only.
Expand All @@ -118,7 +118,7 @@ pub(crate) mod tests {
memory: &mut std::collections::HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");
let num_squeezes =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ pub(crate) mod tests {
use triton_vm::twenty_first::util_types::sponge::Sponge;

use super::*;
use crate::prelude::Tip5;
use crate::rust_shadowing_helper_functions::array::array_get;
use crate::rust_shadowing_helper_functions::array::insert_as_array;
use crate::test_helpers::tasm_final_state;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

impl Procedure for SampleScalarsStaticLengthStaticPointer {
fn rust_shadow(
Expand All @@ -98,7 +98,7 @@ pub(crate) mod tests {
memory: &mut std::collections::HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");
let num_squeezes =
Expand Down
2 changes: 1 addition & 1 deletion tasm-lib/src/hashing/eq_digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use triton_vm::prelude::*;
use crate::data_type::DataType;
use crate::empty_stack;
use crate::library::Library;
use crate::prelude::Digest;
use crate::push_encodable;
use crate::traits::deprecated_snippet::DeprecatedSnippet;
use crate::Digest;
use crate::InitVmState;

#[derive(Clone, Debug)]
Expand Down
6 changes: 3 additions & 3 deletions tasm-lib/src/hashing/merkle_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ mod tests {
use test_strategy::proptest;

use super::*;
use crate::prelude::Tip5;
use crate::snippet_bencher::BenchmarkCase;
use crate::test_helpers::negative_test;
use crate::test_helpers::test_assertion_failure;
use crate::traits::read_only_algorithm::ReadOnlyAlgorithm;
use crate::traits::read_only_algorithm::ReadOnlyAlgorithmInitialState;
use crate::traits::read_only_algorithm::ShadowedReadOnlyAlgorithm;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

#[test]
fn merkle_verify_test() {
Expand Down Expand Up @@ -352,8 +352,8 @@ mod tests {
for &sibling in path.iter() {
let node_is_left_sibling = node_index % 2 == 0;
node_digest = match node_is_left_sibling {
true => VmHasher::hash_pair(node_digest, sibling),
false => VmHasher::hash_pair(sibling, node_digest),
true => Tip5::hash_pair(node_digest, sibling),
false => Tip5::hash_pair(sibling, node_digest),
};
node_index /= 2;
}
Expand Down
2 changes: 1 addition & 1 deletion tasm-lib/src/hashing/reverse_digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use triton_vm::prelude::*;

use crate::data_type::DataType;
use crate::empty_stack;
use crate::prelude::Digest;
use crate::traits::deprecated_snippet::DeprecatedSnippet;
use crate::Digest;
use crate::InitVmState;

/// Reverse the order of elements in a digest: [d4, d3, d2, d1, d0] -> [d0, d1, d2, d3, d4]
Expand Down
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/sponge_hasher/absorb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ mod test {

use super::*;
use crate::empty_stack;
use crate::prelude::Tip5;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

fn init_memory_and_stack() -> (HashMap<BFieldElement, BFieldElement>, Vec<BFieldElement>) {
let array_pointer: BFieldElement = random();
Expand All @@ -113,7 +113,7 @@ mod test {
memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");
let input_pointer: BFieldElement = stack.pop().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/sponge_hasher/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ mod test {

use super::*;
use crate::empty_stack;
use crate::prelude::Tip5;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

impl Procedure for Init {
fn rust_shadow(
Expand All @@ -56,7 +56,7 @@ mod test {
_memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
*sponge = Some(Tip5::init());
Vec::default()
Expand Down
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/sponge_hasher/pad_and_absorb_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ mod test {

use super::*;
use crate::empty_stack;
use crate::prelude::Tip5;
use crate::rust_shadowing_helper_functions::list::insert_random_list;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

impl PadAndAbsorbAll {
fn init_memory_and_stack(
Expand All @@ -90,7 +90,7 @@ mod test {
memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");
let input_pointer: BFieldElement = stack.pop().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tasm-lib/src/hashing/sponge_hasher/squeeze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ mod test {
use crate::empty_stack;
use crate::memory::dyn_malloc;
use crate::memory::dyn_malloc::DYN_MALLOC_ADDRESS;
use crate::prelude::Tip5;
use crate::rust_shadowing_helper_functions;
use crate::snippet_bencher::BenchmarkCase;
use crate::traits::procedure::Procedure;
use crate::traits::procedure::ProcedureInitialState;
use crate::traits::procedure::ShadowedProcedure;
use crate::traits::rust_shadow::RustShadow;
use crate::VmHasher;

impl Procedure for Squeeze {
fn rust_shadow(
Expand All @@ -93,7 +93,7 @@ mod test {
memory: &mut HashMap<BFieldElement, BFieldElement>,
_nondeterminism: &NonDeterminism,
_public_input: &[BFieldElement],
sponge: &mut Option<VmHasher>,
sponge: &mut Option<Tip5>,
) -> Vec<BFieldElement> {
let sponge = sponge.as_mut().expect("sponge must be initialized");
let mut array_pointer =
Expand Down
Loading
Loading