mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-13 09:31:28 +01:00
feat: added MerkleStore serde
This commit is contained in:
@@ -5,6 +5,9 @@ use crate::{
|
||||
Felt, Word,
|
||||
};
|
||||
|
||||
#[cfg(std)]
|
||||
use std::error::Error;
|
||||
|
||||
const KEYS4: [u64; 4] = [0, 1, 2, 3];
|
||||
const LEAVES4: [Word; 4] = [
|
||||
int_to_node(1),
|
||||
@@ -554,3 +557,12 @@ fn test_constructors() -> Result<(), MerkleError> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(std)]
|
||||
#[test]
|
||||
fn test_serialization() -> Result<(), Box<dyn Error>> {
|
||||
let original = MerkleStore::new().with_merkle_tree(LEAVES4)?;
|
||||
let decoded = MerkleStore::read_from_bytes(&original.to_bytes())?;
|
||||
assert_eq!(original, decoded);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user