Generalize Accumulator, VectorCommitment over types that implement Hash
eddiew opened this issue · 1 comments
eddiew commented
For example, we can generalize
Accumulator<G: UnknownOrderGroup>
to
Accumulator<T: Hash, G: UnknownOrderGroup>
and add goes from
fn add(self, elems: &[Integer]) -> (Self, MembershipProof<G>)
to
fn add(self, elems: &[T]) -> (Self, MembershipProof<T, G>)
The type parameter T in the accumulator struct would be a phantom type to help prevent mixing accumulators for different element types
whaatt commented
I think this is overall a good idea -- one thing to consider though is that if hash_to_prime
is a bottleneck, people might want to cache its Integer
results for use with the accumulator functions.
Granted, hard to say if people will be doing that in practice...