Expand description

A full Pollard accumulator implementation. This is a simple version of the forest, that keeps every node in memory. This is may require more memory, but is faster to update, prove and verify.

Example

use rustreexo::accumulator::node_hash::NodeHash;
use rustreexo::accumulator::pollard::Pollard;
let values = vec![0, 1, 2, 3, 4, 5, 6, 7];
let hashes: Vec<NodeHash> = values
    .into_iter()
    .map(|i| NodeHash::from([i; 32]))
    .collect();

let mut p = Pollard::new();

p.modify(&hashes, &[]).expect("Pollard should not fail");
assert_eq!(p.get_roots().len(), 1);

p.modify(&[], &hashes).expect("Still should not fail"); // Remove leaves from the accumulator

assert_eq!(p.get_roots().len(), 1);
assert_eq!(p.get_roots()[0].get_data(), NodeHash::default());

Structs

  • A forest node that can either be a leaf or a branch.
  • The actual Pollard accumulator, it implements all methods required to update the forest and to prove/verify membership.