openzklib / openzl

Zero-Knowledge Cryptography Infrastructure Stack
https://openzl.org
Other
126 stars 14 forks source link

Insertion Function API Semantics #51

Open bhgomes opened 1 year ago

bhgomes commented 1 year ago

On this (and all the other insert functions in OpenZL): we should document how insert behaves (or should behave if it's a trait) in each case. What happens when we try to insert an element that is already there? a) We do nothing. b) We replace it (in the case of a Merkle tree it doesn't make sense, but thing of e.g. a HashMap). c) We insert a duplicate. I think specifying this in every insert implementation will save us from possible mistakes in the future.

_Originally posted by @SupremoUGH in https://github.com/openzklib/openzl/pull/36#discussion_r1047118253_