From 22c9f382c497462bdca7e35a989f9dc60a3caa06 Mon Sep 17 00:00:00 2001 From: Bobbin Threadbare Date: Fri, 21 Apr 2023 11:39:49 -0700 Subject: [PATCH] fix: serialization test --- src/merkle/store/tests.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/merkle/store/tests.rs b/src/merkle/store/tests.rs index ca5be9e..28ac8d7 100644 --- a/src/merkle/store/tests.rs +++ b/src/merkle/store/tests.rs @@ -5,7 +5,7 @@ use crate::{ 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 @@ fn get_leaf_depth_works_with_depth_8() { assert_eq!(Err(MerkleError::DepthTooBig(9)), store.get_leaf_depth(root, 8, a)); } -#[cfg(std)] +#[cfg(feature = "std")] #[test] fn test_serialization() -> Result<(), Box> { 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(()) }