arnaucube
arnaucube/miden-cryptoPublic Self-hosted repository
fix: serialization test
Bobbin Threadbare bobbinth@protonmail.com
Fri, 21 Apr 2023 11:39:49 -0700
commit

22c9f382c497462bdca7e35a989f9dc60a3caa06

parent

9be4253f195a2e2249a1b451dd3984a316616e13

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/merkle/store/tests.rs → src/merkle/store/tests.rs

@@ -5,7 +5,7 @@ merkle::{int_to_node, MerklePathSet, MerkleTree, SimpleSmt},

Felt, Word, WORD_SIZE, ZERO, }; -#[cfg(std)] +#[cfg(feature = "std")] use std::error::Error; const KEYS4: [u64; 4] = [0, 1, 2, 3];

@@ -716,12 +716,12 @@ root = store.set_node(root, index, root).unwrap().root;

assert_eq!(Err(MerkleError::DepthTooBig(9)), store.get_leaf_depth(root, 8, a)); } -#[cfg(std)] +#[cfg(feature = "std")] #[test] fn test_serialization() -> Result<(), Box<dyn Error>> { let mtree = MerkleTree::new(LEAVES4.to_vec())?; - let store: MerkleStore = mtree.clone().into(); - let decoded = MerkleStore::read_from_bytes(&original.to_bytes())?; - assert_eq!(original, decoded); + let store = MerkleStore::from(&mtree); + let decoded = MerkleStore::read_from_bytes(&store.to_bytes()).expect("deserialization failed"); + assert_eq!(store, decoded); Ok(()) }