From f63295ce2a3a957f5d1df3cb477cd4ed35ef5965 Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Mon, 13 Jan 2025 16:25:57 +0100 Subject: [PATCH] chore(deps)!: Upgrade dependencies --- tasm-lib/Cargo.toml | 2 +- tasm-lib/src/hashing/merkle_root.rs | 3 +-- tasm-lib/src/hashing/merkle_root_from_xfes_generic.rs | 11 ++--------- .../src/hashing/merkle_root_from_xfes_static_size.rs | 2 +- tasm-lib/src/hashing/merkle_root_from_xfes_wrapper.rs | 2 +- tasm-lib/src/hashing/merkle_root_static_size.rs | 2 +- tasm-lib/src/verifier/fri/verify.rs | 4 +--- .../verifier/fri/verify_fri_authentication_paths.rs | 2 +- .../src/verifier/master_table/verify_table_rows.rs | 2 +- 9 files changed, 10 insertions(+), 20 deletions(-) diff --git a/tasm-lib/Cargo.toml b/tasm-lib/Cargo.toml index c96ad42c..ca369d98 100644 --- a/tasm-lib/Cargo.toml +++ b/tasm-lib/Cargo.toml @@ -36,7 +36,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" strum = { version = "0.26", features = ["derive"] } tasm-object-derive.workspace = true -triton-vm = { version = "0.44.1", default-features = false } +triton-vm = { version = "0.45.0", default-features = false } [dev-dependencies.cargo-husky] version = "1" diff --git a/tasm-lib/src/hashing/merkle_root.rs b/tasm-lib/src/hashing/merkle_root.rs index 4e06da64..7cbc9546 100644 --- a/tasm-lib/src/hashing/merkle_root.rs +++ b/tasm-lib/src/hashing/merkle_root.rs @@ -183,7 +183,6 @@ impl BasicSnippet for MerkleRoot { #[cfg(test)] mod tests { use num_traits::Zero; - use twenty_first::util_types::merkle_tree::CpuParallel; use twenty_first::util_types::merkle_tree::MerkleTree; use super::*; @@ -213,7 +212,7 @@ mod tests { ) { let leafs_pointer = stack.pop().unwrap(); let leafs = *Vec::::decode_from_memory(memory, leafs_pointer).unwrap(); - let mt = MerkleTree::new::(&leafs).unwrap(); + let mt = MerkleTree::par_new(&leafs).unwrap(); // Write entire Merkle tree to memory, because that's what the VM does let pointer = dynamic_allocator(memory); diff --git a/tasm-lib/src/hashing/merkle_root_from_xfes_generic.rs b/tasm-lib/src/hashing/merkle_root_from_xfes_generic.rs index 624603ea..03c342a2 100644 --- a/tasm-lib/src/hashing/merkle_root_from_xfes_generic.rs +++ b/tasm-lib/src/hashing/merkle_root_from_xfes_generic.rs @@ -175,8 +175,6 @@ impl BasicSnippet for MerkleRootFromXfesGeneric { #[cfg(test)] mod tests { use num::One; - use twenty_first::prelude::MerkleTreeMaker; - use twenty_first::util_types::merkle_tree::CpuParallel; use twenty_first::util_types::merkle_tree::MerkleTree; use super::*; @@ -201,8 +199,7 @@ mod tests { ); let leafs: Vec = leafs.into_iter().map(|x| x.into()).collect(); - let mt: MerkleTree = CpuParallel::from_digests(&leafs).unwrap(); - let root = mt.root(); + let mt = MerkleTree::par_new(&leafs).unwrap(); // Write entire Merkle tree to memory, because that's what the VM does let digests_in_layer_one = dynamic_allocator(memory); @@ -228,11 +225,7 @@ mod tests { } } - stack.push(root.0[4]); - stack.push(root.0[3]); - stack.push(root.0[2]); - stack.push(root.0[1]); - stack.push(root.0[0]); + stack.extend(mt.root().reversed().values()); } fn pseudorandom_initial_state( diff --git a/tasm-lib/src/hashing/merkle_root_from_xfes_static_size.rs b/tasm-lib/src/hashing/merkle_root_from_xfes_static_size.rs index d4479991..67557738 100644 --- a/tasm-lib/src/hashing/merkle_root_from_xfes_static_size.rs +++ b/tasm-lib/src/hashing/merkle_root_from_xfes_static_size.rs @@ -120,7 +120,7 @@ mod tests { let xfes_pointer = stack.pop().unwrap(); let xfes = array_from_memory::(xfes_pointer, self.num_leaves(), memory); let as_digests: Vec = xfes.into_iter().map(|x| x.into()).collect_vec(); - let mt = MerkleTree::new::(&as_digests).unwrap(); + let mt = MerkleTree::par_new(&as_digests).unwrap(); let num_not_leaf_nodes = self.num_leaves() as u32; diff --git a/tasm-lib/src/hashing/merkle_root_from_xfes_wrapper.rs b/tasm-lib/src/hashing/merkle_root_from_xfes_wrapper.rs index c97b1d75..e9552c5e 100644 --- a/tasm-lib/src/hashing/merkle_root_from_xfes_wrapper.rs +++ b/tasm-lib/src/hashing/merkle_root_from_xfes_wrapper.rs @@ -134,7 +134,7 @@ mod tests { "This algorithm currently can currently only handle lengths of 256, 512, and 1024." ); let as_digests: Vec = xfes.into_iter().map(|x| x.into()).collect_vec(); - let mt = MerkleTree::new::(&as_digests).unwrap(); + let mt = MerkleTree::par_new(&as_digests).unwrap(); let num_not_leaf_nodes = xfes_len as u32; // Modify statically allocated memory as the above snippet does. diff --git a/tasm-lib/src/hashing/merkle_root_static_size.rs b/tasm-lib/src/hashing/merkle_root_static_size.rs index bf79741a..a13825b5 100644 --- a/tasm-lib/src/hashing/merkle_root_static_size.rs +++ b/tasm-lib/src/hashing/merkle_root_static_size.rs @@ -119,7 +119,7 @@ mod tests { let leafs_pointer = self.nodes_pointer + bfe!(self.num_leaves() as u32) * bfe!(Digest::LEN as u32); let leafs = array_from_memory::(leafs_pointer, self.num_leaves(), memory); - let mt = MerkleTree::new::(&leafs).unwrap(); + let mt = MerkleTree::par_new(&leafs).unwrap(); let num_not_leaf_nodes = self.num_leaves() as u32; diff --git a/tasm-lib/src/verifier/fri/verify.rs b/tasm-lib/src/verifier/fri/verify.rs index 1505a371..94123c01 100644 --- a/tasm-lib/src/verifier/fri/verify.rs +++ b/tasm-lib/src/verifier/fri/verify.rs @@ -12,8 +12,6 @@ use twenty_first::math::polynomial::barycentric_evaluate; use twenty_first::math::polynomial::Polynomial; use twenty_first::math::traits::ModPowU32; use twenty_first::math::x_field_element::EXTENSION_DEGREE; -use twenty_first::prelude::MerkleTreeMaker; -use twenty_first::util_types::merkle_tree::CpuParallel; use twenty_first::util_types::merkle_tree::MerkleTree; use twenty_first::util_types::merkle_tree::MerkleTreeInclusionProof; @@ -954,7 +952,7 @@ impl FriVerify { // Check if last codeword matches the given root let codeword_digests = Self::map_convert_xfe_to_digest(&last_codeword); - let mt: MerkleTree = CpuParallel::from_digests(&codeword_digests).unwrap(); + let mt: MerkleTree = MerkleTree::par_new(&codeword_digests).unwrap(); let last_codeword_merkle_root = mt.root(); let last_root = roots.last().unwrap(); diff --git a/tasm-lib/src/verifier/fri/verify_fri_authentication_paths.rs b/tasm-lib/src/verifier/fri/verify_fri_authentication_paths.rs index ffba8284..895bd8fd 100644 --- a/tasm-lib/src/verifier/fri/verify_fri_authentication_paths.rs +++ b/tasm-lib/src/verifier/fri/verify_fri_authentication_paths.rs @@ -264,7 +264,7 @@ mod tests { .collect_vec(); let leafs_as_digest: Vec = xfe_leafs.iter().map(|&xfe| xfe.into()).collect_vec(); - let tree = MerkleTree::new::(&leafs_as_digest).unwrap(); + let tree = MerkleTree::par_new(&leafs_as_digest).unwrap(); let root = tree.root(); let a_indices = (0..num_indices) diff --git a/tasm-lib/src/verifier/master_table/verify_table_rows.rs b/tasm-lib/src/verifier/master_table/verify_table_rows.rs index 5fe1456d..356ee932 100644 --- a/tasm-lib/src/verifier/master_table/verify_table_rows.rs +++ b/tasm-lib/src/verifier/master_table/verify_table_rows.rs @@ -390,7 +390,7 @@ mod tests { leafs[*leaf_index] = Tip5::hash_varlen(leaf_preimage); } - let merkle_tree: MerkleTree = CpuParallel::from_digests(&leafs).unwrap(); + let merkle_tree = MerkleTree::par_new(&leafs).unwrap(); let merkle_root = merkle_tree.root(); let merkle_root_pointer: BFieldElement = rng.gen(); encode_to_memory(&mut memory, merkle_root_pointer, &merkle_root);