Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization/Deserialization fails for empty node hashes #46

Closed
Ash-L2L opened this issue Apr 24, 2024 · 0 comments · Fixed by #47
Closed

Serialization/Deserialization fails for empty node hashes #46

Ash-L2L opened this issue Apr 24, 2024 · 0 comments · Fixed by #47

Comments

@Ash-L2L
Copy link
Contributor

Ash-L2L commented Apr 24, 2024

use rustreexo::accumulator::{node_hash::NodeHash, pollard::Pollard};

#[test]
fn test_pollard_serialization() {
    let mut p = Pollard::new();
    let values = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
    let hashes: Vec<NodeHash> = values
         .into_iter()
         .map(|i| NodeHash::from([i; 32]))
         .collect();
    p.modify(&hashes, &[]).expect("modify should work");
    p.modify(&[], &hashes).expect("modify should work");
    let mut serialized= Vec::<u8>::new();
    p.serialize(&mut serialized).expect("serialize should work");
    let _pollard = Pollard::deserialize(&*serialized).expect("deserialization fails");
}
Davidson-Souza added a commit that referenced this issue May 20, 2024
Fix pollard serialization/deserialization (#46), Debug/Display for empty pollard (#48)
Davidson-Souza added a commit to Davidson-Souza/rustreexo that referenced this issue Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant