Browse Source

feat: migrate to new Winterfell (#315)

al-update-winterfell
Al-Kindi-0 11 months ago
committed by Bobbin Threadbare
parent
commit
f967211b5a
No known key found for this signature in database GPG Key ID: 289C444AD87BC941
4 changed files with 16 additions and 18 deletions
  1. +8
    -8
      Cargo.lock
  2. +6
    -6
      Cargo.toml
  3. +1
    -1
      rust-toolchain
  4. +1
    -3
      src/merkle/merkle_tree.rs

+ 8
- 8
Cargo.lock

@ -1113,9 +1113,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]] [[package]]
name = "winter-crypto" name = "winter-crypto"
version = "0.8.3"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aea508aa819e934c837f24bb706e69d890b9be2db82da39cde887e6f0a37246"
checksum = "00fbb724d2d9fbfd3aa16ea27f5e461d4fe1d74b0c9e0ed1bf79e9e2a955f4d5"
dependencies = [ dependencies = [
"blake3", "blake3",
"sha3", "sha3",
@ -1125,9 +1125,9 @@ dependencies = [
[[package]] [[package]]
name = "winter-math" name = "winter-math"
version = "0.8.4"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c36d2a04b4f79f2c8c6945aab6545b7310a0cd6ae47b9210750400df6775a04"
checksum = "004f85bb051ce986ec0b9a2bd90aaf81b83e3c67464becfdf7db31f14c1019ba"
dependencies = [ dependencies = [
"serde", "serde",
"winter-utils", "winter-utils",
@ -1135,9 +1135,9 @@ dependencies = [
[[package]] [[package]]
name = "winter-rand-utils" name = "winter-rand-utils"
version = "0.8.3"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b19ce50e688442052e957a69d72b8057d72ae8f03a7aea7c2538e11c76b2583"
checksum = "f2b827c901ab0c316d89812858ff451d60855c0a5c7ae734b098c62a28624181"
dependencies = [ dependencies = [
"rand", "rand",
"winter-utils", "winter-utils",
@ -1145,6 +1145,6 @@ dependencies = [
[[package]] [[package]]
name = "winter-utils" name = "winter-utils"
version = "0.8.4"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab6efccf6efa6fd0a80784f3894bc372ada67cc30d9c017fc907d4c0cdce86e7"
checksum = "42b77a802c3517972ad537694df27249b5bd5b56e9dc8e368c12991172eb929c"

+ 6
- 6
Cargo.toml

@ -10,7 +10,7 @@ documentation = "https://docs.rs/miden-crypto/0.9.3"
categories = ["cryptography", "no-std"] categories = ["cryptography", "no-std"]
keywords = ["miden", "crypto", "hash", "merkle"] keywords = ["miden", "crypto", "hash", "merkle"]
edition = "2021" edition = "2021"
rust-version = "1.75"
rust-version = "1.78"
[[bin]] [[bin]]
name = "miden-crypto" name = "miden-crypto"
@ -52,12 +52,12 @@ num = { version = "0.4", default-features = false, features = ["alloc", "libm"]
num-complex = { version = "0.4", default-features = false } num-complex = { version = "0.4", default-features = false }
rand = { version = "0.8", default-features = false } rand = { version = "0.8", default-features = false }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.6", default-features = false }
rand-utils = { version = "0.8", package = "winter-rand-utils", optional = true }
rand-utils = { version = "0.9", package = "winter-rand-utils", optional = true }
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] } serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
sha3 = { version = "0.10", default-features = false } sha3 = { version = "0.10", default-features = false }
winter-crypto = { version = "0.8", default-features = false }
winter-math = { version = "0.8", default-features = false }
winter-utils = { version = "0.8", default-features = false }
winter-crypto = { version = "0.9", default-features = false }
winter-math = { version = "0.9", default-features = false }
winter-utils = { version = "0.9", default-features = false }
[dev-dependencies] [dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] } criterion = { version = "0.5", features = ["html_reports"] }
@ -65,7 +65,7 @@ getrandom = { version = "0.2", features = ["js"] }
hex = { version = "0.4", default-features = false, features = ["alloc"] } hex = { version = "0.4", default-features = false, features = ["alloc"] }
proptest = "1.4" proptest = "1.4"
rand_chacha = { version = "0.3", default-features = false } rand_chacha = { version = "0.3", default-features = false }
rand-utils = { version = "0.8", package = "winter-rand-utils" }
rand-utils = { version = "0.9", package = "winter-rand-utils" }
seq-macro = { version = "0.3" } seq-macro = { version = "0.3" }
[build-dependencies] [build-dependencies]

+ 1
- 1
rust-toolchain

@ -1 +1 @@
1.75
1.78

+ 1
- 3
src/merkle/merkle_tree.rs

@ -1,8 +1,6 @@
use alloc::{string::String, vec::Vec}; use alloc::{string::String, vec::Vec};
use core::{fmt, ops::Deref, slice}; use core::{fmt, ops::Deref, slice};
use winter_math::log2;
use super::{InnerNodeInfo, MerkleError, MerklePath, NodeIndex, Rpo256, RpoDigest, Word}; use super::{InnerNodeInfo, MerkleError, MerklePath, NodeIndex, Rpo256, RpoDigest, Word};
use crate::utils::{uninit_vector, word_to_hex}; use crate::utils::{uninit_vector, word_to_hex};
@ -70,7 +68,7 @@ impl MerkleTree {
/// ///
/// Merkle tree of depth 1 has two leaves, depth 2 has four leaves etc. /// Merkle tree of depth 1 has two leaves, depth 2 has four leaves etc.
pub fn depth(&self) -> u8 { pub fn depth(&self) -> u8 {
log2(self.nodes.len() / 2) as u8
(self.nodes.len() / 2).ilog2() as u8
} }
/// Returns a node at the specified depth and index value. /// Returns a node at the specified depth and index value.

Loading…
Cancel
Save